My favorites | Sign in
Project Logo
                
Search
for
Updated Mar 11, 2008 by saurik
Labels: Featured, Phase-Deploy
Building  
How to build the toolchain.

Please note that these instructions are subject to change. Before updating your toolchain installation, you should always check the newest version of this page. You should also check Portability to see whether there are any special instructions for your particular platform.

FILE BUG REPORTS TO REPORT BUGS INSTEAD OF LEAVING BUGS AS COMMENTS ON THIS PAGE! THIS MEANS THAT IF THE TOOLCHAIN DOES NOT BUILD FOR YOU, DO NOT LEAVE A COMMENT HERE!

HOWTO build the toolchain

  • Check out a copy of the iphone-dev SVN repository.
  • $ svn checkout http://iphone-dev.googlecode.com/svn/trunk/ iphone-dev
    $ pushd iphone-dev
  • Make a directory to hold the toolchain.
  • $ sudo mkdir /usr/local/arm-apple-darwin
  • Build odcctools.
  • $ mkdir -p build/odcctools
    $ pushd build/odcctools
    $ ../../odcctools/configure --target=arm-apple-darwin --disable-ld64
    $ make
    $ sudo make install
    $ popd
  • Get a copy of the iPhone root filesystem. This is usually obtained by decrypting and extracting the iPhone restore software using these tools, but there are many other methods to obtain this, including simply using scp to download all the files from the iPhone over Wi-Fi. Unpack the root filesystem somewhere, and set the environment variable $HEAVENLY to its path.
  • $ HEAVENLY=/usr/local/share/iphone-filesystem
  • Install the iPhone headers to the appropriate place. If you aren't on Mac OS X, replace the /Developer/SDKs/MacOSX10.4u.sdk path with the full path to the unpacked Mac OS X 10.4 Universal SDK. If you don't have a copy of this, see below.
  • $ pushd include
    $ ./configure --with-macosx-sdk=/Developer/SDKs/MacOSX10.4u.sdk
    $ sudo bash install-headers.sh
    $ popd
  • Install csu, which includes crt1.o, dylib1.o, and bundle1.o. Don't rebuild them from source, as this requires a working cross-GCC, which you don't have yet (and the build-from-source process for csu is broken right now anyway). Binaries are provided for this reason.
  • $ mkdir -p build/csu
    $ pushd build/csu
    $ ../../csu/configure --host=arm-apple-darwin
    $ sudo make install
    $ popd
  • Only if you are compiling on leopard 10.5. This is an ugly workaround and compiling with the resulting toolchain will give you a warning.
  • $ mv llvm-gcc-4.0-iphone/configure llvm-gcc-4.0-iphone/configure.old
    $ sed 's/^FLAGS_FOR_TARGET=$/FLAGS_FOR_TARGET=${FLAGS_FOR_TARGET-}/g' \ 
    llvm-gcc-4.0-iphone/configure.old > llvm-gcc-4.0-iphone/configure
    $ export FLAGS_FOR_TARGET="-mmacosx-version-min=10.1"
    $ sudo ln -s /usr/local/arm-apple-darwin/lib/crt1.o \
    /usr/local/arm-apple-darwin/lib/crt1.10.5.o
  • Configure and make LLVM-GCC. Make sure that $LLVMOBJDIR and $HEAVENLY are set per the instructions above.
  • $ mkdir -p build/llvm-gcc-4.0-iphone
    $ pushd build/llvm-gcc-4.0-iphone
    $ ../../llvm-gcc-4.0-iphone/configure --enable-llvm=`llvm-config --obj-root` \
    --enable-languages=c,c++,objc,obj-c++ --target=arm-apple-darwin --enable-sjlj-exceptions \
    --with-heavenly=$HEAVENLY --with-as=/usr/local/bin/arm-apple-darwin-as \
    --with-ld=/usr/local/bin/arm-apple-darwin-ld --enable-wchar_t=no
    $ make LLVM_VERSION_INFO=2.0-svn-iphone-dev-0.3-svn 
    $ sudo make install
    $ popd
    $ popd
  • You're done. Have fun!

HOWTO obtain the Mac OS X headers on Linux or Windows

Gotchas


Comment by PhireN, Sep 09, 2007

An easy way to to extract the archive from the current dmg in linux is this:

dd if=xcode_2.4.1_8m1910_6936315.dmg skip=323904 | gunzip | pax -r

For other versions of the sdk you will need to find the offset of the correct Archive.pax.gz. You can do this with these 2 commands:

od -t x1 xcode.dmg | grep '^[0-7]*000 1f 8b' > offsets.txt
awk '{ print $1 }' offsets.txt | while read x; do dd if=xcode.dmg skip=$((0$x / 512)) count=1 | gunzip | cpio -t | grep -q MacOSX10.4u.sdk && echo $((0$x / 512)); done 2>/dev/null

Note: will need to put the proper file name of the xcode archive instead of 'xcode.dmg'

If you are worried about download size, it should be possible, using the range http header to download only the required part of the archive

Comment by mikelikespie, Sep 10, 2007

I was having issues building llvm, there's something wrong with the configure script (at least on my system). try putting --with-gxx-include-dir=/usr/local/arm-apple-darwin/include/c++/4.0.0 at the end when running ./configure

Comment by d...@linuxprogrammer.org, Sep 11, 2007

While doing the following sequence:

$ pushd csu
$ ./configure --host=arm-apple-darwin
$ sudo make install

I had to rerun aclocal before the sudo make install because I have autogen-1.9.6 on my system instead of 1.9.4 that was used to generate the aclocal.m4 file that is in the repo.

So the for me I had to do the following:

$ pushd csu
$ ./configure --host=arm-apple-darwin
$ sudo aclocal
$ sudo make install

-r2

Comment by roxfan, Sep 11, 2007

HFSExplorer can be used to extract .dmg files. Works on Windows, no idea about Linux. http://hem.bredband.net/catacombae/hfsx.html

Comment by nightwatch41, Sep 11, 2007

File bug reports, please. I can much better respond to them when they're bug reports and not comments here. Thanks!

Comment by onitake, Sep 12, 2007

If you want a relocatable SDK (like I do), add -isysroot /Your/SDK/Path to your CFLAGS and LDFLAGS.

-Wl,-syslibroot,/Your/SDK/Path does not work, but llvm-gcc will transform -isysroot to -syslibroot and override the one that's hardcoded into the binary.

Comment by jwriteclub, Sep 12, 2007

When it comes time to get the iPhone filesystem (the "HEAVENLY" step) be aware:

The 'premade' dmg on the linked page is missing some of the libraries and the tools cannot be built using it.

~ Christopher

Comment by noespamporfavor, Sep 12, 2007

Installed it now where the heck is the compiler? Anyone point me at a sample project/Makefile that shows where arm-apple-darwin-cc is and how to set up include/framework paths etc?

Install process works great but c'mon help a newb out here (and who isn't a newb iPhone developer)?

Comment by michael.mccaskill, Sep 12, 2007

Agreed. I finally successfully completed this process, but arm-apple-darwin-cc is not in /usr/local/bin.

Comment by pendorbound, Sep 12, 2007

arm-apple-darwin-cc is actually arm-apple-darwin-gcc in this version. There's a note to that effect on the iphone dev wiki. Either symlink arm-apple-darwin-cc to arm-apple-darwin-gcc, or modify your Makefile, and it should compile.

Comment by michael.mccaskill, Sep 12, 2007

Thank you very much. Is there any reason why we're using llvm-gcc-4.0 instead of llvm-gcc-4.2?

Comment by nightwatch41, Sep 12, 2007

LLVM-GCC 4.2 is very unstable at the moment. It should only be used if you're a GCC hacking wizard.

Comment by michael.mccaskill, Sep 12, 2007

I see. You sir, are cleary more a GCC hacking wizard that most of us. :)

Comment by brookstalley, Sep 12, 2007

This almost works on FreeBSD. odcctools doesn't compile, though, and that's a problem. All sorts of errors in the form:

In file included from /usr/include/stdlib.h:42,
                 from allocate.c:23:
/usr/include/sys/_types.h:99: error: conflicting types for '__mbstate_t'
..//include/i386/_types.h:74: error: previous declaration of '__mbstate_t' was here
In file included from allocate.c:23:
/usr/include/stdlib.h:52: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'size_t'
/usr/include/stdlib.h:89: error: expected declaration specifiers or '...' before 'size_t'

Any ideas? FreeBSD 7.0-current, amd64.

Comment by tee.el.gee, Sep 13, 2007

I have successfully installed the toolchain, but am not sure how to get started. I have downloaded the helloworld source and have tried compliling it, but I run into problems. I have changed the arm-apple-darwin-cc to arm-apple-darwin-gcc in the Makefile, but still no luck. Please help a newbie get started. Thanks for all of you hard work!

Comment by korobeynikov.anton, Sep 13, 2007
cc1: internal error: #pragma pack is already registered
make[4]: *** [crt3.o] Error 1
make[3]: *** [extra] Error 2
make[2]: *** [stmp-multilib] Error 2
make[1]: *** [all-gcc] Error 2
make: *** [all] Error 2

Is this with llvm-gcc 4.2 running on darwin? If yes - please file bug into LLVM bugzilla. It seems, something is wrong with my "pragma pack" patch.

Comment by rmspamfilter, Sep 13, 2007

In ubuntu when running ../llvm-gcc-4.0-iphone/configure --enable-llvm=$LLVMOBJDIR --enable-languages=c,c++,objc,obj-c++ \ --target=arm-apple-darwin --enable-sjlj-exceptions --with-heavenly=$HEAVENLY \ --with-as=/usr/local/bin/arm-apple-darwin-as --with-ld=/usr/local/bin/arm-apple-darwin-ld i get the following error

../libiberty/libiberty.a -L/iphone/llvm-svn/Release/lib -lpthread -ldl -lm \

cp/except.o: In function `nothrow_libfn_p': /iphone-dev/llvm-gcc-4.0-iphone-build/gcc/../../llvm-gcc-4.0-iphone/gcc/cp/except.c:918: undefined reference to `libc_name_p' collect2: ld returned 1 exit status make1?: cc1plus-dummy? Error 1 make1?: Leaving directory `/iphone-dev/llvm-gcc-4.0-iphone-build/gcc' make: all-gcc? Error

Comment by rmspamfilter, Sep 13, 2007

In ubuntu when running ../llvm-gcc-4.0-iphone/configure --enable-llvm=$LLVMOBJDIR --enable-languages=c,c++,objc,obj-c++ \ --target=arm-apple-darwin --enable-sjlj-exceptions --with-heavenly=$HEAVENLY \ --with-as=/usr/local/bin/arm-apple-darwin-as --with-ld=/usr/local/bin/arm-apple-darwin-ld i get the following error

../libiberty/libiberty.a -L/iphone/llvm-svn/Release/lib -lpthread -ldl -lm \

cp/except.o: In function `nothrow_libfn_p': /iphone-dev/llvm-gcc-4.0-iphone-build/gcc/../../llvm-gcc-4.0-iphone/gcc/cp/except.c:918: undefined reference to `libc_name_p' collect2: ld returned 1 exit status make1?: cc1plus-dummy? Error 1 make1?: Leaving directory `/iphone-dev/llvm-gcc-4.0-iphone-build/gcc' make: all-gcc? Error

Comment by m...@planet-rosen.com, Sep 13, 2007

The "can't locate file: -lc" is because HEAVENLY is either not defined correctly or because the DMG is not the right one - you need the full restore DMG , the .39 version, not the update DMG live and learn

Comment by gregory.dudek, Sep 13, 2007

It all works fine on Darwin/Intel, but on Darwin/PPC the C compiler (xgcc) hangs (!!) at one point (or at least I gave up after 900 CPU minutes) when compiling ../../llvm-gcc-4.0-iphone/gcc/libgcc2.c

Comment by pendorbound, Sep 13, 2007

Just wanted to drop a quick success report. Using an SVN pull from this afternoon, I'm up and compiling on my MacBookPro?.

Before this build, I manually obliterated anything in /usr/local that had 'arm' or 'llvm' in the name (careful with 'arm' as it's not a completely unique string -- there's stuff with arm in it that's important!). Then I rm -rf'd the llvm-svn and iphone-dev directories and checked them out. I built a fresh copy of GPM using Darwin Ports then built and installed LibStreams?. Finally I ran my shellscript that has all the instructions above in it.

For reference, the SVN revisions I've got: llvm: 41932 iphone-dev: 155 llvm-gcc-4.0: 41909 (Using this one) llvm-gcc-4.2: 41910 (NOT using this one)

So far both Hello and Books.app compile and work without issue.

Thanks for all the hard work in this!

Comment by avadh4all, Sep 14, 2007

Hi , I finally have successfully compiled and installed the toolchain on my 32 bit machine. I was trying it on 64 bit machine, even with chroot to 32 bit environment, it didnt work for me ..... :(

Now I m all set in SuSE 10.2 Intel Centrino Duo 32 bit.

Thanks for all the hard work you people has done.

Comment by samthedrummer, Sep 15, 2007

I keep getting this error when trying to compile the last time

make1?: No rule to make target /Users/samsoffes/iphone/_toolchain/iphone-dev/llvm-gcc-4.0-iphone-build/gcc/include/llvm/Intrinsics.gen', needed by llvm-convert.o'. Stop. make: all-gcc? Error 2

Any fixes?

Comment by bnenning, Sep 15, 2007

I've tried to install the toolchain on OS X and Ubuntu Feisty. On both boxes everything appears to build and install, but when I try to compile the uikithelloworld app I get this output (after changing arm-apple-darwin-cc to arm-apple-darwin-gcc in the Makefile):

~/iphone/uikithelloworld$ make
arm-apple-darwin-gcc -c   hello.m -o hello.o
arm-apple-darwin-gcc -c   HelloApplication.m -o HelloApplication.o
arm-apple-darwin-gcc -ObjC -framework CoreFoundation -framework Foundation -framework UIKit -framework LayerKit -o Hello hello.o HelloApplication.o
/usr/local/bin/arm-apple-darwin-ld: Undefined symbols:
_objc_msgSend
_objc_msgSend_stret
collect2: ld returned 1 exit status
make: *** [Hello] Error 1
Comment by bnenning, Sep 15, 2007

Figured it out...I had to add "-lobjc" to the end of LDFLAGS in the Makefile. Now I can build iPhone binaries on both machines. Thanks very much for this guide and all your hard work.

Comment by gaxzerow, Sep 15, 2007

Confirmation (roxfan) that HFSExplorer (.dmg extractor) works on Linux (Fedora 7) with Sun's JVM (gij does not) http://hem.bredband.net/catacombae/hfsx.html

Comment by pmiller8, Sep 16, 2007

/usr/local/bin/arm-apple-darwin-ld: can't locate file for: -lc collect2: ld returned 1 exit status make2?: libgcc_s.dylib? Error 1 make1?: stmp-multilib? Error 2 make: all-gcc? Error 2

anyone know what this is about? Thanks.

Comment by laughy, Sep 16, 2007

Note that copying the iphone files straight from my iphone -did not- seem to work ("cant locate file for: -lc" error). I had to extract the full restore DMG .39 into a folder and use that.

Comment by laughy, Sep 16, 2007

Note that copying the iphone files straight from my iphone -did not- seem to work ("cant locate file for: -lc" error). I had to extract the full restore DMG .39 into a folder and use that.

Comment by devcore, Sep 16, 2007

odcctools fails to compile in cygwin with these errors http://pastebin.com/m20f7aeef looks like it's all about conflicting headers, but i don't know how to fix it:( please help!

Comment by devcore, Sep 16, 2007

odcctools fails to compile in cygwin with these errors http://pastebin.com/m20f7aeef looks like it's all about conflicting headers, but i don't know how to fix it:( please help!

Comment by devcore, Sep 16, 2007

errors.c is in libstuff dir btw

Comment by tokenbaldguy, Sep 17, 2007

@samthedrummer: I had the same issue...I had moved the location of llvm-svn after compiling, and it didn't like that. I recompiled it in the new location and everything worked fine.

At least that fixed it for me...

Comment by sebastien.barre, Sep 17, 2007

I couldn't build the HelloWorld? example with the current toolchain (http://iphone.fiveforty.net/wiki/index.php/UIKit_Hello_World). I was able to build the same example with the 0.2 toolchain (http://iphone.fiveforty.net/wiki/index.php/Toolchain_Project).

My Makefile starts like this:

CC=arm-apple-darwin-gcc
CXX=arm-apple-darwin-g++
LD=$(CC)
LDFLAGS=-lobjc -framework CoreFoundation -framework Foundation -framework UIKit -framework LayerKit -Wl,-syslibroot,$(HEAVENLY)

And I'm getting this error:

arm-apple-darwin-gcc -c   hello.m -o hello.o
In file included from /usr/local/lib/gcc/arm-apple-darwin/4.0.1/../../../../arm-apple-darwin/include/CarbonCore/ConditionalMacros.h:42,
                 from /usr/local/lib/gcc/arm-apple-darwin/4.0.1/../../../../arm-apple-darwin/include/CarbonCore/MacTypes.h:20,
                 from /usr/local/lib/gcc/arm-apple-darwin/4.0.1/../../../../arm-apple-darwin/include/CoreFoundation/CFBase.h:38,
                 from /usr/local/lib/gcc/arm-apple-darwin/4.0.1/../../../../arm-apple-darwin/include/CoreFoundation/CFByteOrder.h:16,
                 from /usr/local/lib/gcc/arm-apple-darwin/4.0.1/../../../../arm-apple-darwin/include/CoreGraphics/CGGeometry.h:10,
                 from /usr/local/lib/gcc/arm-apple-darwin/4.0.1/../../../../arm-apple-darwin/include/CoreGraphics/CGAffineTransform.h:12,
                 from /usr/local/lib/gcc/arm-apple-darwin/4.0.1/../../../../arm-apple-darwin/include/CoreGraphics/CoreGraphics.h:12,
                 from /usr/local/lib/gcc/arm-apple-darwin/4.0.1/../../../../arm-apple-darwin/include/UIKit/UIKit.h:3,
                 from hello.m:1:
/usr/local/lib/gcc/arm-apple-darwin/4.0.1/../../../../arm-apple-darwin/include/TargetConditionals.h:110:10: error: #error unrecognized GNU C compiler

Now the current toolchain is much clean than the 0.2 (great job), so either the 0.3 has an issue here, or my Makefile, or maybe remnants of the 0.2 install are in the way (it looks like it was installing stuff all over the place, patching headers, etc.).

Any hint? Thanks

Comment by xyanthilous, Sep 18, 2007

On Ubuntu, I'm getting the same error as others above at the final make step:

cp/except.o: In function `nothrow_libfn_p': /home/dent/iphone/iphone-dev/llvm-gcc-4.0-iphone-build/gcc/../../llvm-gcc-4.0-iphone/gcc/cp/except.c:918: undefined reference to `libc_name_p' collect2: ld returned 1 exit status

Is this considered a -lc error? I copied the filesystem for HEAVENLY off my device directly and I do have a libc.dylib in $HEAVENLY/usr/lib. However its a symlink chain leading to $HEAVENLY/usr/lib/libSystem.B.dylib. Is this correct, or even related to my build problem?

Has anyone solved this problem?

Thanks.

Comment by xyanthilous, Sep 18, 2007

Regarding undefined reference to 'libc_name_p' on ubuntu:

libc_name_p is supposed to be defined in gcc/cp/cfns.h which is generated by gperf, so be sure to apt-get install gperf. But the cfns.h in llvm-gcc-4.0-iphone-build ends up blank anyway, so just copy it from llvm-gcc-4.0/gcc/cp.

cp llvm-gcc-4.0/gcc/cp/cfns.h llvm-gcc-4.0-iphone-build/gcc/cp

and that will get you past the error.

Cheers.

Comment by john.meacham, Sep 18, 2007

In order to compile odcctools on a x86-64 fedora linux machine, I did the following:

before the configure step do

; setarch i386 
; export CFLAGS="-m32" 
; export LDFLAGS="-m32"

then go ahead and follow the steps as normal. this was tested on a x86-64 install of fedora.

this fixes the issue of 'incompatable typedef' errors.

Comment by john.meacham, Sep 18, 2007

How much of the iPhone filesystem is needed for the build to work? can I just get by copying /System and /Library from my phone?

Comment by isidoror, Sep 19, 2007

Hi there, Yesterday after installing the toolchain I was able to compile. Now, same makefile and same app I get this error: /usr/local/bin/arm-apple-darwin-ld: -syslibroot: multiply specified Any ideas?

Comment by michael.mccaskill, Sep 19, 2007

I don't know the mechanics but I know that this toolchain doesn't require -syslibroot. Here is my Makefile for the HelloWorld?! app. Now I called the app MobileTest?:

CC=/usr/local/bin/arm-apple-darwin-gcc CXX=/usr/local/bin/arm-apple-darwin-g++ CFLAGS=-fsigned-char LDFLAGS=-Wl \

-framework Message \ -framework CoreFoundation? \ -framework Foundation \ -framework UIKit \ -framework LayerKit? \ -lobjc
LD=$(CC)

all: MobileTest? package

MobileTest?: main.o MobileTest?.o

$(LD) $(LDFLAGS) -o $@ $^

%.o: %.m %.c

$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
package:
rm -f -r ./MobileTest?.app mkdir ./MobileTest?.app mv MobileTest? ./MobileTest?.app/ cp -r ./Resources/ ./MobileTest?.app/ chmod 644 ./MobileTest?.app/ chmod 755 ./MobileTest?.app/MobileTest?
clean:
rm -f .o MobileTest?

Comment by onitake, Sep 21, 2007

isidoror: As I pointed out earlier, forget about -syslibroot. If you need to specify a different SDK directory, use -isysroot /Your/SDK/Path (even for the linker). It will override the preset -syslibroot.

Comment by insanita...@yahoo.com, Sep 21, 2007

The fill-llvm-gcc script no longer has -c option as default... so if anyone follows the build instructions exactly, there is no step for svn co llvm-gcc-4.0... so the fill script will fail unless you have -c

Comment by freewa...@naver.com, Sep 22, 2007

Under Ubuntu 7.04, I couldn't extract 694-5262-39.dmg file correctly. The 694-5262-39.dmg file was successfully decrypted with vfdecrypt. The decrypted.dmg file could be explored with Transmac under Win-XP. File-system of decrypted.dmg seems to be HFSX. Is it true?

When I extracted it with Transmac, the file type is broken due to symbolic links. So, I couldn't use it.

I also tried "roxfan" mentions HFSExplorer under Ubuntu. But, when I opened the decrypted.dmg, it shows an error message as below. "Invalid HFS type. Program supports (HFS_PLUS, HFS_WRAPPED_HFS_PLUS). Detected type is (HFSX)."

According to "gaxzerow"'s comment, it should work.

Do you have any hint to resolve this problem?

Comment by idilberkan, Sep 22, 2007

badmanchild, I personallly think it was a ffolder name issue so I renamed llvm-gcc-4.0-iphone folder to llvm-gcc-4.0 and it worked fine. Was that a bad step?

Comment by william.s.yu, Sep 23, 2007

Oh it works now. I cleaned out my entire installation tree. Did the ./fill-llvm-gcc.sh -c one more time and it finally pulled through. I suspect there were some files lying around from my previous build.

Comment by kylegl54, Sep 25, 2007

Success on a PowerBook? G4. Have a compilation problem with llvm-convert.cpp, that can be simply resolved by modifying llvm-internal.h, line 562, by removing the third argument (const char *LongDoubleName) (known  issue #59 ) To build the examples of Lucas Newman, you need to update your includes with the one of iphone-binutils

Thanks to all for this wonderfull tools :)

Comment by jasonjunkmail.Developer, Sep 25, 2007

Any confirmation on building the latest toolkit on Windows?

Comment by gaoxiaojun, Sep 26, 2007

Success on CentOS 4

Comment by ffelgenh, Sep 26, 2007

what about this error sebastien.barre reported on 17th of september.

#error unrecognized GNU C compiler

I do have the same.

Can someone explain the details behind it and how to fix it

Thx

Florian

Comment by niwaniwaniw, Sep 27, 2007

I got follow error when compoling the llvm-gcc-4.0-iphone on IntelMac?? with OSX10.4.10:

#error architecture not supported

Does anyone know how to avoid this error??

Comment by melcher.matthias, Sep 29, 2007

The -lc issue is easy to avoid by copying the /usr directory from the iPhone to the heavenly directory. It is looking for the file /usr/lib/libc.dylib . The copy command is "sudo scp -C -r root@192.168.1.105:/usr/ ." from the heavenly directory on the developer machine (assuming you have the scp deamon installed - see iNdependence, etc.).

Comment by melcher.matthias, Sep 29, 2007

I would like to shout a huge "thank you" to the developers and maintainers of this SVN and site. Everything worked pretty much "out of the box" on my 10.4.10 Intel OS X. Great work! Thank you!

Comment by unidevel, Sep 30, 2007

I successfully build the toolchain under Linux. tested with UIKit hello program and simple C hello world. but when I compile gnugo 3.6, it report

  Undefined symbols: ___eprintf

Any ideas with this error? I think it maybe the ncurses library's problem. I never build them, I wonder where they come from, maybe from MacOSX SDK.

Making all in patterns
make[2]: Entering directory `/mnt/rootfs/opt/iphone/apps/build/gnugo-3.6/pattern
s'
arm-apple-darwin-gcc  -g -O2 -Wall -W -Wpointer-arith -Wbad-function-cast -Wcast
-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmi
ssing-declarations -Wundef   -o mkpat  mkpat.o transform.o dfa.o ../utils/libuti
ls.a -lncurses
/opt/iphone/bin/arm-apple-darwin-ld: Undefined symbols:
___eprintf
collect2: ld returned 1 exit status
make[2]: *** [mkpat] Error 1
Comment by djMaxM, Sep 30, 2007

anybody gotten standard C++ libraries to compile on this darn thing? The instructions on the old Wiki don't work.

Comment by unidevel, Sep 30, 2007
/opt/iphone/bin/arm-apple-darwin-ld: Undefined symbols:
___eprintf

assert.h referenced eprintf, I just replace assert.h with

#define assert

compile ok now.

Comment by fayoeu, Oct 01, 2007

While compiling llvm, on mac osx, i get the following:

/usr/bin/ld: can't locate file for: -lgcc_s.10.4 collect2: ld returned 1 exit status make2?: /Users/fayoeu/Desktop/llvm-svn/Release/bin/tblgen? Error 1 make1?: TableGen/.makeall? Error 2 make: all? Error 1

Any suggestions?

Comment by madfxgao, Oct 01, 2007

when i step to make LLVM_VERSION_INFO=2.0-svn-iphone-dev-0.3-svn, i meet the following error: ../../../llvm-gcc-4.0-iphone/gcc/llvm-backend.cpp: In function 'void llvm_initialize_backend()': ../../../llvm-gcc-4.0-iphone/gcc/llvm-backend.cpp:191: error: 'createBFS_DAGScheduler' was not declared in this scope make1?: llvm-backend.o? Error 1 make: all-gcc? Error 2

Comment by jamesfmilne, Oct 02, 2007

fayoeu & madfxgao:

I get the same error. The code has evidently gone out of sync with the LLVM source code.

Nightwatch: Can you specify which SVN revision of LLVM you used to build the toolchain?

Comment by fayoeu, Oct 02, 2007

Hi all, i fixed my issue by upgrade to the latest Xcode, follow the link in the wiki. However, now I am running into the issue reported by madfxgao.

Comment by NRCoelho, Oct 03, 2007

Hi guys...

i'm trying to download the iphone file system since this morning without success completing the process; maybe i'm doing something wrong, like copying all the "/" directory.

heres my command line: scp -r root@iphoneIP?:/ .

any thoughts? ideas?

Many thanks in advance

Nuno

Comment by huber...@gmx.de, Oct 03, 2007

The problem from madfxgao got a bugtracker number: issue#70. It is also my problem now...

Comment by leyland, Oct 03, 2007

I have the same issue as freewa...@naver.com on Ubuntu

The 38 file mounts fine, but when I try to do the vfdecrypt to the other file, the resulting file can not be mounted, calling 'file' on it returns that it is a "VAX COFF executable", which can't be right since the 38 file says it is a "Macintosh HFS Extended version 4". I don't know if vfdecrypt is working :P.

I want to try this by transferring the files from my iphone. Does any one know if this will work with files from an iphone with firmware 1.02? Is there a list of files/directories that are needed? I have a lot of music/video/apps on it and don't want to copy everything over.

Comment by voberle, Oct 04, 2007

Thanks for these great instructions. They have one problem tough: Two SVN repositories are needed, and trunk is taken from both. So it's sure that sometimes things will be broken.

Could you indicate in the guide some working revision numbers for the 2 repo? Most people building this toolchain would not need to use the lastest trunk code. Thanks.

Comment by meth...@yahoo.com, Oct 04, 2007

On Ubuntu 7.0.4, I can get all the way to the command: make LLVM_VERSION_INFO=2.0-svn-iphone-dev-0.3-svn but it errors with the configure bombing out when configuring the libstdc++-v3 with the following error:

checking for g++ that supports -ffunction-sections -fdata-sections... yes checking for sin in -lm... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES. make: configure-target-libstdc++-v3? Error 1

Anybody seen this before?

Comment by gowangcheng, Oct 05, 2007

I build it on Ubuntu and got an error when making LLVM-GCC.

arm-apple-darwin-lipo -output libgcc_s.10.4.dylib -create libgcc_s.10.4.dylib_T arm-apple-darwin-lipo: can't figure out the architecture type of: libgcc_s.10.4.dylib_T make1?: libgcc_s.10.4.dylib? Error 1

In order to avoid the bug reported by madfxgao, I sync the llvm to a early version (Oct.1). Is it caused by version mismatch?

Comment by meth...@yahoo.com, Oct 05, 2007

I figured out my problem (symlinks for /usr/lib dylibs not maintained after extracting from Windows XP and scp'ing files to Ubuntu 7.0.4.

However, I can now compile the HelloApplication?, but when I try to run it on my iPhone, all it shows is a big picture of "two papers, pencil, ruler and paintbrush", looks like a big "Write" icon.

I didn't get any errors when compiling though.

Comment by meth...@yahoo.com, Oct 05, 2007

nvm, Hello makefile doesn't chmod the combiled binaries, works now.

Comment by bmills, Oct 09, 2007

Couple tips from a successful build on Fedora Core 3... The following command will unpack the xcode DMG file under linux: dd if=xcode_2.4.1_8m1910_6936315.dmg skip=323904 | gunzip | pax -r The instructions talk about top-of-trunk for both repositories, which is a moving target. I had to downgrade my llvm to rev 42286 to get it to compile cleanly using the above instructions. This was with top-of-trunk iphone-dev, which at the time was revision 198 I had to downgrade llvm after getting errors about createBFS_DAGScheduler similar to the ones mentioned in http://code.google.com/p/iphone-dev/issues/detail?id=70

Comment by spkane00, Oct 11, 2007

to solve madfxgao's problem try this:

svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm-svn -r {2007-09-25}

to pull down a slightly older version of llvm.

Comment by vapuleixi, Oct 13, 2007

I have compiled everything well, but on the last step, making "make install" on llvm-gcc, i get this error:

/usr/bin/install -c -m 644 ./libgcc.a /usr/local/lib/gcc/arm-apple-darwin/4.0.1/ arm-apple-darwin-ranlib -c /usr/local/lib/gcc/arm-apple-darwin/4.0.1/libgcc.a make2?: arm-apple-darwin-ranlib: Command not found make2?: install? Error 127 make2?: Leaving directory `/home/isma/development/iphone/iphone-dev/build/llvm-gcc-4.0-iphone/gcc' make1?: install-multilib? Error 2 make1?: Leaving directory `/home/isma/development/iphone/iphone-dev/build/llvm-gcc-4.0-iphone/gcc' make: install-gcc? Error 2

do you know if the problem is on the Makefile? am i making something wrong? please help me, i haven't the arm-apple-darwin-gcc

Thanks to spkane00.

Comment by jasa...@gmx.net, Oct 15, 2007

I am stuck with the same Problem as meth...@yahoo.com: checking for sin in -lm... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES. make: configure-target-libstdc++-v3? Error 1

Could it be a problem that my dylib-files are from the iPod touch and not from an iPhone (I tried before with an iPhone filesystem but I stuck with a different error, wich disapeared after I replaced the dylib-file (which wich was connected with the error) with a new copy from my iPod)?

Comment by jasa...@gmx.net, Oct 17, 2007

There's a torrent with the root filesystem on thepiratebay.org - simply search for iPhone.

Comment by paulspiteri, Oct 19, 2007

Is this supposed to work with the 1.1.1 filesystem?

I get this error after about 15 mins of make LLVM_VERSION_INFO=......

/usr/local/bin/arm-apple-darwin-ld: /home/paul/iphone-filesystem/usr/lib/libc.dylib truncated or malformed object (mach header extends past the end of the file) collect2: ld returned 1 exit status make2?: libgcc_s.dylib? Error 1 make2?: Leaving directory `/home/paul/iphone-dev/build/llvm-gcc-4.0-iphone/gcc' make1?: stmp-multilib? Error 2 make1?: Leaving directory `/home/paul/iphone-dev/build/llvm-gcc-4.0-iphone/gcc' make: all-gcc? Error 2

So close...I'm running on Ubuntu 7.10. Thanks

Comment by damien.stolarz, Oct 20, 2007

Could someone make a VMWare image of a ubuntu toolchain OS config? That way, everyone trying to write apps could spend more time coding and less time chasing down header files.

Comment by XanthosX, Oct 21, 2007

Some of the headers appear to be missing, (eg. ABAddressBookUI) - was this an intentional omission?

Comment by terry.simons, Oct 23, 2007

put Hello in /Applications or /bin or /sbin or the like.

Comment by benzou, Oct 23, 2007

Can someone post a version of this compiled for OS X 10.4?

It would help a bunch. Thanks.

Comment by filberuk, Oct 23, 2007

Hello,

I'm getting the following error at the step: make LLVM_VERSION_INFO=2.0-svn-iphone-dev-0.3-svn

`arm-apple-darwin-lipo -output libgcc_s.10.4.dylib -create libgcc_s.10.4.dylib_T arm-apple-darwin-lipo: can't figure out the architecture type of: libgcc_s.10.4 .dylib_T make1?: libgcc_s.10.4.dylib? Error 1 make1?: Leaving directory `/home/oem/iphone-dev/build/llvm-gcc-4.0-iphone/gcc' make: all-gcc? Error 2 ` Same as gowangcheng...

Copied filesystem from iTouch, checked and libc.dylib is present and HEAVENLY path set correctly...

Comment by arheops, Oct 24, 2007

can anyone provide iphone ROOT archived?

Comment by pumpkingod, Oct 24, 2007

apple can. just grab it from their site and decrypt it

Comment by arheops, Oct 24, 2007

senks. already have one

Comment by arheops, Oct 25, 2007

but i still can't decrypt it... seems vfdecrypt not work. does it need to be compiled on 64 bit system or on 32 bit?

Comment by naughty.nin, Oct 26, 2007

paulspiteri: you retrieved the phone-fs using a win box. this faulty file in fact should be a symlink which win cannot handle. grab yourself a linux box! hope that helps

Comment by mewzca, Oct 28, 2007

On the last build phase, I am having problems!!! Can someone help?

it fails on:

/Users/mewse/toolchain/iphone-dev/build/llvm-gcc-4.0-iphone/gcc/xgcc -B/Users/mewse/toolchain/iphone-dev/build/llvm-gcc-4.0-iphone/gcc/ -B/usr/local/arm-apple-darwin/bin/ -B/usr/local/arm-apple-darwin/lib/ -isystem /usr/local/arm-apple-darwin/include -isystem /usr/local/arm-apple-darwin/sys-include -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -I. -I. -I../../../llvm-gcc-4.0-iphone/gcc -I../../../llvm-gcc-4.0-iphone/gcc/. -I../../../llvm-gcc-4.0-iphone/gcc/../include -I../../../llvm-gcc-4.0-iphone/gcc/../libcpp/include -I/Users/mewse/toolchain/llvm-svn/include -I/Users/mewse/toolchain/llvm-svn/include \ \ -c ../../../llvm-gcc-4.0-iphone/gcc/config/darwin-crt3.c -o crt3.o xgcc: installation problem, cannot exec '-arch': No such file or directory make3?: crt3.o? Error 1 make2?: extra? Error 2 make1?: stmp-multilib? Error 2 make: all-gcc? Error 2

I manually executed the last make command and this is what it spewed out:

sh-2.05b# /Users/mewse/toolchain/iphone-dev/build/llvm-gcc-4.0-iphone/gcc/xgcc -B/Users/mewse/toolchain/iphone-dev/build/llvm-gcc -4.0-iphone/gcc/ -B/usr/local/arm-apple-darwin/bin/ -B/usr/local/arm-apple-darwin/lib/ -isystem /usr/local/arm-apple-darwin/inclu de -isystem /usr/local/arm-apple-darwin/sys-include -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -I. -I. -I../../../llvm-gcc-4.0-iphone/gcc -I../../../llvm-gcc-4.0-iphone/gcc/. -I.. /../../llvm-gcc-4.0-iphone/gcc/../include -I../../../llvm-gcc-4.0-iphone/gcc/../libcpp/include -I/Users/mewse/toolchain/llvm-svn /include -I/Users/mewse/toolchain/llvm-svn/include -c ../../../llvm-gcc-4.0-iphone/gcc/config/darwin-crt3.c -o crt3.o -v Reading specs from /Users/mewse/toolchain/iphone-dev/build/llvm-gcc-4.0-iphone/gcc/specs Target: arm-apple-darwin Configured with: ../../llvm-gcc-4.0-iphone/configure --enable-llvm=/Users/mewse/toolchain/llvm-svn --enable-languages=c,c++,objc,obj-c++ --target=arm-apple-darwin --enable-sjlj-exceptions --with-heavenly=/usr/local/share/iphone-filesystem --with-as=/usr/local/bin/arm-apple-darwin-as --with-ld=/usr/local/bin/arm-apple-darwin-ld : (reconfigured) ../../llvm-gcc-4.0-iphone/configure --enable-llvm=/Users/mewse/toolchain/llvm-svn --enable-languages=c,c++,objc,obj-c++ --target=arm-apple-darwin --enable-sjlj-exceptions --with-heavenly=/usr/local/share/iphone-filesystem --with-as=/usr/local/bin/arm-apple-darwin-as --with-ld=/usr/local/bin/arm-apple-darwin-ld Thread model: posix gcc version 4.0.1 (Apple Computer, Inc. build 5449)(LLVM build 2.0-svn-iphone-dev-0.3-svn) /Users/mewse/toolchain/iphone-dev/build/llvm-gcc-4.0-iphone/gcc/cc1 -quiet -v -I. -I. -I../../../llvm-gcc-4.0-iphone/gcc -I../../../llvm-gcc-4.0-iphone/gcc/. -I../../../llvm-gcc-4.0-iphone/gcc/../include -I../../../llvm-gcc-4.0-iphone/gcc/../libcpp/include -I/Users/mewse/toolchain/llvm-svn/include -I/Users/mewse/toolchain/llvm-svn/include -iprefix /Users/mewse/toolchain/iphone-dev/build/llvm-gcc-4.0-iphone/gcc/../lib/gcc/arm-apple-darwin/4.0.1/ -isystem /Users/mewse/toolchain/iphone-dev/build/llvm-gcc-4.0-iphone/gcc/include -DDYNAMIC -DIN_GCC -isystem /usr/local/arm-apple-darwin/include -isystem /usr/local/arm-apple-darwin/sys-include -isystem ./include ../../../llvm-gcc-4.0-iphone/gcc/config/darwin-crt3.c -fPIC -mfpu=vfp -mcpu=arm1176jzf-s -quiet -dumpbase darwin-crt3.c -mmacosx-version-min=10.4 -auxbase-strip crt3.o -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -version -o /var/tmp//ccqi6trh.s ignoring nonexistent directory "/usr/local/arm-apple-darwin/sys-include" ignoring duplicate directory "./include" ignoring nonexistent directory "/Users/mewse/toolchain/iphone-dev/build/llvm-gcc-4.0-iphone/gcc/../lib/gcc/arm-apple-darwin/4.0.1/include" ignoring nonexistent directory "/Users/mewse/toolchain/iphone-dev/build/llvm-gcc-4.0-iphone/gcc/../lib/gcc/arm-apple-darwin/4.0.1/../../../../arm-apple-darwin/include" ignoring duplicate directory "/usr/local/lib/gcc/arm-apple-darwin/4.0.1/../../../../arm-apple-darwin/include" ignoring duplicate directory "." ignoring duplicate directory "../../../llvm-gcc-4.0-iphone/gcc/." ignoring duplicate directory "/Users/mewse/toolchain/llvm-svn/include" #include "..." search starts here: #include <...> search starts here: . ../../../llvm-gcc-4.0-iphone/gcc ../../../llvm-gcc-4.0-iphone/gcc/../include ../../../llvm-gcc-4.0-iphone/gcc/../libcpp/include /Users/mewse/toolchain/llvm-svn/include /Users/mewse/toolchain/iphone-dev/build/llvm-gcc-4.0-iphone/gcc/include /usr/local/arm-apple-darwin/include /usr/local/include /usr/local/lib/gcc/arm-apple-darwin/4.0.1/include /usr/include /System/Library/Frameworks (framework directory) /Library/Frameworks (framework directory) End of search list. GNU C version 4.0.1 (Apple Computer, Inc. build 5449)(LLVM build 2.0-svn-iphone-dev-0.3-svn) (arm-apple-darwin) compiled by GNU C version 4.0.1 (Apple Computer, Inc. build 5370). GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 93bfe937d44ac72df24c566a9adf5651 -arch arm -force_cpusubtype_ALL -o crt3.o /var/tmp//ccqi6trh.s xgcc: installation problem, cannot exec '-arch': No such file or directory sh-2.05b#

Thanks!!

Comment by paulspiteri, Oct 28, 2007

naughty.nin, thanks. I downloaded the filesystem from my iphone (i didnt have one when i made that post) onto my ubuntu pc, now that error is gone :)

Comment by nasko...@hotmail.com, Oct 28, 2007

"/usr/local/bin/arm-apple-darwin-ld: /home/paul/iphone-filesystem/usr/lib/libc.dylib truncated or malformed object (mach header extends past the end of the file) collect2: ld returned 1 exit status make2?: libgcc_s.dylib? Error 1 make2?: Leaving directory /home/paul/iphone-dev/build/llvm-gcc-4.0-iphone/gcc' make1?: [stmp-multilib] Error 2 make1?: Leaving directory /home/paul/iphone-dev/build/llvm-gcc-4.0-iphone/gcc' make: all-gcc? Error 2"

open usr/lib directory (694-5262-39.dmg). Open all .dylib -1k. All of that files contain paths. Replace that small files with files that is described in. libc.dylib -> libSystem.dylib -> libSystem.B.dylib. By this way you have to copy libSystem.B.dylib two times and to rename that files to libc.dylib and libSystem.dylib. I've been successfully built toolchain on cygwin by this way.

Comment by insanita...@yahoo.com, Oct 28, 2007

Because the make step of LLVM-GCC seems to be reliant on running bash, perhaps include this in the instructions.

Comment by aakash.bapna, Oct 28, 2007

when i do "make LLVM_VERSION_INFO=2.0-svn-iphone-dev-0.3-svn " its runs for a long time and then results in this error -- /usr/local/bin/arm-apple-darwin-ld: /home/Aakash/iphone/iphone-image/usr/lib/libc.dylib truncated or malformed object (mach header extends past the end of the file) collect2: ld returned 1 exit status make2?: libgcc_s.dylib? Error 1 make2?: Leaving directory `/root/iphone-dev/build/llvm-gcc-4.0-iphone/gcc' make1?: stmp-multilib? Error 2 make1?: Leaving directory `/root/iphone-dev/build/llvm-gcc-4.0-iphone/gcc' make: all-gcc? Error 2 -- i am sure my heavenly variable set right and libc.dylib is there, i think many others are having this problem. I am using fedora 7.04..

Comment by nasko...@hotmail.com, Oct 28, 2007

aakash: see my description above. Just open .dylib files (<=1 k), rename it - and for example libc.dylib shows path to libSystem and libSystem - path to libSystem.B.dylib. Just copy libSystem.B.dylib twice and rename 2 new files to libc.dylib and libSystem.dylib. You will have 2 equal files with different names. That will avoid you and from error GCC_NO_EXECUTABLES -ISSUE 73.

Comment by aakash.bapna, Oct 29, 2007

i made 2 copies of libSystem.B.dylib, renamed them to libc.dylib and libSystem.dylib. do i have to it for all .dylib files for just libc.dylib? after doing this (only libc.dylib file duplicates,renames) i got no errors , setup the tool chain successfully i think. when i compile a hello world source from dev team wiki. it gives me following error "test?# make /usr/local/arm-apple-darwin/bin/gcc -c -fsigned-char mainapp.m -o mainapp.o make: /usr/local/arm-apple-darwin/bin/gcc: Command not found make: mainapp.o? Error 127 test?# " i don't have a /usr/local/arm-apple-darwin/bin/gcc folder!! only lib, include folders are there in /arm-apple-darwin/ what could have gone wrong?

Comment by nasko...@hotmail.com, Oct 29, 2007

yes. you have to do this for all .dylib files that include paths.

Comment by rhyscox, Oct 31, 2007

I get the "can't figure out the architecture type of: libgcc_s.10.4.dylib_T" error too, I copied from my touch over the original iphone files I had to solve a previous error. Is there any solution to this problem?

Comment by ViaJava, Oct 31, 2007

I had the libgcc_s.10.4.dylib_T error as well, and before that, I lacked a lot of folders in the arm-apple-darwin dir, so I went and fixed a lot of symlinks (not just the dylib ones) that didn't make the transfer, and went back to step 1, and successfully built it. You can check out the symlink section at the bottom of http://iphone.fiveforty.net/wiki/index.php/Toolchain_installation_-_Windows.

Comment by simerjots, Nov 01, 2007

I build the odcctools successfully!

But when I go to compile the Hello Word I get the following error make: /usr/local/bin/arm-apple-darwin-gcc: Command not found

I checked the /usr/local/bin/ directory and I shaw non 'arm-apple-darwin-gcc'

I am running this on cygwin on XP

Comment by aakash.bapna, Nov 01, 2007

Finally got it working... simerjots, please edit the makefile and try changing arm-apple-darwin-gcc to arm-apple-darwin or the toolchain directory in /usr/local/bin/ if you need the fixed symlinks i have uploaded it -- http://rapidshare.com/files/66800884/lib.rar password - aksblog.co.nr ,there are other usefull files too at http://rapidshare.com/users/JCFG2J including the macosx10.4u.sdk folder from xcode tools.. http://iphone.fiveforty.net/wiki/index.php/UIKit_Based_Applications http://www.cocoadev.com/index.pl?UIKit http://phonedev.tumblr.com/ http://www.lucasnewman.com/iphone/ can i have some more links on class libraries of UIKit, usefull good source codes? made a post at my blog http://aakash-bapna.blogspot.com about my experiences..

Comment by simerjots, Nov 01, 2007

still getting the same error

Comment by aakash.bapna, Nov 02, 2007

try this test app- http://absolutech.org/files/testApp.rar it worked for me ...

Comment by simerjots, Nov 02, 2007

I am trying to redo the tool kit from the begining

Everything goes smoothly, but at the final prompt running the following command "make LLVM_VERSION_INFO=2.0-svn-iphone-dev-0.3-svn" I get

configure: error: You must specify absolute path to your LLVM tree with --enable-llvm=DIR make: configure-gcc? Error 1

Comment by cbrookes, Nov 02, 2007

Tested working on Ubuntu 7.10. You MUST have "patch" installed otherwise the header installation section of the guide fails to fix 3 files resulting in compile errors for helloworld.

Comment by speedbump0619, Nov 02, 2007

apparently newer versions of the standard headers files are different from the ones that some devs are using. The patch command indicated by cbrookes above is failing on my system leaving /usr/local/arm-apple-darwin/TargetConditionals?.h in a partially merged state. You need to verify that there are no patch .rej files there, and if there are manually merge them. This allowed me to build HelloWorld?.

Comment by dkgamez, Nov 02, 2007

I am seeing the same error as simerjots:

Everything goes smoothly, but at the final prompt running the following command "make LLVM_VERSION_INFO=2.0-svn-iphone-dev-0.3-svn" I get

configure: error: You must specify absolute path to your LLVM tree with --enable-llvm=DIR make: configure-gcc? Error 1

Comment by Nabeel.Allana, Nov 03, 2007

# gcc -c -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long -Wno-variadic-macros -Wold-style-definition -DHAVE_CONFIG_H -DENABLE_LLVM -I/home/maniacx/Desktop/temp/llvm-svn/include -D_DEBUG -D_GNU_SOURCE -DSTDC_LIMIT_MACROS -DLLVM_VERSION_INFO='"2.0-svn-iphone-dev-0.3-svn"' -I. -I. -I../../../../llvm-gcc-4.0-iphone/gcc -I../../../../llvm-gcc-4.0-iphone/gcc/. -I../../../../llvm-gcc-4.0-iphone/gcc/../include -I../../../../llvm-gcc-4.0-iphone/gcc/../libcpp/include -I/home/maniacx/Desktop/temp/llvm-svn/include -I/home/maniacx/Desktop/temp/llvm-svn/include ../../../../llvm-gcc-4.0-iphone/gcc/lambda-code.c -o lambda-code.o # gcc -c -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long -Wno-variadic-macros -Wold-style-definition -DHAVE_CONFIG_H -DENABLE_LLVM -I/home/maniacx/Desktop/temp/llvm-svn/include -D_DEBUG -D_GNU_SOURCE -DSTDC_LIMIT_MACROS -DLLVM_VERSION_INFO='"2.0-svn-iphone-dev-0.3-svn"' -I. -I. -I../../../../llvm-gcc-4.0-iphone/gcc -I../../../../llvm-gcc-4.0-iphone/gcc/. -I../../../../llvm-gcc-4.0-iphone/gcc/../include -I../../../../llvm-gcc-4.0-iphone/gcc/../libcpp/include -I/home/maniacx/Desktop/temp/llvm-svn/include -I/home/maniacx/Desktop/temp/llvm-svn/include ../../../../llvm-gcc-4.0-iphone/gcc/tree-loop-linear.c -o tree-loop-linear.o # gcc -c -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long -Wno-variadic-macros -Wold-style-definition -DHAVE_CONFIG_H -DENABLE_LLVM -I/home/maniacx/Desktop/temp/llvm-svn/include -D_DEBUG -D_GNU_SOURCE -DSTDC_LIMIT_MACROS -DLLVM_VERSION_INFO='"2.0-svn-iphone-dev-0.3-svn"' -I. -I. -I../../../../llvm-gcc-4.0-iphone/gcc -I../../../../llvm-gcc-4.0-iphone/gcc/. -I../../../../llvm-gcc-4.0-iphone/gcc/../include -I../../../../llvm-gcc-4.0-iphone/gcc/../libcpp/include -I/home/maniacx/Desktop/temp/llvm-svn/include -I/home/maniacx/Desktop/temp/llvm-svn/include ../../../../llvm-gcc-4.0-iphone/gcc/tree-object-size.c -o tree-object-size.o # c++ -c -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wwrite-strings -pedantic -Wno-long-long -Wno-variadic-macros -DHAVE_CONFIG_H -Wno-unused -DTARGET_NAME=\"arm-apple-darwin\" -DNDEBUG -DENABLE_LLVM -I/home/maniacx/Desktop/temp/llvm-svn/include -D_DEBUG -D_GNU_SOURCE -DSTDC_LIMIT_MACROS -DLLVM_VERSION_INFO='"2.0-svn-iphone-dev-0.3-svn"' -I. -I. -I../../../../llvm-gcc-4.0-iphone/gcc -I../../../../llvm-gcc-4.0-iphone/gcc/. -I../../../../llvm-gcc-4.0-iphone/gcc/../include -I../../../../llvm-gcc-4.0-iphone/gcc/../libcpp/include -I/home/maniacx/Desktop/temp/llvm-svn/include -I/home/maniacx/Desktop/temp/llvm-svn/include ../../../../llvm-gcc-4.0-iphone/gcc/llvm-backend.cpp -o llvm-backend.o # ../../../../llvm-gcc-4.0-iphone/gcc/llvm-backend.cpp: In function ‘void llvm_initialize_backend()’: # ../../../../llvm-gcc-4.0-iphone/gcc/llvm-backend.cpp:191: error: ‘createBFS_DAGScheduler’ was not declared in this scope # make1?: llvm-backend.o? Error 1 # make1?: Leaving directory `/home/maniacx/Desktop/temp/iphone-dev/include/build/llvm-gcc-4.0-iphone/gcc' # make: all-gcc? Error 2 # root@maniacx-desktop:~/Desktop/temp/iphone-dev/include/build/llvm-gcc-4.0-iphone#

http://pastebin.com/m4607f722

Anyone know what is wrong? I think it may be my firmware dump. Will try with a fresh one. Do you think its anything else?

Thanks.

Comment by compukid, Nov 04, 2007

When I try to do these steps: $ ../../llvm-gcc-4.0-iphone/configure --enable-llvm=llvm-config --obj-root \ --enable-languages=c,c++,objc,obj-c++ --target=arm-apple-darwin --enable-sjlj-exceptions \ --with-heavenly=$HEAVENLY --with-as=/usr/local/bin/arm-apple-darwin-as \ --with-ld=/usr/local/bin/arm-apple-darwin-ld

this is what I get. Permission Denied. Any suggestions...Thanks in advance

Macintosh:llvm-gcc-4.0-iphone xxx$ ../../llvm-gcc-4.0-iphone/configure --enable-llvm=llvm-config --obj-root \ > --enable-languages=c,c++,objc,obj-c++ --target=arm-apple-darwin --enable-sjlj-exceptions \ > --with-heavenly=$HEAVENLY --with-as=/usr/local/bin/arm-apple-darwin-as \ > --with-ld=/usr/local/bin/arm-apple-darwin-ld -bash: ../../llvm-gcc-4.0-iphone/configure: Permission denied

Comment by compukid, Nov 04, 2007

Just noticed I do not have a 'configure' file in ../../llvm-gcc-4.0-iphone/ location

Comment by Nabeel.Allana, Nov 04, 2007

>>compukid If that doesn't work, do this:

pushd ../../llvm-gcc-4.0-iphone/ chmod 777 ./ popd

then try it again

Comment by compukid, Nov 04, 2007

Thanks Nabeel. So that worked. I guess it didnt have the right permissions. The I did the remainin commands and got this: Macintosh:llvm-gcc-4.0-iphone xxx$ make LLVM_VERSION_INFO=2.0-svn-iphone-dev-0.3-svn make: No targets specified and no makefile found. Stop. Macintosh:llvm-gcc-4.0-iphone xxx$ sudo make install make: No rule to make target `install'. Stop. Macintosh:llvm-gcc-4.0-iphone xxx$ echo $HEAVENLY /usr/local/share/iphone-filesystem Macintosh:llvm-gcc-4.0-iphone xxx$ echo $LLVMOBJDIR /workarea/ipod/llvm-svn

Somethin tells me...thats not right, is it ?

Comment by compukid, Nov 04, 2007

And I keep getting this when I try runnin Hello World: /usr/include/sys/fcntl.h:418: error: parse error before ‘DARWIN_ALIAS_C’ /usr/include/sys/fcntl.h:419: error: parse error before ‘DARWIN_ALIAS_C’ /usr/include/sys/fcntl.h:420: error: parse error before ‘DARWIN_ALIAS_C’

Comment by aakash.bapna, Nov 05, 2007

compukid, do a cleanup and then a fresh install of toolchain, i too got same errors like No targets specified and no makefile found and no rule to make target "install"

Comment by oi...@spambog.com, Nov 05, 2007

successfully compiled the whole toolchain and UIKit_Hello_World? on debian etch! but there is no libc++

#include <string>
int main() { std::string foo = "bar"; }

$ arm-apple-darwin-g++ -o string string.c /usr/local/bin/arm-apple-darwin-ld: can't locate file for: -lstdc++ collect2: ld returned 1 exit status

any suggestions?

Comment by edpark, Nov 05, 2007

Using Leopard on an Intel I keep getting this error when trying to compile a hello world type example:

/usr/local/bin/arm-apple-darwin-ld: -syslibroot: multiply specified collect2: ld returned 1 exit status make: Hello? Error 1

This is the Makefile:

CC=arm-apple-darwin-gcc-4.0.1 -v CXX=/usr/local/arm-apple-darwin/bin/g++

LD=$(CC) LDFLAGS = -Wl,-syslibroot,$(HEAVENLY) \ -framework CoreFoundation? \ -framework Foundation \ -framework UIKit \ -framework LayerKit? \ -framework CoreGraphics? \ -framework GraphicsServices? \ -framework CoreSurface? \ -lobjc -larmfp

all: Hello

Hello: hello.o HelloApplication?.o $(LD) $(LDFLAGS) -o $@ $^

%.o: %.m $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@

clean: rm -f .o Hello

Anyone come up with a fix for this?

Comment by edpark, Nov 05, 2007

With respect to my previous post of getting the "-syslibroot: multiply specified" error I just realized that I'm now getting the same error on my PPC Leopard install. The weird thing is that I was able to compile the example successfully only yesterday and since I rebooted my machine I can't compile any more. Did I lose some crucial environment setting?

Comment by yehezkiyahu, Nov 06, 2007

I've built the entire toolchain twice now. Both times on a Mac Book Pro running OS X 10.4.10, using the root filesystem from my iPod Touch, not an iPhone. The build process always seems to finish smoothly and according to this page I should be fine, yet I can't compile either the iphoneebooks app or the hello world app. I see the following error message (along with a mess of others, but I think this one's the first):

/usr/local/lib/gcc/arm-apple-darwin/4.0.1/../../../../arm-apple-darwin/include/TargetConditionals?.h:110:10: error: #error unrecognized GNU C compiler

I see this error message mentioned above by two other people. Has anyone figured out what it causing this problem? Is there a solution?

Thanks for any help or information.

Comment by musesum, Nov 07, 2007

compukid, I have the same problem. Did you solve yours? Does anyone know which makefile is expected in "make LLVM_VERSION_INFO=2.0-svn-iphone-dev-0.3-svn" ??

Comment by macosxman, Nov 08, 2007

dkgamez and simerjots:

instead of:

../../llvm-gcc-4.0-iphone/configure --enable-llvm=`llvm-config --obj-root` \
--enable-languages=c,c++,objc,obj-c++ --target=arm-apple-darwin --enable-sjlj-exceptions \
--with-heavenly=$HEAVENLY --with-as=/usr/local/bin/arm-apple-darwin-as \
--with-ld=/usr/local/bin/arm-apple-darwin-ld

try:

../../llvm-gcc-4.0-iphone/configure --enable-llvm=$LLVMOBJDIR \
--enable-languages=c,c++,objc,obj-c++ --target=arm-apple-darwin --enable-sjlj-exceptions \
--with-heavenly=$HEAVENLY --with-as=/usr/local/bin/arm-apple-darwin-as \
--with-ld=/usr/local/bin/arm-apple-darwin-ld

That seemed to fix that problem for me.

Comment by mrichards, Nov 08, 2007

Has anybody tried to obtain the headers from the xcode 3 dmg on Linux? Been trying several things, seems something has changed..

Comment by bricollins, Nov 11, 2007

Compiling odcctools fails on freebsd, same problem as brookstalley using freebsd 6.2 http://pastebin.com/f162e6e32

Comment by musesum, Nov 11, 2007

macosxman, you are the man. Your Nov8 post solved the libgcc_s.dylib probem that I in Leopard and Tiger (in that order, as I reverted back to solve this!) - as well as, I surmise, the problems reported by pmiller, paulspiteri, aakash.bapna, et al.

unless this breaks other environments, would seriously suggest that your change replace what is at the top of this page.

Many thanks!

Comment by oldnemesis, Nov 11, 2007

Worth mengioning that the offset for xcode25_8m2558_developerdvd.dmg is 1381744

Comment by willdtz, Nov 12, 2007

mrichards: fwiw, I couldn't get things to work with xcode 3 on linux--there's a readily available torrent for 2.4.1, and that did the trick just fine.

Comment by uitdesloot, Nov 15, 2007

When I try to build the toolchain (on MacOSX 10.4.11) everything goes fine until I get to darwin-crt3.c. Here the assembler starts failing with all sorts of strange error messages ("Unknown pseudo-op: .word" is the most decent one, later on it seems to be trying to compile comments after # signs, etc).

If I force the build onwards (by touching darwin-crt3.o) things go equally bad later when trying to build parts of libgcc.

I assume that I've somehow mixed my arm toolchain with the native toolchain or something (I didn't install into /usr/local but into a private dir), do these symptoms ring a bell for anyone?

Comment by da...@nycjava.net, Nov 16, 2007

Could someone please update the instructions to specify which build to use (I always have problems when using trunk) If you're going to specify a version for llvm, then we should do so for iphone-dev as well.

Anyway I have this issue with cross-compiling that points to the toolchain not using the correct lib, e.g. when specifying -liconv it uses /usr/lib/libiconv.dylib thus giving warnings and errors such as:

/usr/local/bin/arm-apple-darwin-ld: warning /usr/lib/libiconv.dylib cputype (18, architecture ppc) does not match cputype (12) for specified -arch flag: arm (file not loaded) /usr/local/bin/arm-apple-darwin-ld: Undefined symbols: libiconv

This isn't a bug with building the toolchain but with using it (on 10.4.10 PPC) should I file submit it as an issue or could it be somethign else? -thanks

Comment by neilpep, Nov 18, 2007

Have built the toolchain on a OS X 10.4.10 successfully.

Am trying to build helloworld app and getting the same problem that 3 other people are reporting

/usr/local/lib/gcc/arm-apple-darwin/4.0.1/../../../../arm-apple-darwin/include/TargetConditionals??.h:110:10: error: #error unrecognized GNU C compiler

Has anyone a solution to this yet ?

So close and yet so far!

Comment by alex.fishman, Nov 19, 2007

For those who get #error unrecognized GNU C compiler

This is because header files are installed incorrectly without pre-patching for arm architecture. Could happen because 'patch' utility is missing, install it first.

Comment by neilpep, Nov 21, 2007

Looks like its installed as standard (or installed as part of something else)

$ patch --version patch 2.5.8 Copyright (C) 1988 Larry Wall Copyright (C) 2002 Free Software Foundation, Inc.

This program comes with NO WARRANTY, to the extent permitted by law. You may redistribute copies of this program under the terms of the GNU General Public License. For more information about these matters, see the file named COPYING.

written by Larry Wall and Paul Eggert

Any other ideas ?

Comment by stubma, Nov 23, 2007

For those who get #error unrecognized GNU C compiler

I found that patch failed to patch TargetConditions?.h. You can fix it manually, just open /path-to-your-iphone-dev/include/include/TargetConditions?.h.diff, and apply it manually.

For the lazy buddies, here is the correct TargetConditions?.h, replace usr/local/arm-apple-drawin/include/TargetConditions?.h with it

/*
     File:       TargetConditionals.h
 
     Contains:   Autoconfiguration of TARGET_ conditionals for Mac OS X
	 
                 Note:  TargetConditionals.h in 3.4 Universal Interfaces works
						with all compilers.  This header only recognizes compilers
						known to run on Mac OS X.
 
     Copyright:  (c) 2000-2004 by Apple Computer, Inc., all rights reserved.
 
*/

#ifndef __TARGETCONDITIONALS__
#define __TARGETCONDITIONALS__
/****************************************************************************************************

    TARGET_CPU_*    
    These conditionals specify which microprocessor instruction set is being
    generated.  At most one of these is true, the rest are false.

        TARGET_CPU_PPC          - Compiler is generating PowerPC instructions for 32-bit mode
        TARGET_CPU_PPC64		- Compiler is generating PowerPC instructions for 64-bit mode
        TARGET_CPU_68K          - Compiler is generating 680x0 instructions
        TARGET_CPU_X86          - Compiler is generating x86 instructions
        TARGET_CPU_MIPS         - Compiler is generating MIPS instructions
        TARGET_CPU_SPARC        - Compiler is generating Sparc instructions
        TARGET_CPU_ALPHA        - Compiler is generating Dec Alpha instructions
        TARGET_CPU_ARM          - Compiler is generating ARM instructions


    TARGET_OS_* 
    These conditionals specify in which Operating System the generated code will
    run. At most one of the these is true, the rest are false.

        TARGET_OS_MAC           - Generate code will run under Mac OS
        TARGET_OS_WIN32         - Generate code will run under 32-bit Windows
        TARGET_OS_UNIX          - Generate code will run under some non Mac OS X unix 


    TARGET_RT_* 
    These conditionals specify in which runtime the generated code will
    run. This is needed when the OS and CPU support more than one runtime
    (e.g. Mac OS X supports CFM and mach-o).

        TARGET_RT_LITTLE_ENDIAN - Generated code uses little endian format for integers
        TARGET_RT_BIG_ENDIAN    - Generated code uses big endian format for integers    
        TARGET_RT_64_BIT        - Generated code uses 64-bit pointers    
        TARGET_RT_MAC_CFM       - TARGET_OS_MAC is true and CFM68K or PowerPC CFM (TVectors) are used
        TARGET_RT_MAC_MACHO     - TARGET_OS_MAC is true and Mach-O/dlyd runtime is used

****************************************************************************************************/


/*
 *	gcc based compiler used on Mac OS X
 */
#if defined(__GNUC__) && ( defined(__APPLE_CPP__) || defined(__APPLE_CC__) || defined(__MACOS_CLASSIC__) )
    #define TARGET_OS_MAC               1
    #define TARGET_OS_WIN32             0
    #define TARGET_OS_UNIX              0
    #if defined(__ppc__) 
        #define TARGET_CPU_PPC          1
        #define TARGET_CPU_PPC64        0
        #define TARGET_CPU_68K          0
        #define TARGET_CPU_X86          0
        #define TARGET_CPU_MIPS         0
        #define TARGET_CPU_SPARC        0   
        #define TARGET_CPU_ALPHA        0
        #define TARGET_CPU_ARM          0 
        #define TARGET_RT_LITTLE_ENDIAN 0
        #define TARGET_RT_BIG_ENDIAN    1
        #define TARGET_RT_64_BIT        0
        #ifdef __MACOS_CLASSIC__
           #define TARGET_RT_MAC_CFM    1
           #define TARGET_RT_MAC_MACHO  0
        #else
           #define TARGET_RT_MAC_CFM    0
           #define TARGET_RT_MAC_MACHO  1
       #endif
    #elif defined(__ppc64__) 
        #define TARGET_CPU_PPC          0
        #define TARGET_CPU_PPC64        1
        #define TARGET_CPU_68K          0
        #define TARGET_CPU_X86          0
        #define TARGET_CPU_MIPS         0
        #define TARGET_CPU_SPARC        0   
        #define TARGET_CPU_ALPHA        0
        #define TARGET_CPU_ARM          0 
        #define TARGET_RT_LITTLE_ENDIAN 0
        #define TARGET_RT_BIG_ENDIAN    1
        #define TARGET_RT_64_BIT        1
        #define TARGET_RT_MAC_CFM       0
        #define TARGET_RT_MAC_MACHO     1
     #elif defined(__i386__) 
        #define TARGET_CPU_PPC          0
        #define TARGET_CPU_PPC64        0
        #define TARGET_CPU_68K          0
        #define TARGET_CPU_X86          1
        #define TARGET_CPU_MIPS         0
        #define TARGET_CPU_SPARC        0
        #define TARGET_CPU_ALPHA        0
        #define TARGET_CPU_ARM          0 
        #define TARGET_RT_MAC_CFM       0
        #define TARGET_RT_MAC_MACHO     1
        #define TARGET_RT_LITTLE_ENDIAN 1
        #define TARGET_RT_BIG_ENDIAN    0
        #define TARGET_RT_64_BIT        0
     #elif defined(__arm__)
         #define TARGET_CPU_PPC          0
         #define TARGET_CPU_PPC64        0
         #define TARGET_CPU_68K          0
         #define TARGET_CPU_X86          0
         #define TARGET_CPU_X86_64       0
         #define TARGET_CPU_MIPS         0
         #define TARGET_CPU_SPARC        0
         #define TARGET_CPU_ALPHA        0
         #define TARGET_CPU_ARM          1 
         #define TARGET_RT_MAC_CFM       0
         #define TARGET_RT_MAC_MACHO     1
         #define TARGET_RT_LITTLE_ENDIAN 1
         #define TARGET_RT_BIG_ENDIAN    0
         #define TARGET_RT_64_BIT        0 
    #else
        #error unrecognized GNU C compiler
    #endif


/*
 *   CodeWarrior compiler from Metrowerks/Motorola
 */
#elif defined(__MWERKS__)
    #define TARGET_OS_MAC               1
    #define TARGET_OS_WIN32             0
    #define TARGET_OS_UNIX              0
    #if defined(__POWERPC__)
        #define TARGET_CPU_PPC          1
        #define TARGET_CPU_PPC64        0
        #define TARGET_CPU_68K          0
        #define TARGET_CPU_X86          0
        #define TARGET_CPU_MIPS         0
        #define TARGET_CPU_SPARC        0
        #define TARGET_CPU_ALPHA        0
        #define TARGET_RT_LITTLE_ENDIAN 0
        #define TARGET_RT_BIG_ENDIAN    1
    #elif defined(__INTEL__)
        #define TARGET_CPU_PPC          0
        #define TARGET_CPU_PPC64        0
        #define TARGET_CPU_68K          0
        #define TARGET_CPU_X86          1
        #define TARGET_CPU_MIPS         0
        #define TARGET_CPU_SPARC        0
        #define TARGET_CPU_ALPHA        0
        #define TARGET_RT_LITTLE_ENDIAN 1
        #define TARGET_RT_BIG_ENDIAN    0
    #else
        #error unknown Metrowerks CPU type
    #endif
    #define TARGET_RT_64_BIT            0
    #ifdef __MACH__
        #define TARGET_RT_MAC_CFM       0
        #define TARGET_RT_MAC_MACHO     1
    #else
        #define TARGET_RT_MAC_CFM       1
        #define TARGET_RT_MAC_MACHO     0
    #endif

/*
 *   unknown compiler
 */
#else
    #if defined(TARGET_CPU_PPC) && TARGET_CPU_PPC
        #define TARGET_CPU_PPC64 0
        #define TARGET_CPU_68K   0
        #define TARGET_CPU_X86   0
        #define TARGET_CPU_MIPS  0
        #define TARGET_CPU_SPARC 0
        #define TARGET_CPU_ALPHA 0
    #elif defined(TARGET_CPU_PPC64) && TARGET_CPU_PPC64
        #define TARGET_CPU_PPC   0
        #define TARGET_CPU_68K   0
        #define TARGET_CPU_X86   0
        #define TARGET_CPU_MIPS  0
        #define TARGET_CPU_SPARC 0
        #define TARGET_CPU_ALPHA 0
    #elif defined(TARGET_CPU_X86) && TARGET_CPU_X86
        #define TARGET_CPU_PPC   0
        #define TARGET_CPU_PPC64 0
        #define TARGET_CPU_68K   0
        #define TARGET_CPU_MIPS  0
        #define TARGET_CPU_SPARC 0
        #define TARGET_CPU_ALPHA 0
    #else
        /*
            NOTE:   If your compiler errors out here then support for your compiler 
            has not yet been added to TargetConditionals.h.  
            
            TargetConditionals.h is designed to be plug-and-play.  It auto detects
            which compiler is being run and configures the TARGET_ conditionals
            appropriately.  
            
            The short term work around is to set the TARGET_CPU_ and TARGET_OS_
            on the command line to the compiler (e.g. -DTARGET_CPU_MIPS=1 -DTARGET_OS_UNIX=1)
            
            The long term solution is to add a new case to this file which
            auto detects your compiler and sets up the TARGET_ conditionals.
            Then submit the changes to Apple Computer.
        */
        #error TargetConditionals.h: unknown compiler (see comment above)
        #define TARGET_CPU_PPC    0
        #define TARGET_CPU_68K    0
        #define TARGET_CPU_X86    0
        #define TARGET_CPU_MIPS   0
        #define TARGET_CPU_SPARC  0
        #define TARGET_CPU_ALPHA  0
    #endif
    #define TARGET_OS_MAC                1
    #define TARGET_OS_WIN32              0
    #define TARGET_OS_UNIX               0
    #if TARGET_CPU_PPC || TARGET_CPU_PPC64
        #define TARGET_RT_BIG_ENDIAN     1
        #define TARGET_RT_LITTLE_ENDIAN  0
    #else
        #define TARGET_RT_BIG_ENDIAN     0
        #define TARGET_RT_LITTLE_ENDIAN  1
    #endif
    #if TARGET_CPU_PPC64
        #define TARGET_RT_64_BIT         1
    #else
        #define TARGET_RT_64_BIT         0
    #endif
    #ifdef __MACH__
        #define TARGET_RT_MAC_MACHO      1
        #define TARGET_RT_MAC_CFM        0
    #else
        #define TARGET_RT_MAC_MACHO      0
        #define TARGET_RT_MAC_CFM        1
    #endif
	
#endif

#endif  /* __TARGETCONDITIONALS__ */
Comment by neilpep, Nov 24, 2007

That did the trick thanks very much.

Manny

Comment by emanuele.cipolloni, Nov 24, 2007

I installed and compiled the toolchain ok, I've been able to compile several project successfully, now I have started to build a C++ based project, I changed compiler from gcc to g++, compiles ok, but it complains at link stage with:

/usr/local/bin/arm-apple-darwin-ld: can't locate file for: -lstdc++

In fact I have searched for this file in all "usr" but it doesn't seems to exist, has any body been able to build a C++ project using current toolchain?

Many thanks.

Comment by dbsausag...@dsl.pipex.com, Nov 25, 2007

Built toolchain last night 100% ok - followed directions to the letter, no warnings, errors or the like. This is on G4 iBook on 10.4.10. Have now built MobileTerminal??.app with no problems.

WRT getting the iPod/iPhone root FS - there is now an 'afp' port. So you can set HEAVENLY to /Volumes/iPhone Root FileSystem?? - as long as you remember to connect before doing builds ? In the end I copied from my iPod touch to the local FS via afp but could do either way.

'afp' Info. here: Use the latest version.

http://www.tuaw.com/2007/11/11/afp-for-iphone-and-ipod-touch/ http://wickedpsyched.net/iphone/afp/

Comment by neilpep, Nov 28, 2007

Hi There emanuele.cipolloni

Yes that was my main aim to build a iPhone app with ObjC & C++ cross compliled and have successfully built apps with both, had to fiddle with the mak file of the test app quite a bit, but never got that link error.

I used the HelloWorld? test app as the base, I then renamed the .m files .mm, added a very simple c++ class in a .h and .cpp file, then newed and deleted it an instance of the test class in the applicationDidFinishLaunching so the constructor/destructors would get invoked.

This is the makefile I ended up with :-

CC=arm-apple-darwin-g++ LD=$(CC) LDFLAGS=-lobjc -framework CoreFoundation? -framework Foundation -framework UIKit -framework LayerKit?

all: Hello

Hello: hello.o HelloApplication?.o HelloTest?.o $(LD) $(LDFLAGS) -o $@ $^

%.o: %.mm $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@

%.o: %.cpp $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@

clean: rm -f .o Hello

Comment by jlongman, Nov 30, 2007

if you're on Leopard and having a hard time compiling odcctools, [here|http://conceitedsoftware.com/iphone/Toolchain%20on%20Leopard.txt]

Comment by jlongman, Dec 01, 2007

which is similar to many comments in issues here ;-)

Comment by avocade, Dec 01, 2007

A missing file ("UIKeyboardInputProtocol.h") in UIKit (which is #imported in another UIKit file) makes it unable to compile for example mobile-colloquy.

Comment by jlongman, Dec 04, 2007

Solved this by re-installing xcode-3.0.

Gah, now I can't even run ./configure when compiling llvm, in the first step.

configure:2773: gcc    conftest.c  >&5
/usr/libexec/gcc/i686-apple-darwin9/4.0.1/ld: warning unknown -macosx_version_min parameter value: 10.5.1 ignored (using 10.4)
/usr/libexec/gcc/i686-apple-darwin9/4.0.1/ld: /usr/lib/gcc/i686-apple-darwin9/4.0.1/../../../libgcc_s.10.5.dylib load command 8 unknown cmd field
/usr/libexec/gcc/i686-apple-darwin9/4.0.1/ld: /usr/lib/gcc/i686-apple-darwin9/4.0.1/../../../libSystem.dylib unknown flags (type) of section 6 (__TEXT,__dof_plockstat) in load command 0
collect2: ld returned 1 exit status
configure:2776: $? = 1
Comment by gargoylle.ltk, Dec 04, 2007

Successfully build on Gentoo x86_64. The only problem I ran into was that

$ ../../llvm-gcc-4.0-iphone/configure --enable-llvm=`llvm-config --obj-root` \
--enable-languages=c,c++,objc,obj-c++ --target=arm-apple-darwin --enable-sjlj-exceptions \
--with-heavenly=$HEAVENLY --with-as=/usr/local/bin/arm-apple-darwin-as \
--with-ld=/usr/local/bin/arm-apple-darwin-ld
$ make LLVM_VERSION_INFO=2.0-svn-iphone-dev-0.3-svn

failed - I don't remember the exact error message but it was clear that configure did not properly set LD. To recover from the error I ran the following commands:

$ make distclean
$ find . -type f -name config.cache -exec rm {} ";"
$ export LD=/usr/local/bin/arm-apple-darwin-ld
$ export AS=/usr/local/bin/arm-apple-darwin-as
$ ../../llvm-gcc-4.0-iphone/configure --enable-llvm=`llvm-config --obj-root` \
--enable-languages=c,c++,objc,obj-c++ --target=arm-apple-darwin --enable-sjlj-exceptions \
--with-heavenly=$HEAVENLY --with-as=/usr/local/bin/arm-apple-darwin-as \
--with-ld=/usr/local/bin/arm-apple-darwin-ld
$ make LLVM_VERSION_INFO=2.0-svn-iphone-dev-0.3-svn

After that everything went smooth (no compilation errors) and I was able to successfully build and run the UIKit Hello World application.

PS: to build odcctools I had to

export CFLAGS="-m32"
export LDFLAGS="-m32"

build and install them and then

unset CFLAGS LDFLAGS

Hope this helps someone.

Comment by neilpep, Dec 05, 2007

Hi

Anyone know of any good online guides on UIKit?

Thanks

Comment by ma...@freaks-brigade.com, Dec 10, 2007

Hi ! I ran into the following problem:

odcctools?# setarch i386 -sh-3.1# bash odcctools?# pwd /data/src/iphone-dev/build/odcctools odcctools?# export CFLAGS="-m32" odcctools?# export LDFLAGS="-m32" odcctools?# ../../odcctools/configure --target=arm-apple-darwin --disable-ld64 checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking target system type... arm-apple-darwin checking for gcc... gcc checking for C compiler default output file name... configure: error: C compiler cannot create executables See `config.log' for more details. odcctools?# pwd /data/src/iphone-dev/build/odcctools odcctools?# uname -a Linux 91.126.25.179 2.6.18-8.1.15.el5 #1 SMP Mon Oct 22 08:32:28 EDT 2007 i686 athlon i386 GNU/Linux odcctools?#

Would be great if someone could help. Thankx !

Marty

Comment by micha.knaus, Dec 11, 2007

Hi

Comment by micha.knaus, Dec 11, 2007

Hi

On Ubuntu 7.04 i ran into the same problem already reported:

arm-apple-darwin-lipo: can't figure out the architecture type of: libgcc_s.10.4.dylib_T

Anyone have an idea ? Thanks in advance ! Micha

Comment by alfred.heggestad, Dec 13, 2007

many thanks for the detailed instructions. I finally managed to install the toolchain on my Debian Etch/AMD64 (with some hacks). When building some code with the toolchain I get this error:

$ make CC=arm-apple-darwin-gcc /usr/local/bin/arm-apple-darwin-ld: /usr/local/lib/gcc/arm-apple-darwin/4.0.1/libgcc.a(udivsi3.o) has external relocation entries in non-writable section (TEXT,text) for symbols: div0 collect2: ld returned 1 exit status

any idea? the same error happens with several programs..

Comment by Tianli.Xu, Dec 13, 2007

Succeed on Cygwin under Windows XP.

Note: please DO NOT "make clean" after "make install".

Comment by rasmus.bonnedal, Dec 14, 2007

It could be useful to know that the offset on the current xcode image (xcode25_8m2558_developerdvd.dmg) is 1381744. I also didn't have the pax utility so my command line looked like this:

dd if=xcode25_8m2558_developerdvd.img skip=1381744 | gunzip | cpio -i

Comment by lukas.mathis, Dec 16, 2007

On Leopard, I somehow managed to not have llvm-config. I get the following error:

MacBook?:iphone-dev user$ ../../llvm-gcc-4.0-iphone/configure --enable-llvm=llvm-config --obj-root --enable-languages=c,c++,objc,obj-c++ --target=arm-apple-darwin --enable-sjlj-exceptions --with-heavenly=$HEAVENLY --with-as=/usr/local/bin/arm-apple-darwin-as --with-ld=/usr/local/bin/arm-apple-darwin-ld -bash: llvm-config: command not found -bash: ../../llvm-gcc-4.0-iphone/configure: No such file or directory Anyone know what I'm doing wrong?

Comment by waterlou, Dec 16, 2007

for one that want to compile a objc, c++ mixed project, remember to add the following options in the LDFLAGS:

LDFLAGS=-L/usr/local/lib ....

because those cpp library is compiled to /usr/local/lib rather than /user/local/arm-apple-darwin/lib and you will get cannot find stdc++ library error.

Comment by mcshane.ian, Dec 16, 2007

When I try to compile anything, even code i've checked out from working iPhone app repositories, I get a bunch of errors where header files are missing. They are always the same and are included into foundation.h: NSCodingProtocol.h NSCopyingProtocol.h

Google doesn't return anything useful, I don't think i've missed a step out in the installation..

This is on OS X Leopard.

Comment by mcshane.ian, Dec 16, 2007

The actual errors in the XCode build results are from NSAffineTransform.h.

Comment by westbaer, Dec 22, 2007

Can anyone help with this error on leopard?

cd libstuff && make gcc -Wall -Wno-long-double -Wno-import -DHAVE_CONFIG_H -I..//include -I../../../odcctools/include -g -O2 -fno-builtin-round -fno-builtin-trunc -no-cpp-precomp -mdynamic-no-pic -c -o execute.o ../../../odcctools/libstuff/execute.c In file included from ../../../odcctools/include/libkern/OSByteOrder.h:70, from ../../../odcctools/include/mach/ndr.h:94, from ../../../odcctools/include/mach/clock_priv.h:7, from ../../../odcctools/include/mach/mach_interface.h:37, from ../../../odcctools/include/mach/mach.h:62, from ../../../odcctools/libstuff/execute.c:25: ../../../odcctools/include/libkern/machine/OSByteOrder.h:45: error: redefinition of ‘OSSwapInt16’ /usr/include/libkern/i386/OSByteOrder.h:49: error: previous definition of ‘OSSwapInt16’ was here ../../../odcctools/include/libkern/machine/OSByteOrder.h:54: error: redefinition of ‘OSSwapInt32’ /usr/include/libkern/i386/OSByteOrder.h:58: error: previous definition of ‘OSSwapInt32’ was here ../../../odcctools/include/libkern/machine/OSByteOrder.h:63: error: redefinition of ‘OSSwapInt64’ /usr/include/libkern/i386/OSByteOrder.h:69: error: previous definition of ‘OSSwapInt64’ was here make1?: execute.o? Error 1 make: libstuff? Error 2

Comment by farid.benbadis, Dec 23, 2007

Hi,

I try to compile the toolchain on an Intel Leopard Machine, and it fails in the last but one step: make LLVM_VERSION_INFO=2.0-svn-iphone-dev-0.3-svn It fails when it checks for arm-apple-darwin-gcc . It executes gcc -isystem /usr/local/arm-apple-darwin/sys-include but I have not this sys-include directory anywhere. The make result is: checking for suffix of object files... configure: error: cannot compute suffix of object files: cannot compile See `config.log' for more details. make: configure-target-libstdc++-v3? Error 1

Can some help me fix this issue please?

Comment by teufelch...@gmx.de, Dec 24, 2007

@westbaer: I had the same problem. Do this: ../../odcctools/configure --target=arm-apple-darwin --disable-ld64 export INCPRIVEXT="-isysroot /Developer/SDKs/MacOSX10.4u.sdk" make

Comment by fb.iphone, Dec 24, 2007

Another successful build on Ubuntu Fawn (Intel). I first used gamesover Cygwin install... but I rather work from a terminal in Linux any day.

:-)

Comment by westbaer, Dec 25, 2007

Thanks, but I have an another problem.

/usr/local/bin/arm-apple-darwin-ld: can't locate file for: -lc

collect2: ld returned 1 exit status

make2?: libgcc_s.dylib? Error 1

make1?: stmp-multilib? Error 2

make: all-gcc? Error 2

Comment by malek.martin, Dec 26, 2007

Sucessful build on Fedora 8 with gcc 4.1.2 20070925 and all patches up to date applied. The system is a VMWare 6.02 partition runing on XP on a HP nx9420 with Intel Centrino Duo.

Now time for HelloWorld? :)

Comment by farid.benbadis, Dec 30, 2007

Here is a pdf giving some simpler steps to install the toolchain : http://lucasnewman.com/phonedev.pdf

You'll have troubles compiling vfdecrypt under a core2duo leopard machine, as i did. Thus, google for a vfdecrypt binary, and you should be done.

Comment by damianlewis, Jan 06, 2008

Hi,

I have written a HOWTO for building a working 1.1.2 toolchain (or previous versions) under Leopard - get it at:

http://groups.google.com/group/jiggyapp-devel/web/iphone_leopard_toolchain_howto.rtf

It is a full step-by-step guide that includes downloading all the tools, firmware files, decryption utils, plus all the workarounds that fix the build process and the extra commands necessary to fix the holes in the current documentation on this site and others.

Hope it helps.

Cheers,

DamHack?

Comment by andre.basse, Jan 06, 2008

@DamHack? - damianlewis

Thanks for the HOWETO for Leopard. Do you know if this works with a PPC?

Comment by Pete.Art, Jan 08, 2008

Works fine on my PPC G4 Leopard!

Comment by malpka, Jan 09, 2008

Ok. I've compiled 1.1.2 toolchain using cygwin on WinXP (before i've realized there is a special package) nvmnd

Question about compiling (optimize) what is the smallest filesize of the output executable? After standard -O3 & strip it's always 12956 for simple int main(int argc,char**argv){} Comparing to NerveGas?' BSD/alias 8864 is far too much (: is there some kind of asm here?

Comment by phil2win, Jan 12, 2008

For those of you still getting that Error 2 message, here's what I did. I was getting some message about it not finding arm-apple-darwin-ranlib, so I checked to see if it was in /usr/local/bin, and it was, so I checked to see if /usr/local/bin was in my PATH, and it was, and I could run arm-apple-darwin-ranlib just fine from a terminal, so instead of sudo make install, I just did a su, and then make install, and it worked fine.

openSuSE 10.3.

Comment by tobias.richards, Jan 16, 2008
The "can't locate file: -lc" is because HEAVENLY is either not defined correctly or because the DMG is not the right one - you need the full restore DMG , the .39 version, not the update DMG live and learn

or you used sudo to copy iphone-filesystem to /usr/local/share, but you don't have permissions to that folder. TRY:

sudo make LLVM_VERSION_INFO=2.0-svn-iphone-dev-0.3-svm
Comment by barkermn01, Jan 24, 2008

Hiya ppl if Useing Windows Use VMWare it works and to mout to DMG download it in windows and mount it as CD Drive in linux works a treat

Comment by mjwelch1, Jan 27, 2008

1.1.3 Help?

Comment by shade.ge, Jan 30, 2008
Comment by musesum, Jan 31, 2008

Hey neilpep, emanuele.cipolloni,

Are either of you still monitoring this thread? Was wondering if either of you made much progress in mixing C++ with ObjC in the same project?

Comment by ero.carrera, Feb 01, 2008

As some other people here, I was also getting the following problem:

arm-apple-darwin-lipo -output libgcc_s.10.4.dylib -create libgcc_s.10.4.dylib_T*
arm-apple-darwin-lipo: can't figure out the architecture type of: libgcc_s.10.4.dylib_T

I got arm-apple-darwin-lipo to not complain by adding "-arch i386" between "-create" and libgcc_s.10.4.dylib_T

I went into ./gcc and entered the command manually. I needed to do the same for the binary for 10.5 that is build subsequently.

After that I got the whole toolchain compiled and managed to compile iPhone apps!

(I'm building on a Debian VM on Parallels... couldn't get it to build easily on Leopard)

Comment by oradyvan, Feb 06, 2008

ero.carrera: I have discovered similar problem today. The solution I found that worked for me is this one:

http://code.google.com/p/iphone-dev/issues/detail?id=86#c4

Comment by namjam105, Feb 07, 2008

Add Source installer : http://iphonebaidu.com/app/ Test iPhone - iPhone Simulator : http://iphonebaidu.com/test/ All Software for Apple MAC : http://iphonebaidu.com/mac-iphone/ All Software for Apple iPhone : http://iphonebaidu.com/mac-iphone/iphone.html

Install iTransformy (.swf) view for iPhone : http://iphonebaidu.com/beta/ Forum iPhone : http://iphonebaidu.com/forum/

Copyright © 2008 iPhone Baidu! Inc. All rights reserved

Comment by david.m.thornton, Feb 18, 2008

does anyone want to work on porting GCC to the iphone itself...?

Comment by david.m.thornton, Feb 21, 2008

try copying libstdc++.dylib from /usr/local/lib to /usr/local/arm-apple-darwin/lib

to compile cpp programs

Comment by dborca, Feb 22, 2008

@ david.m.thornton Yes, I did it. It was a PITA to bootstrap it. It is fun, but I don't think it's very useful.

gcc on the iPhone almost compiles itself. Almost, because very big c++ sources fail to compile (preprocessed sources > 1.2M) because the whole Term is jettisoned when cc1plus eats up > 64MB of memory. I also had one c source that didn't compile but didn't crash either, perhaps gcc/llvm entered infinite loop. I had to manually compile those files off the iPhone.

Comment by david.m.thornton, Mar 12, 2008

woa woa woa - ok - woa

PITA ??? what

now go to iphone-gcc.googlecode.com... he

how did you do it .... also why did you use llvm... oh my god ive got so many questions to ask - ok do you want to be added to the iphone-gcc project...?

Comment by david.m.thornton, Mar 12, 2008

it would be sooooooo useful I will make a GUI IDE and it will be so sweet, seriously email me

Comment by actionpsp, Mar 15, 2008

Hi,

On Cygwin on Windows Vista, i obtain an error : could not locate -lcrt1.o

How to do ? Thanks

Comment by houtianze, Mar 16, 2008

For libc.dylib complaining while building under Windows, iPhone firmware 1.1.2

I got the iphone filesystem by decrypting the .dmg then extracting using PowerISO and encountred the following problem while trying to compile helloWorld: /usr/local/bin/arm-apple-darwin-ld: /usr/local/arm-apple-darwin/filesystem/usr/lib/libc.dylib truncated or malformed object (mach header extends past the end of the file),

and after the reading of the posts here, i concluded that it is the symlink problem (the symlinks lost while extracting from the .dmg). And I've come up a script solving this:

#!/bin/sh

cd /usr/local/arm-apple-darwin/filesystem

if [ -s filesystem.link.fixed ]
then
	echo error! the filesystem has been fixed before. this script is supposed to be run ONCE only.

else
	echo fixing the iphone/itouch filesystem links, please wait ...

	ln -s -f `cat etc` etc
	ln -s -f `cat mach` mach
	ln -s -f `cat tmp` tmp
	ln -s -f `cat var` var
	ln -s -f `cat Library/Logs` Library/Logs
	ln -s -f `cat Library/Preferences` Library/Preferences
	ln -s -f `cat private/etc/resolv.conf` private/etc/resolv.conf
	ln -s -f `cat private/var/db/localtime` private/var/db/localtime
	ln -s -f `cat System/Library/Frameworks/CoreTelephony.framework/Support/20801` System/Library/Frameworks/CoreTelephony.framework/Support/20801
	ln -s -f `cat System/Library/Frameworks/CoreTelephony.framework/Support/20802` System/Library/Frameworks/CoreTelephony.framework/Support/20802
	ln -s -f `cat System/Library/Frameworks/CoreTelephony.framework/Support/20808` System/Library/Frameworks/CoreTelephony.framework/Support/20808
	ln -s -f `cat System/Library/Frameworks/CoreTelephony.framework/Support/22201` System/Library/Frameworks/CoreTelephony.framework/Support/22201
	ln -s -f `cat System/Library/Frameworks/CoreTelephony.framework/Support/23402` System/Library/Frameworks/CoreTelephony.framework/Support/23402
	ln -s -f `cat System/Library/Frameworks/CoreTelephony.framework/Support/23410` System/Library/Frameworks/CoreTelephony.framework/Support/23410
	ln -s -f `cat System/Library/Frameworks/CoreTelephony.framework/Support/23411` System/Library/Frameworks/CoreTelephony.framework/Support/23411
	ln -s -f `cat System/Library/Frameworks/CoreTelephony.framework/Support/26201` System/Library/Frameworks/CoreTelephony.framework/Support/26201
	ln -s -f `cat System/Library/Frameworks/CoreTelephony.framework/Support/26206` System/Library/Frameworks/CoreTelephony.framework/Support/26206
	ln -s -f `cat System/Library/Frameworks/CoreTelephony.framework/Support/310150` System/Library/Frameworks/CoreTelephony.framework/Support/310150
	ln -s -f `cat System/Library/Frameworks/CoreTelephony.framework/Support/310170` System/Library/Frameworks/CoreTelephony.framework/Support/310170
	ln -s -f `cat System/Library/Frameworks/CoreTelephony.framework/Support/310180` System/Library/Frameworks/CoreTelephony.framework/Support/310180
	ln -s -f `cat System/Library/Frameworks/CoreTelephony.framework/Support/310380` System/Library/Frameworks/CoreTelephony.framework/Support/310380
	ln -s -f `cat System/Library/Frameworks/CoreTelephony.framework/Support/310410` System/Library/Frameworks/CoreTelephony.framework/Support/310410
	ln -s -f `cat System/Library/Frameworks/CoreTelephony.framework/Support/310980` System/Library/Frameworks/CoreTelephony.framework/Support/310980
	ln -s -f `cat System/Library/Frameworks/CoreTelephony.framework/Support/311180` System/Library/Frameworks/CoreTelephony.framework/Support/311180
	ln -s -f `cat System/Library/Frameworks/IOKit.framework/Versions/Current` System/Library/Frameworks/IOKit.framework/Versions/Current
	ln -s -f `cat System/Library/Frameworks/IOKit.framework/IOKit` System/Library/Frameworks/IOKit.framework/IOKit
	ln -s -f `cat System/Library/Frameworks/IOKit.framework/Resources` System/Library/Frameworks/IOKit.framework/Resources
	ln -s -f `cat System/Library/Frameworks/MultitouchSupport.framework/Versions/Current` System/Library/Frameworks/MultitouchSupport.framework/Versions/Current
	ln -s -f `cat System/Library/Frameworks/MultitouchSupport.framework/MultitouchSupport` System/Library/Frameworks/MultitouchSupport.framework/MultitouchSupport
	ln -s -f `cat System/Library/Frameworks/MultitouchSupport.framework/Resources` System/Library/Frameworks/MultitouchSupport.framework/Resources
	ln -s -f `cat System/Library/Frameworks/OfficeImport.framework/Versions/Current` System/Library/Frameworks/OfficeImport.framework/Versions/Current
	ln -s -f `cat System/Library/Frameworks/OfficeImport.framework/OfficeImport` System/Library/Frameworks/OfficeImport.framework/OfficeImport
	ln -s -f `cat System/Library/Frameworks/OfficeImport.framework/Resources` System/Library/Frameworks/OfficeImport.framework/Resources
	ln -s -f `cat System/Library/Frameworks/System.framework/Versions/B/System` System/Library/Frameworks/System.framework/Versions/B/System
	ln -s -f `cat System/Library/Frameworks/System.framework/Versions/Current` System/Library/Frameworks/System.framework/Versions/Current
	ln -s -f `cat System/Library/Frameworks/System.framework/Resources` System/Library/Frameworks/System.framework/Resources
	ln -s -f `cat System/Library/Frameworks/System.framework/System` System/Library/Frameworks/System.framework/System
	ln -s -f `cat usr/lib/libbz2.1.0.dylib` usr/lib/libbz2.1.0.dylib
	ln -s -f `cat usr/lib/libbz2.dylib` usr/lib/libbz2.dylib
	ln -s -f `cat usr/lib/libc.dylib` usr/lib/libc.dylib
	ln -s -f `cat usr/lib/libcharset.1.0.0.dylib` usr/lib/libcharset.1.0.0.dylib
	ln -s -f `cat usr/lib/libcharset.dylib` usr/lib/libcharset.dylib
	ln -s -f `cat usr/lib/libcrypto.dylib` usr/lib/libcrypto.dylib
	ln -s -f `cat usr/lib/libcurses.dylib` usr/lib/libcurses.dylib
	ln -s -f `cat usr/lib/libdbm.dylib` usr/lib/libdbm.dylib
	ln -s -f `cat usr/lib/libdl.dylib` usr/lib/libdl.dylib
	ln -s -f `cat usr/lib/libdns_sd.dylib` usr/lib/libdns_sd.dylib
	ln -s -f `cat usr/lib/libedit.dylib` usr/lib/libedit.dylib
	ln -s -f `cat usr/lib/libform.dylib` usr/lib/libform.dylib
	ln -s -f `cat usr/lib/libiconv.2.2.0.dylib` usr/lib/libiconv.2.2.0.dylib
	ln -s -f `cat usr/lib/libiconv.dylib` usr/lib/libiconv.dylib
	ln -s -f `cat usr/lib/libicucore.dylib` usr/lib/libicucore.dylib
	ln -s -f `cat usr/lib/libinfo.dylib` usr/lib/libinfo.dylib
	ln -s -f `cat usr/lib/libIOKit.A.dylib` usr/lib/libIOKit.A.dylib
	ln -s -f `cat usr/lib/libIOKit.dylib` usr/lib/libIOKit.dylib
	ln -s -f `cat usr/lib/libipsec.dylib` usr/lib/libipsec.dylib
	ln -s -f `cat usr/lib/libkvm.dylib` usr/lib/libkvm.dylib
	ln -s -f `cat usr/lib/libm.dylib` usr/lib/libm.dylib
	ln -s -f `cat usr/lib/libncurses.dylib` usr/lib/libncurses.dylib
	ln -s -f `cat usr/lib/libobjc.dylib` usr/lib/libobjc.dylib
	ln -s -f `cat usr/lib/libpoll.dylib` usr/lib/libpoll.dylib
	ln -s -f `cat usr/lib/libpthread.dylib` usr/lib/libpthread.dylib
	ln -s -f `cat usr/lib/librpcsvc.dylib` usr/lib/librpcsvc.dylib
	ln -s -f `cat usr/lib/libsqlite3.0.8.6.dylib` usr/lib/libsqlite3.0.8.6.dylib
	ln -s -f `cat usr/lib/libsqlite3.dylib` usr/lib/libsqlite3.dylib
	ln -s -f `cat usr/lib/libssl.dylib` usr/lib/libssl.dylib
	ln -s -f `cat usr/lib/libstdc++.6.dylib` usr/lib/libstdc++.6.dylib
	ln -s -f `cat usr/lib/libSystem.dylib` usr/lib/libSystem.dylib
	ln -s -f `cat usr/lib/libtidy.dylib` usr/lib/libtidy.dylib
	ln -s -f `cat usr/lib/libxml2.dylib` usr/lib/libxml2.dylib
	ln -s -f `cat usr/lib/libz.1.1.3.dylib` usr/lib/libz.1.1.3.dylib
	ln -s -f `cat usr/lib/libz.1.dylib` usr/lib/libz.1.dylib
	ln -s -f `cat usr/lib/libz.dylib` usr/lib/libz.dylib
	
	echo done!
	echo done! > filesystem.link.fixed
fi

Save the above as fixlink.sh, then copy to your cygwin /usr/local/arm-apple-darwin/filesystem folder. Open cygwin shell and type the following:

dos2unix fixlink.sh
chmod +x fixlink.sh
./fixlink.sh

After it is done, the linking problem should no longer persist.

Comment by s.p.bone, Apr 06, 2008

I get a compile error when running make for the odcctools (see below). Any ideas on how to correct this error? has anyone else run into this?

cd misc && make make1?: Nothing to be done for `default'. cd otool && make gcc -o otool main.o ofile_print.o m68k_disasm.o i860_disasm.o m88k_disasm.o i386_disasm.o ppc_disasm.o hppa_disasm.o sparc_disasm.o arm_disasm.o print_objc.o ofile.o -multiply_defined suppress -L..//libstuff -lstuff Undefined symbols: "print_objc_string_object_section_64", referenced from: processor in main.o "print_objc2", referenced from: processor in main.o ld: symbol(s) not found collect2: ld returned 1 exit status make1?: otool? Error 1 make: otool? Error 2

Comment by exod.bsd, Apr 11, 2008

Does anyone have created an uninstall script ? Needed to switch to arm-apple-darwin-runtime port from DarwinPorts?. Not all packages have an "uninstall" rule..

Comment by obaidahmed, Apr 21, 2008

does anyone here have a decrypted firmware for 1.1.4?

Comment by bughira, Apr 23, 2008

I was able to build toolchain on slax 5.8.8 with bison (GNU Bison) 2.1 flex version 2.5.4 gcc version 3.4.6

No special changes required.

Comment by abhi.hatekar, Apr 24, 2008

Successfully build on Fedora core 8. hello world got compiled too. :)

Comment by izzonline, May 03, 2008

I ran into this error doing make:

cd libstuff && make make1?: Entering directory `/home/skizzo/iphone-dev/build/odcctools/libstuff' gcc -Wall -Wno-long-double -Wno-import -DHAVE_CONFIG_H -DLITTLE_ENDIAN=1 -I..//include -I../../../odcctools/include -include ../../../odcctools/include/extern.h -I../../../odcctools/include/foreign -g -O2 -fno-builtin-round -fno-builtin-trunc -c -o ofile.o ../../../odcctools/libstuff/ofile.c In file included from ../../../odcctools/libstuff/ofile.c:44: ../../../odcctools/include/mach/ppc/thread_status.h:44:1: warning: "THREAD_STATE_NONE" redefined In file included from ../../../odcctools/include/mach/machine/thread_status.h:29, from ../../../odcctools/include/mach/thread_status.h:70, from ../../../odcctools/include/mach/exception_types.h:147, from ../../../odcctools/include/mach/mach_types.h:75, from ../../../odcctools/include/mach/mach.h:61, from ../../../odcctools/libstuff/ofile.c:32: ../../../odcctools/include/mach/i386/thread_status.h:110:1: warning: this is the location of the previous definition In file included from ../../../odcctools/libstuff/ofile.c:44: ../../../odcctools/include/mach/ppc/thread_status.h:53:1: warning: "VALID_THREAD_STATE_FLAVOR" redefined In file included from ../../../odcctools/include/mach/machine/thread_status.h:29, from ../../../odcctools/include/mach/thread_status.h:70, from ../../../odcctools/include/mach/exception_types.h:147, from ../../../odcctools/include/mach/mach_types.h:75, from ../../../odcctools/include/mach/mach.h:61, from ../../../odcctools/libstuff/ofile.c:32: ../../../odcctools/include/mach/i386/thread_status.h:127:1: warning: this is the location of the previous definition In file included from ../../../odcctools/libstuff/ofile.c:44: ../../../odcctools/include/mach/ppc/thread_status.h:155:1: warning: "MACHINE_THREAD_STATE" redefined In file included from ../../../odcctools/include/mach/machine/thread_status.h:29, from ../../../odcctools/include/mach/thread_status.h:70, from ../../../odcctools/include/mach/exception_types.h:147, from ../../../odcctools/include/mach/mach_types.h:75, from ../../../odcctools/include/mach/mach.h:61, from ../../../odcctools/libstuff/ofile.c:32: ../../../odcctools/include/mach/i386/thread_status.h:523:1: warning: this is the location of the previous definition In file included from ../../../odcctools/libstuff/ofile.c:44: ../../../odcctools/include/mach/ppc/thread_status.h:156:1: warning: "MACHINE_THREAD_STATE_COUNT" redefined In file included from ../../../odcctools/include/mach/machine/thread_status.h:29, from ../../../odcctools/include/mach/thread_status.h:70, from ../../../odcctools/include/mach/exception_types.h:147, from ../../../odcctools/include/mach/mach_types.h:75, from ../../../odcctools/include/mach/mach.h:61, from ../../../odcctools/libstuff/ofile.c:32: ../../../odcctools/include/mach/i386/thread_status.h:524:1: warning: this is the location of the previous definition ../../../odcctools/libstuff/ofile.c: In function ‘ofile_map’: ../../../odcctools/libstuff/ofile.c:747: warning: dereferencing type-punned pointer will break strict-aliasing rules ../../../odcctools/libstuff/ofile.c:3765:8: warning: extra tokens at end of #endif directive At top level: cc1: error: unrecognized command line option "-Wno-long-double" make1?: ofile.o? Error 1 make1?: Leaving directory `/home/skizzo/iphone-dev/build/odcctools/libstuff' make: libstuff? Error 2

Can you help me?

Comment by activea, May 04, 2008

Succeed on Cygwin under Windows XP & Vista. (iPhone 1.1.4)

<<Windows Cygwin Binary Toolchain Installation>>

Solution for the problem: <<... /usr/local/bin/arm-apple-darwin-ld: can't locate file for: -lcrt1.o >>

..is... (step by step installation) 1)Do all the steps from the official page... (http://wiki.iphonegameover.com/Windows_Cygwin_Binary_Toolchain_Installation)

When asked 'Do you wish to connect to your device and download the required files?' Press n for No. <<<----

2) Decrypt a firmware ipsw manually and place the extracted filesystem in /usr/local/arm-apple-darwin/filesystem after Cygwin is installed.. (follow the next steps)

For Firmware 1.1.4 (i) get the vfdecrypt.exe from Rapid Share (http://rapidshare.com/files/112406081/vfdecrypt.rar.html) (ii) get the Apple's iPhone firmware 1.1.4 and rename it with extension .zip and unzip it (run) vfdecrypt -i 022-3894-4.dmg -o decrypted114.dmg -k d0a0c0977bd4b6350b256d6650ec9eca419b6f961f593e74b7e5b93e010b698ca6cca1fe

download 30 day eval of TransMac? (google and you will find)

Open decrypted114.dmg with TransMac?

Extract the applications you want and transfer the to /usr/local/arm-apple-darwin/filesystem

Start the installation ..

When you see the <<Your toolchain installation is now complete!>> message...

3) Copy/Replace the lib files of the following attachment to C:\cygwin\usr\local\arm-apple-darwin\filesystem\usr\lib http://rapidshare.com/files/66800884/lib.rar (14.2mb) Password for rar file is: aksblog.co.nr

4) Now you are ready to compile the first helloWorld app: http://rapidshare.com/files/112409124/helloWorld.rar.html. just decompress it in a folder e.g C:\cygwin\Developer\helloWorld and run <<make>> to do the job!

Enjoy ;)

Comment by naciselim, May 05, 2008

Hi,

On redhat linux, at stage make LLVM_VERSION_INFO=2.0-svn-iphone-dev-0.3-svn, I get this error:

make2?: Entering directory `/root/naci/iphone/toolchain/iphone-dev/build/llvm-gcc-4.0-iphone/gcc' make GCC_FOR_TARGET="/root/naci/iphone/toolchain/iphone-dev/build/llvm-gcc-4.0-iphone/gcc/xgcc -B/root/naci/iphone/toolchain/iphone-dev/build/llvm-gcc-4.0-iphone/gcc/ -B/usr/local/arm-apple-darwin/bin/ -B/usr/local/arm-apple-darwin/lib/ -isystem /usr/local/arm-apple-darwin/include -isystem /usr/local/arm-apple-darwin/sys-include" \ AR_FOR_TARGET="arm-apple-darwin-ar" \ AR_CREATE_FOR_TARGET="arm-apple-darwin-ar rc" \ AR_EXTRACT_FOR_TARGET="arm-apple-darwin-ar x" \ AR_FLAGS_FOR_TARGET="" \ CC="gcc" CFLAGS="-g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition " \ BUILD_PREFIX="" \ BUILD_PREFIX_1="loser-" \ LANGUAGES="" \ LIBGCC2_CFLAGS="-O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC -pipe -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -DGCC_FLOAT_NOT_NEEDED -Dinhibit_libc " \ MULTILIB_CFLAGS="" T= crt3.o make3?: Entering directory `/root/naci/iphone/toolchain/iphone-dev/build/llvm-gcc-4.0-iphone/gcc' make3?: Leaving directory `/root/naci/iphone/toolchain/iphone-dev/build/llvm-gcc-4.0-iphone/gcc' /root/naci/iphone/toolchain/iphone-dev/build/llvm-gcc-4.0-iphone/gcc/xgcc -B/root/naci/iphone/toolchain/iphone-dev/build/llvm-gcc-4.0-iphone/gcc/ -B/usr/local/arm-apple-darwin/bin/ -B/usr/local/arm-apple-darwin/lib/ -isystem /usr/local/arm-apple-darwin/include -isystem /usr/local/arm-apple-darwin/sys-include -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC -pipe -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -DGCC_FLOAT_NOT_NEEDED -Dinhibit_libc -dynamiclib -nodefaultlibs -install_name /usr/lib/libgcc_sif test . = ppc64 ; then echo _. ; fi.1.dylib -single_module -o ./libgcc_s.1.dylib.tmp -Wl,-exported_symbols_list,libgcc/./libgcc.map -compatibility_version 1 -current_version 1.0 libgcc/./udivsi3_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 libgcc/./ashldi3_s.o libgcc/./ashrdi3_s.o libgcc/./cmpdi2_s.o libgcc/./ucmpdi2_s.o libgcc/./floatdidf_s.o libgcc/./floatdisf_s.o libgcc/./fixunsdfsi_s.o libgcc/./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 libgcc/./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 libgcc/./subvsi3_s.o libgcc/./subvdi3_s.o libgcc/./mulvsi3_s.o libgcc/./mulvdi3_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 libgcc/./paritydi2_s.o libgcc/./powisf2_s.o libgcc/./powidf2_s.o libgcc/./powixf2_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 libgcc/./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: archive: /usr/lib/libc.a has no table of contents, add one with ranlib(1) (can't load from it) collect2: ld returned 1 exit status make2?: libgcc_s.dylib? Error 1 make2?: Leaving directory `/root/naci/iphone/toolchain/iphone-dev/build/llvm-gcc-4.0-iphone/gcc' make1?: stmp-multilib? Error 2 make1?: Leaving directory `/root/naci/iphone/toolchain/iphone-dev/build/llvm-gcc-4.0-iphone/gcc' make: all-gcc? Error 2

Any idea? Thanks,

nsical.

Comment by naciselim, May 05, 2008

sorry for the above post, I hadn't set HEAVENLY correctly.

Comment by naciselim, May 06, 2008

Folks, I am stuck at make LLVM_VERSION_INFO=2.0-svn-iphone-dev-0.3-svn:

checking for sin in -lm... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES. make: configure-target-libstdc++-v3? Error 1

Symlink in /usr/local/share/iphone-filesystem/usr/lib are ok as I got them from iphone with tar, scp, untar method.

This is on Red Hat 3.4.3-9.EL4. naciselim.

Comment by xun.jiang, May 07, 2008

On my Ubuntu 8.04, LLVMOBJDIR=pwd should be changed to LLVMOBJDIR=$PWD And also I have to remove -Wno-long-double in odcctools makefiles during odcctools building process. After figuring out all of these, the tool chain can be build successfully!!!

Comment by root.darkstar, May 07, 2008

I successfully installed everything on Sabayon (Gentoo based) wuth no errors, but when tring to build a simple Hello World example I get this:

/usr/local/libexec/gcc/arm-apple-darwin/4.0.1/collect2 -dynamic -arch arm -macosx_version_min 10.4 -syslibroot /usr/local/share/iphone-filesystem -weak_reference_mismatches non-weak -o SampleApp? -lcrt1.o -L/usr/local/lib/gcc/arm-apple-darwin/4.0.1 -L/usr/local/lib/gcc/arm-apple-darwin/4.0.1/../../../../arm-apple-darwin/lib -lobjc -framework CoreFoundation? -framework Foundation -framework UIKit -framework LayerKit? -framework CoreGraphics? mainapp.o SampleApp?.o -lgcc -lSystem /usr/local/bin/arm-apple-darwin-ld: can't locate framework for: -framework CoreFoundation? collect2: ld returned 1 exit status make: SampleApp? Error 1

I have extracted the SDKs from the XCode .dmg archive, they are installed with ./configure --with-macosx-sdk=/Developer/SDKs/MacOSX10.4u.sdk sudo bash install-headers.sh

I even reinstalled them, just in case, but still it does not compile.

Comment by ban...@mailinator.com, May 18, 2008

When compiling LLVM-GCC, the toolchain does not successfully link against the libc.dylib from the leaked beta 5 (5a274d). This the error I receive:

/usr/local/bin/arm-apple-darwin-ld: /home/bankai/Projects/iphone/filesystem/usr/lib/libc.dylib load command 7 unknown cmd field
collect2: ld returned 1 exit status
make[2]: *** [libgcc_s.dylib] Error 1
make[2]: Leaving directory `/home/bankai/Projects/iphone/iphone-dev/build/llvm-
gcc-4.0-iphone/gcc'
make[1]: *** [stmp-multilib] Error 2
make[1]: Leaving directory `/home/bankai/Projects/iphone/iphone-dev/build/llvm-
gcc-4.0-iphone/gcc'
make: *** [all-gcc] Error 2
Comment by mattlmattlmattl, May 19, 2008

On Ubuntu 8.04, I can make it all the way through the above steps (including doing the LLVMOBJDIR=$PWD and removing -Wno-long-double in the odcctools config file), but once I've apparently succeeded, I can't make any apps. Compilation fails when it tries to find files in /usr/local/arm-apple-darwin/include - the files that should have been copied there in the

$ ./configure --with-macosx-sdk=/Developer/SDKs/MacOSX10.4u.sdk $ sudo bash install-headers.sh

steps. Many files are copied there, but most of the .h files in the "capitalized" directories (CoreGraphics?, CoreServices?, IOKit, etc., etc.) are not copied over.

I finally caught the errors that fly by when running install-headers.sh and see that it's looking for

.../MacOSX10.4u.sdk//System/Library/Frameworks/CoreAudio?.framework/Headers .../MacOSX10.4u.sdk//System/Library/Frameworks/IOKit.framework/Headers etc. etc.

which in fact, do not exist in my xcode2.5 SDK. Instead, the .h files are mainly in subdirectories under those like .../Version/A/files.h

Anyone else have this problem? Does xcode3.0 work better? (I have a powerbook G4 running Tiger, so it doesn't want to touch xcode3.0 but was able to open 2.5)

Maybe tweaking install-headers.sh is the answer? What about the people who say they've got it all working on Ubuntu 8.04 - what xcode are you folks using?

Thanks.

Comment by mattlmattlmattl, May 28, 2008

To update my cry for help on Ubuntu 8.04 - I got it working by copying all the .h files that were missing from the framework so they are now in their correct places in /usr/local/arm-apple-darwin/include...

I can now compile programs and run them on my iPod Touch.

Comment by nicemac.llc, Jun 13, 2008

I have this same error building the llvm toolchain:

make1?: No rule to make target /Users/gdtv/iphone/toolchain/iphone-dev/llvm-gcc-4.0-iphone-build/gcc/include/llvm/Intrinsics.gen', needed by llvm-convert.o'. Stop. make: all-gcc? Error 2

I did not see an answer anywhere on the web. I was following a similiar Leopard Guide by NerveGas???.

This is probably the 3rd or 4th hurdle and the only one that I can't find an answer too but one or two other people ran into this in 2007.

Side note: any chance for an updated guide perhaps using Leopard 10.5.3 and any parts of Apple's SDK? Or simply a guide for 10.5.3 with all the patches and workarounds?

Back the LLVM error, any ideas?

Thank you!

Comment by tianyf, Jun 15, 2008

Could it support fotran 77 language?

Comment by darX07, Jun 15, 2008

i'm gettin a bash error when doing the last step (setting up LLVM)...

bash: llvm-config: command not found

Comment by gavrie, Jun 17, 2008

If you downloaded xcode_3.0.dmg (instead of 2.5), you'll find that it includes MacOSX10.4.Universal.pkg as a file and not a directory, so that the instructions above won't work.

To extract the contents of this file under Linux, I did the following:

xar -xf MacOSX10.4.Universal.pkg 
zcat Payload | cpio -id

The xar command comes standard on Ubuntu, I don't know about other distros.

Comment by starkruzr, Jun 30, 2008

Can I get some help with Leopard? The document linked above for Leopard users appears no longer to exist. I am on Leopard and have the 1.1.4 firmware. I get stuck here:

http://arslinux.pastebin.ca/1059719

Thanks.

Comment by Kevin.Freeman.K, Jul 03, 2008

hi,i try to follow this tutorial,but i can't get this:"Get a copy of the iPhone root filesystem. " i don't have Wi-Fi,but a cable.I don't known how to connect my iPhone to Fedora 8 and how to get the cope of my iPhone root filesystem. i'm a new comer,can anybody tell me how to do it, thanks a lot!

Comment by ever...@mailinator.com, Jul 06, 2008

Hey,

Instead of trying to download the filesystem from your iPhone, you can try downloading one that has already been released. Try searching for "iphone firmware" on a torrent site and look at http://tungchingkai.blogspot.com/2008/01/decrypt-iphone-filesystem-firmware_28.html for tips on how to extract and decrypt it.

Comment by ever...@mailinator.com, Jul 06, 2008

Hi,

I need some help here. I am trying to compile llvm-gcc on Debian but I get a compile error.

make[3]: Entering directory `/home/ever/Projects/iphone/build/llvm-gcc/gcc'
/home/ever/Projects/iphone/build/llvm-gcc/gcc/xgcc -B/home/ever/Projects/iphone/build/llvm-gcc/gcc/ -B/usr/local/arm-apple-darwin9/bin/ -B/usr/local/arm-apple-darwin9/lib/ -isystem /usr/local/arm-apple-darwin9/include -isystem /usr/local/arm-apple-darwin9/sys-include -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -I. -I. -I../../../src/iphone-dev/trunk/llvm-gcc-4.0-iphone/gcc -I../../../src/iphone-dev/trunk/llvm-gcc-4.0-iphone/gcc/. -I../../../src/iphone-dev/trunk/llvm-gcc-4.0-iphone/gcc/../include -I../../../src/iphone-dev/trunk/llvm-gcc-4.0-iphone/gcc/../libcpp/include  -I/home/ever/Projects/iphone/src/llvm-svn/include -I/home/ever/Projects/iphone/src/llvm-svn/include  \
	 \
	  -c ../../../src/iphone-dev/trunk/llvm-gcc-4.0-iphone/gcc/config/darwin-crt3.c -o crt3.o
In file included from ../../../src/iphone-dev/trunk/llvm-gcc-4.0-iphone/gcc/config/darwin-crt3.c:38:
../../../src/iphone-dev/trunk/llvm-gcc-4.0-iphone/gcc/tsystem.h:90:19: error: stdio.h: No such file or directory
../../../src/iphone-dev/trunk/llvm-gcc-4.0-iphone/gcc/tsystem.h:93:23: error: sys/types.h: No such file or directory
../../../src/iphone-dev/trunk/llvm-gcc-4.0-iphone/gcc/tsystem.h:96:19: error: errno.h: No such file or directory
../../../src/iphone-dev/trunk/llvm-gcc-4.0-iphone/gcc/tsystem.h:103:20: error: string.h: No such file or directory
../../../src/iphone-dev/trunk/llvm-gcc-4.0-iphone/gcc/tsystem.h:104:20: error: stdlib.h: No such file or directory
../../../src/iphone-dev/trunk/llvm-gcc-4.0-iphone/gcc/tsystem.h:105:20: error: unistd.h: No such file or directory
../../../src/iphone-dev/trunk/llvm-gcc-4.0-iphone/gcc/tsystem.h:111:18: error: time.h: No such file or directory
../../../src/iphone-dev/trunk/llvm-gcc-4.0-iphone/gcc/config/darwin-crt3.c:40:19: error: dlfcn.h: No such file or directory
../../../src/iphone-dev/trunk/llvm-gcc-4.0-iphone/gcc/config/darwin-crt3.c: In function ‘get_globals’:
../../../src/iphone-dev/trunk/llvm-gcc-4.0-iphone/gcc/config/darwin-crt3.c:271: warning: implicit declaration of function ‘calloc’
../../../src/iphone-dev/trunk/llvm-gcc-4.0-iphone/gcc/config/darwin-crt3.c:271: warning: incompatible implicit declaration of built-in function ‘calloc’
../../../src/iphone-dev/trunk/llvm-gcc-4.0-iphone/gcc/config/darwin-crt3.c:280: warning: implicit declaration of function ‘dlopen’
../../../src/iphone-dev/trunk/llvm-gcc-4.0-iphone/gcc/config/darwin-crt3.c:280: error: ‘RTLD_NOLOAD’ undeclared (first use in this function)
../../../src/iphone-dev/trunk/llvm-gcc-4.0-iphone/gcc/config/darwin-crt3.c:280: error: (Each undeclared identifier is reported only once
../../../src/iphone-dev/trunk/llvm-gcc-4.0-iphone/gcc/config/darwin-crt3.c:280: error: for each function it appears in.)
../../../src/iphone-dev/trunk/llvm-gcc-4.0-iphone/gcc/config/darwin-crt3.c:280: warning: assignment makes pointer from integer without a cast
../../../src/iphone-dev/trunk/llvm-gcc-4.0-iphone/gcc/config/darwin-crt3.c:298: warning: implicit declaration of function ‘dlsym’
../../../src/iphone-dev/trunk/llvm-gcc-4.0-iphone/gcc/config/darwin-crt3.c: In function ‘add_routine’:
../../../src/iphone-dev/trunk/llvm-gcc-4.0-iphone/gcc/config/darwin-crt3.c:335: warning: implicit declaration of function ‘malloc’
../../../src/iphone-dev/trunk/llvm-gcc-4.0-iphone/gcc/config/darwin-crt3.c:335: warning: incompatible implicit declaration of built-in function ‘malloc’
../../../src/iphone-dev/trunk/llvm-gcc-4.0-iphone/gcc/config/darwin-crt3.c: In function ‘run_routines’:
../../../src/iphone-dev/trunk/llvm-gcc-4.0-iphone/gcc/config/darwin-crt3.c:374: warning: implicit declaration of function ‘free’
../../../src/iphone-dev/trunk/llvm-gcc-4.0-iphone/gcc/config/darwin-crt3.c: In function ‘atexit_common’:
../../../src/iphone-dev/trunk/llvm-gcc-4.0-iphone/gcc/config/darwin-crt3.c:498: warning: incompatible implicit declaration of built-in function ‘malloc’
make[3]: *** [crt3.o] Error 1
make[3]: Leaving directory `/home/ever/Projects/iphone/build/llvm-gcc/gcc'
make[2]: *** [extra] Error 2
make[2]: Leaving directory `/home/ever/Projects/iphone/build/llvm-gcc/gcc'
make[1]: *** [stmp-multilib] Error 2
make[1]: Leaving directory `/home/ever/Projects/iphone/build/llvm-gcc/gcc'
make: *** [all-gcc] Error 2

Please, someone help me. I have been trying for several weeks now to get an unofficial SDK running, and I always get caught at the last step.

Comment by Kevin.Freeman.K, Jul 08, 2008

now i already fix it ,thanks for ever...@mailinator.com,!

Comment by Frederik.s.m, Jul 18, 2008

geeky geeks

Comment by cmholm, Jul 24, 2008

I'm getting the same error as bankai at the link for libc:

while running OS X 10.4.11 with Xcode 2.4.1.

/usr/local/bin/arm-apple-darwin-ld: /Volumes/macos2/iphone-dev/iphone-filesystem/usr/lib/libc.dylib load command 7 unknown cmd field collect2: ld returned 1 exit status make2?: libgcc_s.dylib? Error 1 make1?: stmp-multilib? Error 2 make: all-gcc? Error 2

In several places, such as the apple xcode-users list (http://lists.apple.com/archives/xcode-users/2007/Dec/msg00440.html), the suggestion is to set MACOSX_DEPLOYMENT_TARGET=10.4 in the environment. I've tried that, but no dice thus far. It seems like it would run counter to the 'arm' target we're aiming for.

Comment by cmholm, Jul 24, 2008

I should add that I'm using an iPod Touch fs after a 2.0 update.

Comment by eswenson1, Jul 25, 2008

Does this toolchain allow development of applications that run under 2.0 -- and has anyone actually successfully built applications that run under 2.0 (jailbroken)?

Comment by alex.smi...@gmail.com, Jul 25, 2008

I realize this thread has been alive for nearly a year now. With respect, is it time for a cleaned up version of this wiki/HOWTO? A list of updated requirements for this would also be much appreciated. I remember reading from before on this thread that Tiger was required (not Leopard) to get this compile to work. Is that still the case?

Comment by eswenson1, Jul 25, 2008

I agree. I used the instructions in this thread successfully months ago to build 1.1.X applications, but don't know how to reconcile this thread with the need to use MacOS-X 10.5 headers/libraries and components and libraries from the 2.0 runtime. Saurik's instructions at http://www.saurik.com/id/4 are very confusing as well, and make references to 1.1.4, although their appear to be references to 2.0 in his writeup, as well. This thread here was excellent months ago, but needs to be updated to make it easy to build 2.0 applications with current components.

Comment by Rikk_2...@hotmail.com, Jul 25, 2008

I'm very interested by script/tutorial to build toolchain for iphone 2.0 (and if possible for 1.X) with all detail for a "newbiz". All informations available are confused (Saurik, NerveGas?, flags in makefile ..).

Somebody have THE tutorial ?

Regards, Rikk

Comment by tony.shatalmic, Jul 28, 2008

i just did a new install of Ubuntu Gutsy as it is on the works list. I installed bison and flex and svn. I then did the get on llvm.

When I follow the first instructions to build llvm I get the famous error:

configure: error: C compiler cannot create executables

What do I do? The gcc --version replies with 4.1.3. Do I need an older version?

Comment by cmholm, Jul 29, 2008

With regards to my previous build error "/usr/local/bin/arm-apple-darwin-ld: /Volumes/macos2/iphone-dev/iphone-filesystem/usr/lib/libc.dylib load command 7 unknown cmd field", I tried rebuilding from scratch, with the same result.

I incorporated a couple of minor changes suggested by the comments into the process:

1) WAS: llvm-gcc-4.0-iphone/configure --enable-llvm=llvm-config --obj-root \ IS: llvm-gcc-4.0-iphone/configure --enable-llvm=$LLVMOBJDIR \

2) Tarring the entire ipod touch 2.0 file system on-board and scp'ing the archive to a Mac G4, avoiding the file-not-found errors I was getting when using CyberDuck? to scp it over piecemeal.

My environment: iPod Touch, update 2.0 Mac G4, OS 10.4.11 Xcode 2.4.1 (gcc 4.0.1) bison 1.28 flex 2.5.4

Everything sails through with only a few warnings, until the linker error at the last step. I suppose the published build process just isn't iphone/pod 2.0-compatible, but I lack enough information to decide where to go from here.

Comment by cmholm, Jul 29, 2008

I've been overlooking the admonition at the top of this page: Don't Post Your Bugs Here! My problem is addressed in issue #141. There isn't a direct solution, but there is the suggestion to try the build under Leopard using the build instructions at http://wikee.iphwn.org/howto:toolchain_on_leopard_aspen

Comment by spettak, Jul 29, 2008

I'm trying to compile the toolchain using the official iPhone SDK: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk but I get stuck at the last step when compiling the LLVM compiler:

/usr/local/bin/arm-apple-darwin-ld: /usr/local/share/iphone-filesystem/usr/lib/libc.dylib load command 7 unknown cmd field collect2: ld returned 1 exit status make2?: libgcc_s.dylib? Error 1 make1?: stmp-multilib? Error 2 make: all-gcc? Error 2

Any ideas?

Comment by alien.0101, Aug 04, 2008

Error during compilation of LLVM

make ENABLE_OPTIMIZED=1 make1?: Entering directory `/usr/local/coding/iphone/llvm-svn/lib/System' llvm1?: Compiling Alarm.cpp for Release build llvm1?: Compiling Disassembler.cpp for Release build llvm1?: Compiling DynamicLibrary?.cpp for Release build DynamicLibrary?.cpp: In static member function ‘static void llvm::sys::DynamicLibrary?::SearchForAddressOfSymbol?(const char)’: DynamicLibrary?.cpp:178: error: ‘strcmp’ was not declared in this scope DynamicLibrary?.cpp:179: error: ‘strcmp’ was not declared in this scope DynamicLibrary?.cpp:180: error: ‘strcmp’ was not declared in this scope make1?: /usr/local/coding/iphone/llvm-svn/lib/System/Release/DynamicLibrary.o? Error 1 make1?: Leaving directory `/usr/local/coding/iphone/llvm-svn/lib/System' make: all? Error 1

Any suggestions???

Comment by liuyuanjunjosen, Aug 23, 2008

There is one problem occured while I checkout the code. the detail is as following. How can i do???? A iphone-dev/llvm-gcc-4.0-iphone/libstdc++-v3/testsuite/22_locale/collate/com pare/char/wrapped_env.cc svn: Can't move 'iphone-dev/llvm-gcc-4.0-iphone/libstdc++-v3/testsuite/22_locale /collate/compare/.svn/tmp/entries' to 'iphone-dev/llvm-gcc-4.0-iphone/libstdc++- v3/testsuite/22_locale/collate/compare/.svn/entries': Permission denied

Josen@dme-liuyuanjun /iphone/toolchain $ svn checkout http://iphone-dev.googlecode.com/svn/trunk/ iphone-dev

Fetching external item into 'iphone-dev/llvm-gcc-4.0-iphone/libstdc++-v3' svn: Working copy 'iphone-dev/llvm-gcc-4.0-iphone/libstdc++-v3/testsuite/22_loca le/collate/compare' locked svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details)

Comment by Vanius.Zapalowski, Sep 02, 2008

My problems are in build odcctools. i'm on ubuntu 8.04 and the errors are :

/home/vanius/iphone/llvm-svn/iphone-dev/odcctools/include/mach/i386/thread_status.h:524:1: aviso: esta é a localização da definição prévia /home/vanius/iphone/llvm-svn/iphone-dev/odcctools/libstuff/ofile.c: Na função ‘ofile_map’: /home/vanius/iphone/llvm-svn/iphone-dev/odcctools/libstuff/ofile.c:747: aviso: dereferencing type-punned pointer will break strict-aliasing rules /home/vanius/iphone/llvm-svn/iphone-dev/odcctools/libstuff/ofile.c:3765:8: aviso: símbolo extra no fim da diretriz #endif No nivel superior: cc1: erro: unrecognized command line option "-Wno-long-double" make1?: ofile.o? Erro 1 make1?: Saindo do diretório `/home/vanius/iphone/llvm-svn/iphone-dev/build/odcctools/libstuff' make: libstuff? Erro 2

anyone can help me?

Comment by nicolas.alvarez, Sep 15, 2008

Are you all idiots or intentionally ignoring "IF THE TOOLCHAIN DOES NOT BUILD FOR YOU, DO NOT LEAVE A COMMENT HERE"?

Comment by kevinjbutler, Sep 28, 2008

This toolchain installation method appears to be obsolete, or less preferred.

Installing the toolchain on your iphone and using it to compile is dramatically easier to get up and running.

http://soi.kd6.us/2008/09/27/so-i-made-my-iphone-say-hello-world/

kb

Comment by sb.inapp, Oct 02, 2008

Hi I am using Ubuntu Hardy, and I was able to successfully install the toolchain (with a little bit of tweaking). However, I couldn't locate a Hello World program from this site, so I downloaded one from http://www.oreillynet.com/mac/blog/2007/08/a_simpler_hello_world_for_the.html which compiles fine, and produces an executable.

Not having an in-real-life iPhone, I'm unable to run my HelloWorld? application produced by the toolchain. There is an emulator in the iPhone SDK, but I don't have a Mac (Intel or other kind) either. Is anyone aware of an iPhone emulator that works on Linux or Windows? Thanks and good luck.

Sierra Bravo

Comment by armcomps...@yahoo.co.uk, Jan 14, 2009

I have got to the step :

make LLVM_VERSION_INFO=2.0-svn-iphone-dev-0.3-svn

and this is my error:

configure: error: cannot execute: /usr/local/bin/arm-apple-darwin-ld: check --with-ld or env. var. DEFAULT_LINKER make: configure-gcc? Error 1

I Installed llvm through ubuntu - (eaerly in the tutorial guide above, i chose to)sudo apt-get install llvm because compiling it myself lead to horrific problems and apt is quicker!

Somebody please help!

Comment by tobias.richards, Jan 22, 2009

Okay, I successfully compiled the toolchain. Unfortunately, I can't find any information on how to use it to compile stuff. How do I tell Ubuntu that configure and make ought to use the iphone tools instead of the i386 Ubuntu tools?

Comment by v1n...@live.com, Mar 04, 2009

The link to the decrypter for the ipsw software is broken

Comment by linuxaos, Mar 05, 2009

Hey you guys, I just created a script that automates the toolchain build on a MAC OSX box. It also has a very small helloworld program and Makefile to show how it's done.

Get it here: http://code.google.com/p/iphone-toolchain-automated-build/

Everything is tested on MAC OSX 10.5.6

Enjoy!

Comment by Chrischtian.Arnold, Mar 08, 2009

iphone-dev/build/llvm-gcc-4.0-iphone$ sudo make install /bin/bash ../../llvm-gcc-4.0-iphone/mkinstalldirs /usr/local /usr/local /bin/bash: line 4: cd: fixincludes: No such file or directory make: install-fixincludes? Fehler 1

What is going wrong?

System: Ubuntu 8.10

Comment by nico.caprioli, Mar 29, 2009

Hi have this problem: when I run last make (in /built/llvm-gcc-4.0-iphone) it return me with this error:

checking for dsymutil... no dsymutil is not available configure: error: You must specify absolute path to your LLVM tree with --enable-llvm=DIR make: configure-gcc? Error 1

What it mean? What is dsymutil?

Comment by v1n...@live.com, Apr 02, 2009

I was getting hell trying to extract the SDK files from the xcode dmg on Ubuntu 8.04, but I did some very precise googling and came up with some slightly related instructions on a Mac/Windows cross compiling site. "xar -xv -f MacOSX10.4.Universal.pkg" will extract the contents of the .pkg (might wanna do this into an empty folder as the files will be placed into the directory containing the xcode .dmg, then run "zcat Payload | cpio -id" in the directory containing the Payload file you just extracted. It got me moving, hope that helps someone.

Comment by v1n...@live.com, Apr 03, 2009

I just solved another one of my problems by resetting my environment variables (apparently they aren't permanent, so if you've closed your terminal you might need to reset them, LLVMOBJDIR needs to be set to the directory containing llvm-svn and HEAVENLY needs to be set to the directory containing your iPhone filesystem).

Comment by sirtoozee, Apr 08, 2009
Comment by sirtoozee, Apr 10, 2009

llvm-gcc-4.0-iphone/configure the iphone-filesystem scp from iphone 3g, then make, it thrown such issue:

libc.dylib load command 7 unknown cmd field

but redid with iphone-filesystem via http://george.insideiphone.com/wp-content/uploads/2008/01/iphone-filesystem.tar.bz2

it is ok except compile the UIKit or LayerKit? app.

so please play the helloworld console app via terminal _

Comment by sirtoozee, Apr 11, 2009

Issue 141 Comment 16 fixed the libc.dylib load issue

Comment by sirtoozee, Apr 19, 2009

easy way to build the toolchain for 3g directly:

apt-get install iphone-gcc apt-cache search toolchain

Comment by ted.vail, Apr 19, 2009

sirtoozee, against what version of the OS were those tools built, or what version of the OS is that bz2 file you linked? 2.0? 3.0 beta 2 or 3? Thanks!!

Comment by sirtoozee, Apr 19, 2009

ted.vail, please have a look at http://www.saurik.com/id/4

saurik is the active one who playing the toolchain for 3g, but what NightWatch? did was only suitable for old iphone;

bz2 file I linked is the old iphone file-system, i diff it with my iphone 3g, for example there is no /System/Library/Frameworks/LayerKit? any more...

so I am too tired to build the toolchain on my MacBook? with Tiger, instead, I apt-get install iphone-gcc and toolchain on my iphone 3g with the help of apt and cydia (see the "What Next?" section in the http://www.saurik.com/id/4);

PS: the old toolchain could compiled the console app, but I wanna GUI helloworld _

Comment by gchishti, Apr 21, 2009

I need to donwload llvn from http://llvm.org/releases/download.html. the link is not working. is there any alternate way to download llvm.

Comment by mtrpitufo, Apr 22, 2009

ForAddressOfSymbol?(const char)’: DynamicLibrary?.cpp:178: error: ‘strcmp’ was not declared in this scope DynamicLibrary?.cpp:179: error: ‘strcmp’ was not declared in this scope DynamicLibrary?.cpp:180: error: ‘strcmp’ was not declared in this scope make1?: /home/pitufo/dev/llvm-svn/lib/System/Release/DynamicLibrary.o? Erreur 1 make1?: quittant le répertoire « /home/pitufo/dev/llvm-svn/lib/System » make: all? Erreur 1

Comment by sirtoozee, Apr 25, 2009

Emm, I wanna try PyObjC http://www.saurik.com/id/5 to do the GUI stuff

Comment by 31337one, May 06, 2009

What is the difference between the instructions on this page and the ones over here: http://code.google.com/p/iphonedevonlinux/wiki/Installation

Comment by achim.bloch, Jun 23, 2009

THIS IS NOT A BUG REPORT Hi there I am trying to follow this step-by-step well documented method, as I am still on Tiger and as the iPhone SDK is only available for Leopard. When coming to the point: iPhone root filesystem, I am not sure of what I am to do: I have the "iPhone1,2_2.0.2_5C1_Restore.ipsw" file, I unzip it and obtain "iPhone1,2_2.0.2_5C1_Restore.ipsw.app". Is it this that is called the iphone-filesystem in this step? Thanks in advance Achim

Comment by c.aragones, Jul 24, 2009

I'm getting this error:

checking for arm-apple-darwin-gcc... //iphone-dev/build/llvm-gcc-4.0-iphone/gcc/xgcc -B//iphone-dev/build/llvm-gcc-4.0-iphone/gcc/ -mmacosx-version-min=10.1 -B/usr/local/arm-apple-darwin/bin/ -B/usr/local/arm-apple-darwin/lib/ -isystem /usr/local/arm-apple-darwin/include -isystem /usr/local/arm-apple-darwin/sys-include checking for suffix of object files... configure: error: cannot compute suffix of object files: cannot compile

some ideas?

Comment by dimitris254, Sep 01, 2009

On the "sudo make install" step, I got a error: llvm1?: Installing Release Archive Library /usr/local/lib/libLLVMSupport.a make1?: No rule to make target /Developer/iPhoneToolchain/llvm-svn/Release/bin/tblgen', needed by /Developer/iPhoneToolchain/llvm-svn/lib/VMCore/Release/Intrinsics.gen.tmp'. Stop. make: install? Error 1 Any ideas?

Comment by berlin.brown, Sep 02, 2009

I am trying to build the toolchain on windows. Anyone ever heard of the msgfmt command?

When I enter the command, it starts to compile. After about 30 minutes, I get to the error you see below. ./make-toolchain.sh /usr/bin/install -c mkheaders /usr/local/libexec/gcc/arm-apple-darwin9/4.2.1/install-tools/mkheaders make2?: Leaving directory `/cygdrive/c/projects/tools/home/iphone-2.0-toolchain/build/gcc-4.2-iphone/fixincludes' make2?: Entering directory `/cygdrive/c/projects/tools/home/iphone-2.0-toolchain/build/gcc-4.2-iphone/gcc' test -d po || mkdir po /cygdrive/c/downloads/mono/Mono-2.4/bin/msgfmt --statistics -o po/be.gmo /cygdrive/c/projects/tools/home/iphone-2.0-toolchain/src/gcc/gcc/po/be.po c:\downloads\mono\Mono-2.4\bin\msgfmt.exe: error while opening "/cygdrive/c/projects/tools/home/iphone-2.0-toolchain/src/gcc/gcc/po/be.po" for reading: No such file or directory make2?: po/be.gmo? Error 1 make2?: Leaving directory `/cygdrive/c/projects/tools/home/iphone-2.0-toolchain/build/gcc-4.2-iphone/gcc' make1?: install-gcc? Error 2 make1?: Leaving directory `/cygdrive/c/projects/tools/home/iphone-2.0-toolchain/build/gcc-4.2-iphone' make: install? Error 2

I also find it strange that msgfmt would be executed, from Mono?

test -d po || mkdir po checking whether getopt is declared... /cygdrive/c/downloads/mono/Mono-2.4/bin/msgfmt --statistics -o po/be.gmo /cygdrive/c/projects/tools/home/iphone-2.0-toolcshain/src/gcc/libcpp/po/be.po c:\downloads\mono\Mono-2.4\bin\msgfmt.exe: error while opening "/cygdrive/c/projects/tools/home/iphone-2.0-toolchain/src/gcc/libcpp/po/be.po" for reading: No such file or directory


Sign in to add a comment
Hosted by Google Code