ps3dev / ps3toolchain

A script to autobuild an open source toolchain for the PS3.
BSD 2-Clause "Simplified" License
283 stars 92 forks source link

Build error on Cygwin in ps3libraries/scripts/002-libpng-1.4.4.sh #21

Closed yllLiBe closed 13 years ago

yllLiBe commented 13 years ago

Hi.

I tried to build ps3toolchain on Cygwin twice, but following error occured. At the second time, I had removed all files created in the first time (even archive files) and re-extracted `ooPo-ps3toolchain-e24950a.tar.gz', but same error occured. I think I have to try in more clean environment, but do you have any ideas at this moment?

(from console output)
(snip)
libpng-1.4.4/projects/vstudio/pngtest/pngtest.vcxproj
libpng-1.4.4/projects/vstudio/libpng/libpng.vcxproj
libpng-1.4.4/projects/vstudio/zlib/zlib.vcxproj
patching file config.sub
configure: WARNING: If you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used.
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for ppu-strip... ppu-strip
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for ppu-gcc... ppu-gcc
checking whether the C compiler works... no
configure: error: in `/home/yllLiBe/ooPo-ps3toolchain-e24950a/build/ps3libraries
/build/libpng-1.4.4/build-ppu':
configure: error: C compiler cannot create executables
See `config.log' for more details.
../scripts/002-libpng-1.4.4.sh: Failed.
../scripts/012-ps3libraries.sh: Failed.
(from ps3libraries/build/libpng-1.4.4/build-ppu/config.log)
## ----------- ##
## Core tests. ##
## ----------- ##

configure:2281: checking for a BSD-compatible install
configure:2349: result: /usr/bin/install -c
configure:2360: checking whether build environment is sane
configure:2410: result: yes
configure:2459: checking for ppu-strip
configure:2475: found /usr/local/ps3dev/host/ppu/bin/ppu-strip
configure:2486: result: ppu-strip
configure:2551: checking for a thread-safe mkdir -p
configure:2590: result: /usr/bin/mkdir -p
configure:2603: checking for gawk
configure:2619: found /usr/bin/gawk
configure:2630: result: gawk
configure:2641: checking whether make sets $(MAKE)
configure:2663: result: yes
configure:2744: checking whether to enable maintainer-specific portions of Makefiles
configure:2753: result: no
configure:2786: checking for ppu-gcc
configure:2802: found /usr/local/ps3dev/host/ppu/bin/ppu-gcc
configure:2813: result: ppu-gcc
configure:3082: checking for C compiler version
configure:3091: ppu-gcc --version >&5
ppu-gcc (GCC) 4.5.2
Copyright (C) 2010 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:3102: $? = 0
configure:3091: ppu-gcc -v >&5
Using built-in specs.
COLLECT_GCC=ppu-gcc
COLLECT_LTO_WRAPPER=/usr/local/ps3dev/host/ppu/libexec/gcc/ppu/4.5.2/lto-wrapper.exe
Target: ppu
Configured with: ../configure --prefix=/usr/local/ps3dev/host/ppu --target=ppu --disable-dependency-tracking --disable-libstdcxx-pch --disable-multilib --disable-nls --disable-shared --disable-win32-registry --enable-languages=c,c++,objc,obj-c++ --enable-long-double-128 --enable-lto --enable-threads --with-cpu=cell --with-newlib
Thread model: single
gcc version 4.5.2 (GCC) 
configure:3102: $? = 0
configure:3091: ppu-gcc -V >&5
ppu-gcc: '-V' option must have argument
configure:3102: $? = 1
configure:3091: ppu-gcc -qversion >&5
ppu-gcc: unrecognized option '-qversion'
ppu-gcc: no input files
configure:3102: $? = 1
configure:3122: checking whether the C compiler works
configure:3144: ppu-gcc -I/usr/local/ps3dev/host/ppu/include  -L/usr/local/ps3dev/host/ppu/lib -L/usr/local/ps3dev/psl1ght/lib conftest.c  >&5
/usr/local/ps3dev/host/ppu/lib/gcc/ppu/4.5.2/../../../../ppu/lib/lv2-crt0.o: In function `._initialize':
(.text._initialize+0x58): undefined reference to `.exit'
collect2: ld returned 1 exit status
configure:3148: $? = 1
configure:3186: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "libpng"
| #define PACKAGE_TARNAME "libpng"
| #define PACKAGE_VERSION "1.4.4"
| #define PACKAGE_STRING "libpng 1.4.4"
| #define PACKAGE_BUGREPORT "png-mng-implement@lists.sourceforge.net"
| #define PACKAGE_URL ""
| #define PACKAGE "libpng"
| #define VERSION "1.4.4"
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:3191: error: in `/home/yllLiBe/ooPo-ps3toolchain-e24950a/build/ps3libraries/build/libpng-1.4.4/build-ppu':
configure:3195: error: C compiler cannot create executables
See `config.log' for more details.

Regards

odeo commented 13 years ago

I've got exactly the same. exit() should be present in newlib not sure why it can't find it. I'll do some research.

odeo commented 13 years ago

It looks like even though the library dirs are reported correctly by GCC, it is not actually picking up libc.a. I tried passing libc.a directly on the command line and this works. So somehow on cygwin something has gone wrong with the paths. Strace output shows: 861 244766 [main] ld 3328 open: open (/lib/libc.a, 0x10000) 44 244810 [main] ld 3328 normalize_posix_path: src /lib/libc.a 43 244853 [main] ld 3328 normalize_posix_path: /lib/libc.a = normalize_posix_path (/lib/libc.a)

So it's opening libc.a from /lib instead of the install path

odeo commented 13 years ago

This may have something to do with it: "If you are not building a C library in the same source tree as GCC, you should also provide the target libraries and headers before configuring GCC, specifying the directories with --with-sysroot or --with-headers and --with-libs." Will give it a try

odeo commented 13 years ago

--with-sysroot is not the issue. The SPU-gcc works fine. It's just the PPU-gcc that doesn't look in the correct dir for its libs. It must be somewhere in the GCC or newlib config for PPU..

ghost commented 13 years ago

big ol guess on my part ...

export LD_LIBRARY_PATH=$PS3DEV/host/ppu/ppu/lib ./toolchain.sh

odeo commented 13 years ago

That should not be needed. toolchain.sh follows the normal recommended steps for building a cross gcc with newlib: http://www.ifp.illinois.edu/~nakazato/tips/xgcc.html#newlib

There must be something in the GCC config for PPU that's not compatible cygwin. After all the SPU toolchain works fine with the same steps. It's just that its a pain to fix inside GCC unless you know where to look

BlackTr commented 13 years ago

There is solution: comment out line 'SEARCH_DIR("=/lib")' in the file host/ppu/ppu/lib/lv2.ld

ooPo commented 13 years ago

Does this fix the problem?

BlackTr commented 13 years ago

Yes. I have compiled all ps3libraries...

ooPo commented 13 years ago

Did you have to comment out that line?

superg commented 13 years ago

I have the same problem with toolchain compilation, but under linux (ubuntu 11.04, 64-bit). Message log: configure: error: in `/home/g/temp/ps3/ps3toolchain/build/ps3libraries/build/libpng-1.4.4/build-ppu': configure: error: C compiler cannot create executables

Real problem is: /home/g/dev/ps3dev/ppu/lib/gcc/ppu/4.5.2/../../../../ppu/bin/ld: a.out: section `.tbss' can't be allocated in segment 1 LOAD: .ctors .dtors .jcr .data.sceFStub .opd .branch_lt .got .tdata .tbss /home/g/dev/ps3dev/ppu/lib/gcc/ppu/4.5.2/../../../../ppu/bin/ld: final link failed: Bad value collect2: ld returned 1 exit status

zeldin commented 13 years ago

@superg: That's actually a different problem, and one which has been fixed now (pull ps3toolchain and rebuild). :-)