By popular demand…
Here’s a script to make your Apple OS X Leopard 10.5.1-based toolchain setup easier. Be sure your iPhone (Heavenly) directory is extracted to /usr/local/share/iphone-filesystem before using the script.
Move the script to the directory of your choice, and in that directory try:
sudo bash ./leopard_toolchain.sh
If you’re feeling lucky, run the script straight from this website:
curl http://kevinchiu.org/leopard_toolchain.sh|sudo bash
Here’s a repository that you’re welcome to contribute changes to: http://github.com/kevinchiu/iPhone-Toolchain/tree/master
Hey Kevin,
thanks a lot for providing this. It seems like the combination of Mac OS X 10.5.1 and the toolchain do not allow anymore to compile C++ programs.
From what I understand the sjlj exception handling is not supported by LLVM … this did not show up with XCode 2.5 and Mac OS X 10.4.11 … strange.
so it turns out the workaround is to specify
CFLAGS= -DDEBUG -Wall -fno-exceptions
in the makefile
Hello, thank you for the tool. Unfortunately I just managed to compile the toolchain on my own :). I am a bit confused though, because theiphonewiki.com mentions TWO toolchains. One named “toolchain” is made this way from scratch, the other one being named “toolchain 2.0″ and only available by using iPhone SDK. Does that mean this toolchain is not preferred / good for building binaries on iPhone OS 2.x ?
Hi Milan,
This tool chain was created before the existence of the iPhone SDK; so, I’m not sure if it’s compatible with iPhone OS 2.0. I suggest using the official SDK if you can spare the $99.
I tried to build using Sauriks description, and your script and fixes here.
Both ways I get stuck with an error message when linking, using a vfdecrypted iphone-filesystem from version 3.0: The error message says:…
…
BUILD_PREFIX=”" \
BUILD_PREFIX_1=”loser-” \
LANGUAGES=”" \
LIBGCC2_CFLAGS=”-O2 -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-pro
totypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC -
pipe -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED ” \
MULTILIB_CFLAGS=”" T= crt3.o
make[3]: `crt3.o’ is up to date.
/Users/matthias/home/iphone-dev/iphone-dev/build/llvm-gcc-4.0-iphone/gcc/xgcc -B
/Users/matthias/home/iphone-dev/iphone-dev/build/llvm-gcc-4.0-iphone/gcc/ -mmaco
sx-version-min=10.1 -B/usr/local/arm-apple-darwin/bin/ -B/usr/local/arm-apple-da
rwin/lib/ -isystem /usr/local/arm-apple-darwin/include -isystem /usr/local/arm-a
pple-darwin/sys-include -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-proto
types -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC -pi
pe -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -dynamiclib -no
defaultlibs -install_name /usr/lib/libgcc_s`if test . = ppc64 ; then echo _. ; f
i`.1.dylib -single_module -o ./libgcc_s.1.dylib.tmp -Wl,-exported_symbols_list,l
ibgcc/./libgcc.map -compatibility_version 1 -current_version 1.0 libgcc/./_udiv
si3_s.o libgcc/./_divsi3_s.o libgcc/./_umodsi3_s.o libgcc/./_modsi3_s.o libgcc/.
/_dvmd_tls_s.o libgcc/./_muldi3_s.o libgcc/./_negdi2_s.o libgcc/./_lshrdi3_s.o l
ibgcc/./_ashldi3_s.o libgcc/./_ashrdi3_s.o libgcc/./_cmpdi2_s.o libgcc/./_ucmpdi
2_s.o libgcc/./_floatdidf_s.o libgcc/./_floatdisf_s.o libgcc/./_fixunsdfsi_s.o l
ibgcc/./_fixunssfsi_s.o libgcc/./_fixunsdfdi_s.o libgcc/./_fixdfdi_s.o libgcc/./
_fixunssfdi_s.o libgcc/./_fixsfdi_s.o libgcc/./_fixxfdi_s.o libgcc/./_fixunsxfdi
_s.o libgcc/./_floatdixf_s.o libgcc/./_fixunsxfsi_s.o libgcc/./_fixtfdi_s.o libg
cc/./_fixunstfdi_s.o libgcc/./_floatditf_s.o libgcc/./_clear_cache_s.o libgcc/./
_enable_execute_stack_s.o libgcc/./_trampoline_s.o libgcc/./__main_s.o libgcc/./
_absvsi2_s.o libgcc/./_absvdi2_s.o libgcc/./_addvsi3_s.o libgcc/./_addvdi3_s.o l
ibgcc/./_subvsi3_s.o libgcc/./_subvdi3_s.o libgcc/./_mulvsi3_s.o libgcc/./_mulvd
i3_s.o libgcc/./_negvsi2_s.o libgcc/./_negvdi2_s.o libgcc/./_ctors_s.o libgcc/./
_ffssi2_s.o libgcc/./_ffsdi2_s.o libgcc/./_clz_s.o libgcc/./_clzsi2_s.o libgcc/.
/_clzdi2_s.o libgcc/./_ctzsi2_s.o libgcc/./_ctzdi2_s.o libgcc/./_popcount_tab_s.
o libgcc/./_popcountsi2_s.o libgcc/./_popcountdi2_s.o libgcc/./_paritysi2_s.o li
bgcc/./_paritydi2_s.o libgcc/./_powisf2_s.o libgcc/./_powidf2_s.o libgcc/./_powi
xf2_s.o libgcc/./_powitf2_s.o libgcc/./_mulsc3_s.o libgcc/./_muldc3_s.o libgcc/.
/_mulxc3_s.o libgcc/./_multc3_s.o libgcc/./_divsc3_s.o libgcc/./_divdc3_s.o libg
cc/./_divxc3_s.o libgcc/./_divtc3_s.o libgcc/./_divdi3_s.o libgcc/./_moddi3_s.o
libgcc/./_udivdi3_s.o libgcc/./_umoddi3_s.o libgcc/./_udiv_w_sdiv_s.o libgcc/./_
udivmoddi4_s.o libgcc/./unwind-dw2_s.o libgcc/./unwind-dw2-fde-darwin_s.o libgcc
/./unwind-sjlj_s.o libgcc/./unwind-c_s.o -lc
/usr/local/bin/arm-apple-darwin-ld: /usr/local/share/iphone-filesystem/usr/lib/l
ibc.dylib unknown flags (type) of section 4 (__TEXT,__dof_magmalloc) in load com
mand 0
collect2: ld returned 1 exit status
make[2]: *** [libgcc_s.dylib] Error 1
make[1]: *** [stmp-multilib] Error 2
make: *** [install-gcc] Error 2
@cycologist
You should probably just install XCode. It’s free now.
@cycologist,
R u able to solve the issue?
I am also getting same error (I have already installed XCode)
hello Kevin
you’ve forgot to mention to extract MacOSX10.4.Universal.pkg/Payload into /Developer folder before running your script too.
@ole2
Thanks for the reminder. I must have already had that in place for some reason.
hello Kevin
thanks for keeping interest on feedbacks on your helpful script.
I have another suggestion is to remove sudo out of your script.
it’s better to have it executed like:
sudo bash ./leopard_toolchain.sh
cause some systems (like cygwin for ex.) do not own/handle sudo properly
I’m testing cygwin based builds of your script, also going to run it against MacOSX10.4u.sdk as well as MacOSX10.5.sdk.
I’ll let you know what else was missing.
@ole2
I’ve created a repository (I added a link at the bottom of the article), and I’d be grateful for any updates you’d like to provide.
hello Kevin
here is cygwin edition of build script:
git://gist.github.com/172795.git
no problem if you put or merge it with yours.
I basically reached the point, described by cycologist and see no way to bypass it yet.
if you’ll find the way, please inform.
thanks
actually this link will be probably better one:
http://gist.github.com/172795#
I’d like to hear review feedback from you first before doing any merges and may be good to be able to exchange e-mails about.
When I built this script – iPhone 3.0 wasn’t out yet – I’ll check in a bit.