forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Cannot compile PSP Libraries

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
mase



Joined: 21 Aug 2009
Posts: 23

PostPosted: Fri Aug 21, 2009 3:11 am    Post subject: Cannot compile PSP Libraries Reply with quote

Hi!
I have checked out the psptoolchain and installed it successfully.
Now I cannot compile most of the PSP libraries, for example freetype
or sdl. I have set the environment variables correctly and did exactly
as written in the readme. Some of the libraries install, some not.
Here is the config.log of freetype:
Code:
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by configure, which was
generated by GNU Autoconf 2.64.  Invocation command line was

  $ ./configure --host psp --prefix=/usr/local/pspdev/psp

## --------- ##
## Platform. ##
## --------- ##

hostname = mase1
uname -m = i686
uname -r = 2.6.30-1-686-bigmem
uname -s = Linux
uname -v = #1 SMP Mon Aug 3 17:32:39 UTC 2009

/usr/bin/uname -p = unknown
/bin/uname -X     = unknown

/bin/arch              = unknown
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = unknown
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /usr/local/sbin
PATH: /usr/local/bin
PATH: /usr/sbin
PATH: /usr/bin
PATH: /sbin
PATH: /bin
PATH: /usr/share/psp-dev/bin
PATH: /bin
PATH: /usr/share/psp-dev/bin
PATH: /usr/share/psp-dev/psp/sdk/bin
PATH: /usr/local/pspdev/bin
PATH: /usr/local/pspdev/psp/sdk/bin


## ----------- ##
## Core tests. ##
## ----------- ##

configure:2529: checking build system type
configure:2543: result: i686-pc-linux-gnu
configure:2563: checking host system type
configure:2576: result: mipsallegrexel-psp-elf
configure:2596: checking target system type
configure:2609: result: mipsallegrexel-psp-elf
configure:2647: checking for psp-gcc
configure:2663: found /usr/local/pspdev/bin/psp-gcc
configure:2674: result: psp-gcc
configure:2943: checking for C compiler version
configure:2952: psp-gcc --version >&5
psp-gcc (GCC) 4.3.2
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:2963: $? = 0
configure:2952: psp-gcc -v >&5
Using built-in specs.
Target: psp
Configured with: ../configure --prefix=/usr/local/pspdev --target=psp --enable-languages=c,c++ --with-newlib --with-gmp --with-mpfr --enable-cxx-flags=-G0
Thread model: single
gcc version 4.3.2 (GCC)
configure:2963: $? = 0
configure:2952: psp-gcc -V >&5
psp-gcc: '-V' option must have argument
configure:2963: $? = 1
configure:2952: psp-gcc -qversion >&5
psp-gcc: unrecognized option '-qversion'
psp-gcc: no input files
configure:2963: $? = 1
configure:2985: checking for C compiler default output file name
configure:3007: psp-gcc   -L/usr/local/pspdev/psp/sdk/lib -lc -lpspuser conftest.c  >&5
/tmp/ccUoUUBM.o: In function `main':
conftest.c:(.text+0x20): undefined reference to `fopen'
conftest.c:(.text+0x48): undefined reference to `fclose'
collect2: ld returned 1 exit status
configure:3011: $? = 1
configure:3048: result:
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h.  */
| #include <stdio.h>
| int
| main ()
| {
| FILE *f = fopen ("conftest.out", "w");
|  return ferror (f) || fclose (f) != 0;
|
|   ;
|   return 0;
| }
configure:3054: error: in `/home/mase/psp-libraries/build/freetype/builds/unix':
configure:3058: error: C compiler cannot create executables
See `config.log' for more details.

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_build=i686-pc-linux-gnu
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_LDFLAGS_set=set
ac_cv_env_LDFLAGS_value='-L/usr/local/pspdev/psp/sdk/lib -lc -lpspuser'
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=set
ac_cv_env_host_alias_value=psp
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_host=mipsallegrexel-psp-elf
ac_cv_prog_CC=psp-gcc
ac_cv_target=mipsallegrexel-psp-elf

## ----------------- ##
## Output variables. ##
## ----------------- ##

AR=''
CC='psp-gcc'
CFLAGS=''
CPP=''
CPPFLAGS=''
DEFS=''
DSYMUTIL=''
DUMPBIN=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP=''
EXEEXT=''
FGREP=''
FTSYS_SRC=''
GREP=''
INSTALL_DATA=''
INSTALL_PROGRAM=''
INSTALL_SCRIPT=''
LD=''
LDFLAGS='-L/usr/local/pspdev/psp/sdk/lib -lc -lpspuser'
LIBOBJS=''
LIBS=''
LIBTOOL=''
LIBZ=''
LIPO=''
LN_S=''
LTLIBOBJS=''
NM=''
NMEDIT=''
OBJDUMP=''
OBJEXT=''
OTOOL64=''
OTOOL=''
PACKAGE_BUGREPORT=''
PACKAGE_NAME=''
PACKAGE_STRING=''
PACKAGE_TARNAME=''
PACKAGE_URL=''
PACKAGE_VERSION=''
PATH_SEPARATOR=':'
RANLIB=''
RMDIR=''
RMF=''
SED=''
SHELL='/bin/bash'
STRIP=''
SYSTEM_ZLIB=''
XX_ANSIFLAGS=''
XX_CFLAGS=''
ac_ct_CC=''
ac_ct_DUMPBIN=''
bindir='${exec_prefix}/bin'
build='i686-pc-linux-gnu'
build_alias=''
build_cpu='i686'
build_os='linux-gnu'
build_vendor='pc'
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE}'
dvidir='${docdir}'
enable_shared=''
exec_prefix='NONE'
ft_version='9.8.3'
hardcode_libdir_flag_spec=''
host='mipsallegrexel-psp-elf'
host_alias='psp'
host_cpu='mipsallegrexel'
host_os='elf'
host_vendor='psp'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
lt_ECHO='echo'
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='/usr/local/pspdev/psp'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target='mipsallegrexel-psp-elf'
target_alias=''
target_cpu='mipsallegrexel'
target_os='elf'
target_vendor='psp'
version_info='9:8:3'
wl=''

## ----------- ##
## confdefs.h. ##
## ----------- ##

/* confdefs.h */
#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""

configure: exit 77

The problem seems to be the undefinied reference to fopen and fclose.
But I cannot see any problem here, as I see in the log, the psplibc
is linked correctly. I was searching for a solution the whole day. SDL
gives me the same problem with fopen and fclose.
I am using Debian Squeeze.
What am I doing wrong?
Back to top
View user's profile Send private message
jojojoris



Joined: 30 Mar 2008
Posts: 261

PostPosted: Fri Aug 21, 2009 3:36 am    Post subject: Reply with quote

I had something like this a long time ago. Dunno if this is the same.

I solved it by replacing the freetype libtool with the one from SDL
_________________
Code:
int main(){
     SetupCallbacks();
     makeNiceGame();
     sceKernelExitGame();
}
Back to top
View user's profile Send private message
mase



Joined: 21 Aug 2009
Posts: 23

PostPosted: Fri Aug 21, 2009 3:44 am    Post subject: Reply with quote

But I cannot compile SDL, too. The same error.
The code causing the error is in build/unix/configure.
I had never seen before, that C code stands in a configure script.
_________________
May the force be with us!
Back to top
View user's profile Send private message
jojojoris



Joined: 30 Mar 2008
Posts: 261

PostPosted: Fri Aug 21, 2009 3:55 am    Post subject: Reply with quote

Did oy install the SDK correctly?
_________________
Code:
int main(){
     SetupCallbacks();
     makeNiceGame();
     sceKernelExitGame();
}
Back to top
View user's profile Send private message
mase



Joined: 21 Aug 2009
Posts: 23

PostPosted: Fri Aug 21, 2009 4:13 am    Post subject: Reply with quote

jojojoris wrote:
Did oy install the SDK correctly?

I think so. I checked out the psptoolchain, set my variables, and
ran the script. Some libs install without errors. I can compile apps
like "hello world", and they work on the PSP.
But I wondered, that building the toolchain took only a few minutes.
Not as long as it was announced.

Now I tried this, linking with absolute paths:
Code:
configure:3007: psp-gcc   -L/usr/local/pspdev/psp/sdk/lib -L/usr/local/pspdev/psp/sdk/lib/libpsplibc.a -L/usr/local/pspdev/psp/sdk/lib/libpspuser.a conftest.c  >&5
/usr/local/pspdev/lib/gcc/psp/4.3.2/../../../../psp/lib/crt0.o: In function `_start':
/home/mase/pspsdk/src/startup/crt0.c:149: undefined reference to `sceKernelCreateThread'
/home/mase/pspsdk/src/startup/crt0.c:150: undefined reference to `sceKernelStartThread'
/usr/local/pspdev/lib/gcc/psp/4.3.2/../../../../psp/lib/crt0.o: In function `_main':
/home/mase/pspsdk/src/startup/crt0.c:68: undefined reference to `strlen'
/home/mase/pspsdk/src/startup/crt0.c:83: undefined reference to `atexit'
/home/mase/pspsdk/src/startup/crt0.c:89: undefined reference to `exit'
/tmp/ccM1CDX5.o: In function `main':
conftest.c:(.text+0x20): undefined reference to `fopen'
conftest.c:(.text+0x48): undefined reference to `fclose'
collect2: ld returned 1 exit status

_________________
May the force be with us!
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Fri Aug 21, 2009 12:37 pm    Post subject: Reply with quote

libc should certainly include fopen, fclose, etc. Maybe the toolchain never finished building newlib?
Back to top
View user's profile Send private message
mase



Joined: 21 Aug 2009
Posts: 23

PostPosted: Fri Aug 21, 2009 5:18 pm    Post subject: Reply with quote

I did not see any errors.
Then I executed the buildscripts
separately, one after another, to
have more control. No error occured.
The libpsplibc.a is present.
_________________
May the force be with us!
Back to top
View user's profile Send private message
jojojoris



Joined: 30 Mar 2008
Posts: 261

PostPosted: Fri Aug 21, 2009 7:08 pm    Post subject: Reply with quote

you don't need psplibc.a the real one is just libc.a
_________________
Code:
int main(){
     SetupCallbacks();
     makeNiceGame();
     sceKernelExitGame();
}
Back to top
View user's profile Send private message
mase



Joined: 21 Aug 2009
Posts: 23

PostPosted: Fri Aug 21, 2009 10:46 pm    Post subject: Reply with quote

So I don't know, why I get the undefinied reference. The libc is
linked by -lc.

The error occurs only, if psp-gcc was found in path. I removed it and
it compiles. Let's see, if the libraries work compiled with standard gcc...

No, it doesn't seem to work. SDL doesn't compile this way.

What libc must be linked? The standard linux or for psp? In the psp-tree
there are 2, libc.a and libpsplibc.a. If I lokk into the script, libpsplibc
seems to be the linked one. Maybe gcc is too new in Debian Squeeze?
It is gcc-4.3.4.
If I use the install-script for Ubuntu, I get the same error.
_________________
May the force be with us!
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Sat Aug 22, 2009 4:31 am    Post subject: Reply with quote

It needs libc, not libpsplibc.
It sounds like your toolchain is somehow messed up. maybe you have two copies installed and it's finding bad stuff in the old location?
Back to top
View user's profile Send private message
mase



Joined: 21 Aug 2009
Posts: 23

PostPosted: Sat Aug 22, 2009 4:47 am    Post subject: Reply with quote

But I can successfully build and execute a hello world program.
So I think the toolchain is set up correctly. There are no copies.
Is it correct, that psp-gcc is used for compilation?
_________________
May the force be with us!
Back to top
View user's profile Send private message
mase



Joined: 21 Aug 2009
Posts: 23

PostPosted: Sat Aug 22, 2009 12:58 pm    Post subject: Reply with quote

Everything works fine under Ubuntu 9.04, which I have temporarely set
up in VirtualBox. But why not under Debian?
_________________
May the force be with us!
Back to top
View user's profile Send private message
jojojoris



Joined: 30 Mar 2008
Posts: 261

PostPosted: Sat Aug 22, 2009 7:13 pm    Post subject: Reply with quote

mase wrote:
Everything works fine under Ubuntu 9.04, which I have temporarely set
up in VirtualBox. But why not under Debian?

ubuntu = debian
_________________
Code:
int main(){
     SetupCallbacks();
     makeNiceGame();
     sceKernelExitGame();
}
Back to top
View user's profile Send private message
mase



Joined: 21 Aug 2009
Posts: 23

PostPosted: Sat Aug 22, 2009 9:51 pm    Post subject: Reply with quote

Ubuntu = Debianbased

I think, it is one ore more packages, that are too new. I'll copy the
toolchain compiled under Ubuntu to Debian. I hope, it works.

Yes, I got it! Copied to Debian, and I can use it! A Hello World runs!

But I was trying to compile openttd-0.7.2 for psp.
I get a lot of typedef redeclaration errors:
Code:
In file included from /usr/include/sys/types.h:31,
                 from /usr/share/psp-dev/bin/../lib/gcc/psp/4.3.2/../../../../psp/include/stdio.h:46,
                 from /usr/share/psp-dev/bin/../lib/gcc/psp/4.3.2/../../../../psp/include/c++/4.3.2/cstdio:50,
                 from /home/mase/openttd-0.7.2/src/ai/../stdafx.h:46,
                 from /home/mase/openttd-0.7.2/src/ai/ai_config.cpp:5:
/usr/include/bits/types.h:134: error: conflicting declaration ‘typedef __u_quad_t __dev_t’
/usr/share/psp-dev/bin/../lib/gcc/psp/4.3.2/../../../../psp/include/sys/_types.h:24: error: ‘__dev_t’ has a previous declaration as ‘typedef short int __dev_t’
/usr/include/bits/types.h:135: error: conflicting declaration ‘typedef unsigned int __uid_t’
/usr/share/psp-dev/bin/../lib/gcc/psp/4.3.2/../../../../psp/include/sys/_types.h:29: error: ‘__uid_t’ has a previous declaration as ‘typedef short unsigned int __uid_t’
/usr/include/bits/types.h:136: error: conflicting declaration ‘typedef unsigned int __gid_t’
/usr/share/psp-dev/bin/../lib/gcc/psp/4.3.2/../../../../psp/include/sys/_types.h:32: error: ‘__gid_t’ has a previous declaration as ‘typedef short unsigned int __gid_t’
In file included from /home/mase/openttd-0.7.2/src/ai/ai_config.cpp:5:
/home/mase/openttd-0.7.2/src/ai/../stdafx.h:363: warning: ‘pspDebugScreenPrintf’ is an unrecognized format function type
/home/mase/openttd-0.7.2/src/ai/../stdafx.h:364: warning: ‘pspDebugScreenPrintf’ is an unrecognized format function type
make[1]: *** [ai/ai_config.o] Fehler 1

I think, every #include <sys/...> includes the system headers of my
linux installation. How can I fix this?
_________________
May the force be with us!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group