Page 1 of 1

ps2toolchain on Mac OS X Leopard Intel

Posted: Thu Jan 15, 2009 9:40 pm
by umjammer
Question

I could not build ps2toolchain on Mac OS X Leopard (intel).
I got errors as follows.

log of toolchain.sh

Code: Select all

/usr/local/src/ps2toolchain/build/gcc-3.2.2/build-ee-stage1/gcc/xgcc -B/usr/loca
l/src/ps2toolchain/build/gcc-3.2.2/build-ee-stage1/gcc/ -B/usr/local/ps2dev/ee/e
e/bin/ -B/usr/local/ps2dev/ee/ee/lib/ -isystem /usr/local/ps2dev/ee/ee/include -
O2  -DIN_GCC -DCROSS_COMPILE   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmi
ssing-prototypes -isystem ./include  -G 0 -g  -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEE
DED -Dinhibit_libc -I. -I. -I../../gcc -I../../gcc/. -I../../gcc/config -I../../
gcc/../include  -DL_muldi3 -c ../../gcc/libgcc2.c -o libgcc/./_muldi3.o
/usr/local/src/ps2toolchain/build/gcc-3.2.2/build-ee-stage1/gcc/xgcc -B/usr/loca
l/src/ps2toolchain/build/gcc-3.2.2/build-ee-stage1/gcc/ -B/usr/local/ps2dev/ee/e
e/bin/ -B/usr/local/ps2dev/ee/ee/lib/ -isystem /usr/local/ps2dev/ee/ee/include -
O2  -DIN_GCC -DCROSS_COMPILE   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmi
ssing-prototypes -isystem ./include  -G 0 -g  -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEE
DED -Dinhibit_libc -I. -I. -I../../gcc -I../../gcc/. -I../../gcc/config -I../../
gcc/../include  -DL_negdi2 -c ../../gcc/libgcc2.c -o libgcc/./_negdi2.o
FATAL:/usr/bin/../libexec/gcc/darwin/i386/as: I don't understand 'G' flag!
FATAL:/usr/bin/../libexec/gcc/darwin/i386/as: I don't understand 'G' flag!
make[2]: *** [libgcc/./_negdi2.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [libgcc/./_muldi3.o] Error 1
make[1]: *** [libgcc.a] Error 2
make: *** [all-gcc] Error 2
What I did

* patch binutils like psptoolchain for osx patches.
* patch config.gcc to support i686-apple-darwin9.6.0

My Environment

Code: Select all

 $ uname -a
 Darwin xxx.local 9.6.0 Darwin Kernel Version 9.6.0: Mon Nov 24
 17:37:00 PST 2008; root:xnu-1228.9.59~1/RELEASE_I386 i386 i386 
 MacBookPro5,1 Darwin

Code: Select all

 $ svn info
 URL: svn://svn.ps2dev.org/ps2/trunk/ps2toolchain
 :
 Revision: 1502
 :
 Last Changed Date: 2007-08-23 18:23:49 +0900 (Thu, 23 Aug 2007)

Code: Select all

 $gcc --version
 i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5490)
* I succeed to build psptoolchain on this environment.

Help me!

Success to build!

Posted: Tue Jan 20, 2009 10:41 pm
by umjammer
Result

I succeed to build ps2toolchain on Mac OS X Leopard (Intel)!

Cause

I forgot to strip .dSYM in binutils...
ee/ee/bin/*.dSYM
iop/iop/bin/*.dSYM
dvp/dvp/bin/*.dSYM
Patch

I give you my patches.

http://www.mediafire.com/?m1yyi2zyndj

Posted: Wed Jan 21, 2009 3:25 am
by ooPo
I would much rather apply these patches directly to the source rather than hack them into the ps2toolchain script.

Will these changes affect building the software on non-OSX machines?

Posted: Wed Jan 21, 2009 8:13 am
by ragnarok2040
The gcc patch is fine. The binutils patches will break setups using a cross compiler to build the ps2 toolchain for other hosts. They won't affect anything when compiling the ps2 toolchain with a native toolchain, unless the native toolchain is broken as the test checking for that is commented.

Posted: Mon Jan 26, 2009 8:23 am
by druckluft
Thanks for the patch. Using it I managed to install the toolchain on macos 10.5.5. But I had to make a few other changes for it to work.

The problem was the three configure scripts for binutils2.14/bfd binutils2.14/binutils and binutils2.14/opcodes. They all stop with an error saying the native macos gcc compiler does not work. This has to do with the way the configure scripts figure out the suffix for executables (for example .exe). To find the suffix (variable ac_cv_exeext) the scripts run gcc on conftest.c and detect what files are created with name conftest.*. Files ending with .c .o .obj .ilk .pdb are ignored. Seeing the newly created directory conftest.dSYM the configure scripts think that this is the exefile and that .dSYM is the suffix. This causes trouble later when the script tries to compile a file with that name which it cannot since there already is a directory with that name. One solution to the problem is to add .dSYM to the list of endings that should be ignored. This requires change of 2-3 lines in each of the three configure scripts.

I have no experience in making patches, so I thought I would just write this comment here to help others with the same problem.

The GNU_FTP variable must also be set for the patch to work.

Posted: Tue Jan 27, 2009 9:47 am
by ragnarok2040
I saw a patch that did that in the PSP forums for the psp toolchain as well. I think gcc still appended the .dSYM suffix to the exectuables during the compile or install phase, though, since they needed to be stripped off afterwards. Would doing

Code: Select all

export EXEEXT=""
help at all?

Posted: Thu Jan 29, 2009 5:49 am
by druckluft
No, unfortunately just doing

Code: Select all

export EXEEXT=""
before running the toolchain.sh script does not work:

Code: Select all

configure: error: installation or configuration problem: C compiler cannot create executables

Posted: Thu Jan 29, 2009 11:57 am
by ragnarok2040
Ahh, ok. Thanks for trying :D. I'll snoop around the net for some more info.