Cannot compile PSP Libraries

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
mase
Posts: 23
Joined: Fri Aug 21, 2009 3:04 am

Cannot compile PSP Libraries

Post by mase »

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: Select all

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 &#40;&#41;
| &#123;
| FILE *f = fopen &#40;"conftest.out", "w"&#41;;
|  return ferror &#40;f&#41; || fclose &#40;f&#41; != 0;
| 
|   ;
|   return 0;
| &#125;
configure&#58;3054&#58; error&#58; in `/home/mase/psp-libraries/build/freetype/builds/unix'&#58;
configure&#58;3058&#58; error&#58; 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='&#58;'
RANLIB=''
RMDIR=''
RMF=''
SED=''
SHELL='/bin/bash'
STRIP=''
SYSTEM_ZLIB=''
XX_ANSIFLAGS=''
XX_CFLAGS=''
ac_ct_CC=''
ac_ct_DUMPBIN=''
bindir='$&#123;exec_prefix&#125;/bin'
build='i686-pc-linux-gnu'
build_alias=''
build_cpu='i686'
build_os='linux-gnu'
build_vendor='pc'
datadir='$&#123;datarootdir&#125;'
datarootdir='$&#123;prefix&#125;/share'
docdir='$&#123;datarootdir&#125;/doc/$&#123;PACKAGE&#125;'
dvidir='$&#123;docdir&#125;'
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='$&#123;docdir&#125;'
includedir='$&#123;prefix&#125;/include'
infodir='$&#123;datarootdir&#125;/info'
libdir='$&#123;exec_prefix&#125;/lib'
libexecdir='$&#123;exec_prefix&#125;/libexec'
localedir='$&#123;datarootdir&#125;/locale'
localstatedir='$&#123;prefix&#125;/var'
lt_ECHO='echo'
mandir='$&#123;datarootdir&#125;/man'
oldincludedir='/usr/include'
pdfdir='$&#123;docdir&#125;'
prefix='/usr/local/pspdev/psp'
program_transform_name='s,x,x,'
psdir='$&#123;docdir&#125;'
sbindir='$&#123;exec_prefix&#125;/sbin'
sharedstatedir='$&#123;prefix&#125;/com'
sysconfdir='$&#123;prefix&#125;/etc'
target='mipsallegrexel-psp-elf'
target_alias=''
target_cpu='mipsallegrexel'
target_os='elf'
target_vendor='psp'
version_info='9&#58;8&#58;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&#58; 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?
jojojoris
Posts: 255
Joined: Sun Mar 30, 2008 4:06 am

Post by jojojoris »

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: Select all

int main&#40;&#41;&#123;
     SetupCallbacks&#40;&#41;;
     makeNiceGame&#40;&#41;;
     sceKernelExitGame&#40;&#41;;
&#125;
mase
Posts: 23
Joined: Fri Aug 21, 2009 3:04 am

Post by mase »

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!
jojojoris
Posts: 255
Joined: Sun Mar 30, 2008 4:06 am

Post by jojojoris »

Did oy install the SDK correctly?

Code: Select all

int main&#40;&#41;&#123;
     SetupCallbacks&#40;&#41;;
     makeNiceGame&#40;&#41;;
     sceKernelExitGame&#40;&#41;;
&#125;
mase
Posts: 23
Joined: Fri Aug 21, 2009 3:04 am

Post by mase »

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: Select all

configure&#58;3007&#58; 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&#58; In function `_start'&#58;
/home/mase/pspsdk/src/startup/crt0.c&#58;149&#58; undefined reference to `sceKernelCreateThread'
/home/mase/pspsdk/src/startup/crt0.c&#58;150&#58; undefined reference to `sceKernelStartThread'
/usr/local/pspdev/lib/gcc/psp/4.3.2/../../../../psp/lib/crt0.o&#58; In function `_main'&#58;
/home/mase/pspsdk/src/startup/crt0.c&#58;68&#58; undefined reference to `strlen'
/home/mase/pspsdk/src/startup/crt0.c&#58;83&#58; undefined reference to `atexit'
/home/mase/pspsdk/src/startup/crt0.c&#58;89&#58; undefined reference to `exit'
/tmp/ccM1CDX5.o&#58; In function `main'&#58;
conftest.c&#58;&#40;.text+0x20&#41;&#58; undefined reference to `fopen'
conftest.c&#58;&#40;.text+0x48&#41;&#58; undefined reference to `fclose'
collect2&#58; ld returned 1 exit status
May the force be with us!
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

libc should certainly include fopen, fclose, etc. Maybe the toolchain never finished building newlib?
mase
Posts: 23
Joined: Fri Aug 21, 2009 3:04 am

Post by mase »

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!
jojojoris
Posts: 255
Joined: Sun Mar 30, 2008 4:06 am

Post by jojojoris »

you don't need psplibc.a the real one is just libc.a

Code: Select all

int main&#40;&#41;&#123;
     SetupCallbacks&#40;&#41;;
     makeNiceGame&#40;&#41;;
     sceKernelExitGame&#40;&#41;;
&#125;
mase
Posts: 23
Joined: Fri Aug 21, 2009 3:04 am

Post by mase »

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!
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

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?
mase
Posts: 23
Joined: Fri Aug 21, 2009 3:04 am

Post by mase »

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!
mase
Posts: 23
Joined: Fri Aug 21, 2009 3:04 am

Post by mase »

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!
jojojoris
Posts: 255
Joined: Sun Mar 30, 2008 4:06 am

Post by jojojoris »

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: Select all

int main&#40;&#41;&#123;
     SetupCallbacks&#40;&#41;;
     makeNiceGame&#40;&#41;;
     sceKernelExitGame&#40;&#41;;
&#125;
mase
Posts: 23
Joined: Fri Aug 21, 2009 3:04 am

Post by mase »

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: Select all

In file included from /usr/include/sys/types.h&#58;31,
                 from /usr/share/psp-dev/bin/../lib/gcc/psp/4.3.2/../../../../psp/include/stdio.h&#58;46,
                 from /usr/share/psp-dev/bin/../lib/gcc/psp/4.3.2/../../../../psp/include/c++/4.3.2/cstdio&#58;50,
                 from /home/mase/openttd-0.7.2/src/ai/../stdafx.h&#58;46,
                 from /home/mase/openttd-0.7.2/src/ai/ai_config.cpp&#58;5&#58;
/usr/include/bits/types.h&#58;134&#58; error&#58; conflicting declaration &#8216;typedef __u_quad_t __dev_t&#8217;
/usr/share/psp-dev/bin/../lib/gcc/psp/4.3.2/../../../../psp/include/sys/_types.h&#58;24&#58; error&#58; &#8216;__dev_t&#8217; has a previous declaration as &#8216;typedef short int __dev_t&#8217;
/usr/include/bits/types.h&#58;135&#58; error&#58; conflicting declaration &#8216;typedef unsigned int __uid_t&#8217;
/usr/share/psp-dev/bin/../lib/gcc/psp/4.3.2/../../../../psp/include/sys/_types.h&#58;29&#58; error&#58; &#8216;__uid_t&#8217; has a previous declaration as &#8216;typedef short unsigned int __uid_t&#8217;
/usr/include/bits/types.h&#58;136&#58; error&#58; conflicting declaration &#8216;typedef unsigned int __gid_t&#8217;
/usr/share/psp-dev/bin/../lib/gcc/psp/4.3.2/../../../../psp/include/sys/_types.h&#58;32&#58; error&#58; &#8216;__gid_t&#8217; has a previous declaration as &#8216;typedef short unsigned int __gid_t&#8217;
In file included from /home/mase/openttd-0.7.2/src/ai/ai_config.cpp&#58;5&#58;
/home/mase/openttd-0.7.2/src/ai/../stdafx.h&#58;363&#58; warning&#58; &#8216;pspDebugScreenPrintf&#8217; is an unrecognized format function type
/home/mase/openttd-0.7.2/src/ai/../stdafx.h&#58;364&#58; warning&#58; &#8216;pspDebugScreenPrintf&#8217; is an unrecognized format function type
make&#91;1&#93;&#58; *** &#91;ai/ai_config.o&#93; 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!
Post Reply