|
Installation
Installation of the toolchain
Phase-Deploy Building the ToolchainThe toolchain version does not necessarily need to coincide with the running firmware on your target iPhone. For example, 2.2 software can run on a 2.1 iPhone and 2.1 software can run on a 2.2.1 iPhone and so on (this is a very general statement; software relying on private frameworks or certain version-specific features may require an exact version). You may also use any new version of the SDK to build older versions of the toolchain, for instance the 2.2.1 SDK can still be used to build the 2.1 toolchain (just change TOOLCHAIN_VERSION in the script). All that being said, the instructions below indicate how to build a toolchain specific to each recent major iPhone firmware version. Toolchain for firmware 3.0Before startingWe switched now to firmware 3.0. If you are interested in older firmwares see below. The firmware 3.0 support is very fresh. If you have some troubles please leave a comment or an issue. We are busy and don't have much time to maintain the toolchain.sh script. If you think you could help please drop a note. Checkout and get the filesFirst create a project directory and check out the latest copy of the toolchain builder. For Example: mkdir -p ~/Projects/iphone/ cd ~/Projects/iphone/toolchain svn checkout http://iphonedevonlinux.googlecode.com/svn/trunk/ ./ You will need to download the iPhone SDK 3.0 from Apple, which can be found here: http://developer.apple.com/iphone/ You can also choose to download the 3.0 or 3.0.1 firmware from Apple at this stage. If you do not, the script will download the firmware automatically (Firmare 3.0 iPhone(3G)). You can now copy the SDK and Firmware (if you have it) to the toolchain builder's directory: cd ~/Projects/iphone/toolchain mkdir -p files/firmware mv /path/to/iphone_sdk_3.0__leopard__9m2736__final.dmg files/ mv /path/to/iPhone1,2_3.0_7A341_Restore.ipsw files/firmware Packages needed to compile the toolchainBefore you start to build the firmware you need some packages installed on your system. Building the toolchain with gcc-4.2 on my debian amd64 failed. I use gcc-4.3. Here we provide a list of packages for Debian/Ubuntu apt-get install \ automake \ bison \ cpio \ flex \ g++ \ g++-4.3 \ g++-4.3-multilib \ gawk \ gcc-4.3 \ git-core \ gobjc-4.3 \ gzip \ libbz2-dev \ libcurl4-openssl-dev \ libssl-dev \ make \ mount \ subversion \ sudo \ tar \ unzip \ uuid \ uuid-dev \ wget \ xar \ zlib1g-dev \ If you are on 64 bit please install: apt-get install g++-4.3-multilib gcc-4.3-multilib gobjc-4.3-multilib Startup and buildNow the environment is set up, you can start the script with: chmod u+x toolchain.sh ./toolchain.sh all After all steps, the toolchain is in ./toolchain with the binaries in ./toolchain/pre/bin and the system in ./toolchain/sys/ After a rebuild you may get patch warnings/errors. Ignore them because the build tries to patch already patched files. With the newest version of the toolchain.sh script you can control the behaviour and the filesystem places of the toolchain file with environment vars: BUILD_DIR:
Build the binaries (gcc, otool etc.) in this dir.
Default: $TOOLCHAIN/bld
PREFIX:
Create the ./bin ./lib dir for the toolchain executables
under the prefix.
Default: $TOOLCHAIN/pre
SRC_DIR:
Store the sources (gcc etc.) in this dir.
Default: $TOOLCHAIN/src
SYS_DIR:
Put the toolchain sys files (the iphone root system) under this dir.
Default: $TOOLCHAIN/sys
example:
sudo BUILD_DIR="/tmp/bld" SRC_DIR="/tmp/src" PREFIX="/usr/local" SYS_DIR=/usr/local/iphone_sdk_3.0 ./toolchain.sh allToolchain for firmware 2.2 / 2.2.1The toolchain 2.2 is outdated. This is for historical reasons. First create a project directory and check out the latest copy of the toolchain builder. For Example: mkdir -p ~/Projects/iphone/ cd ~/Projects/iphone/toolchain svn checkout http://iphonedevonlinux.googlecode.com/svn/branches/2.2 ./ You will need to download the iPhone SDK 2.2.1 from Apple, which can be found here: http://developer.apple.com/iphone/ You can also choose to download the 2.2.1 firmware from Apple at this stage. If you do not, the script will download the firmware automatically. You can now copy the SDK and Firmware (if you have it) to the toolchain builder's directory: cd ~/Projects/iphone/toolchain mkdir -p files/firmware mv /path/to/iphone_sdk_2.2.1_file files/ mv /path/to/firmware2.2.1_file files/firmware Now the environment is set up, you can start the script with: chmod u+x toolchain.sh ./toolchain.sh all After all steps, the toolchain is in ./toolchain with the binaries in ./toolchain/pre/bin and the system in ./toolchain/sys/ Toolchain for firmware 2.1Support also exists for firmware 2.1. You can build it in much the same way as the instructions for 2.2 above, with the only variation being in the first command block: mkdir -p ~/Projects/iphone/ cd ~/Projects/iphone/toolchain svn checkout http://iphonedevonlinux.googlecode.com/svn/branches/2.1/ ./ Note: If you are supplying your own ipsw, it must be for firmware 2.1. However it is okay to use iPhone SDK 2.2, which can be downloaded from here: http://developer.apple.com/iphone/ as this still contains the required components. Testing the ToolchainIn the subversion repository is a directory called "apps" which contains a test application you can build and deploy for the iPhone. Regardless of whether you built a 2.1, 2.2 or 3.0 toolchain, the instructions for testing are the same. You will need an iPhone connected to your local network to do this. Navigate to the apps/HelloToolchain directory and run the following commands, noting that you must set "IP" to the address of your iPhone and change the path as appropriate: cd ~/Projects/iphone/apps/HelloToolchain IP=xxx.xxx.xxx.xxx PATH=../../toolchain/pre/bin/:$PATH make deploy After running the above commands successfully, your iPhone should respring and you should see a HelloToolchain icon on the home screen. Run it and it should display "HelloToolchain" on the screen on a white background. This should indicate that the toolchain has successfully compiled an application for your iPhone. Happy coding! Manual StepsThe instructions above recommend building the toolchain using the command: ./toolchain.sh all This command encompasses all stages of building the toolchain. If for any reason you need to repeat a part of the process or perform it in components, you may call the script in other ways. For example, the "all" action is equivalent to running: ./toolchain.sh headers ./toolchain.sh firmware ./toolchain.sh darwin_sources ./toolchain.sh build ./toolchain.sh clean A brief overview of the available actions and what they do, is available by running: ./toolchain.sh usage |
Hello, how i can install the package xar. I can't find it. Please help me!
somoro: what is your linux distribution?
My linux distrubtion is debian 4 r6.
Have you tried 'apt-get install xar'? I use ubuntu, which is based on debian, and it has such package. Also check your /etc/apt/sources.list
OK in which source is the package xar???
Does this work if one is using Cygwin as well?
Using Kubuntu 8.10 or similar:
If you get an error compiling dmg2img saying "Make sure you have libbz2 and libssl"
You need these packages:
sudo apt-get install zlib1g-dev sudo apt-get install libssl-dev sudo apt-get install libcurl4-openssl-dev
You may get much further after installing those packages.
Next you want:
sudo apt-get install gobjc sudo apt-get install g++
Thank you it works but where i can get code examples?
I think it would be nice if we could collect some open examples here. We only provide a simple HelloToolchainApp? (you should have seen it in the folder apps of the toolchain script).
I wrote a little introduction to an example from developer.apple.com (UICatalog) here: http://iphonedevlinux.wordpress.com/2009/02/23/how-to-compile-the-uicatalog-example-from-developerapplecom/. That example helped me a lot understanding the UI-elements.
Thanks this works great! The only issue I had on Ubuntu 8.10/bash was getting the HelloToolchain? project to work. Simply exporting IP=xxx.xxx.xxx.xxx and then running make deploy didn't work for me. I had to create a variable in the Makefile called IP. Once I did that the 'scp' and 'ssh' commands in the 'deploy' target worked.
CoreLocation? headers are missing after install. I copied them manually from the SDK dmg.
If added CoreLocation? to current trunk and branches/unstable. Thanks for your info.
Hi :) The script has worked perfectly up until the build part! (other than a failed mv earlier: mv: cannot move Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.1.sdk' to /home/matthew/Projects/iphone/toolchain/sdks/iPhoneOS2.2.1.sdk': Directory not empty , I'm not sure how important that is).
Output from ./toolchain.sh build ... Building cctools-iphone... Build progress logged to: toolchain/bld/cctools-iphone/make.log Build & install failed. Check make.log and install.log
make.log - nothing to be done for everything (I think I managed to get it to work by manually ./configure'ing and make'ing)
install.log - http://devhat.pastebin.com/f2a473227
Thanks in advance, Matt
Hello matthew3walker,
could you please give us some more information? Do you have some files in /home/matthew/Projects/iphone/toolchain/sdks/iPhoneOS2.2.1.sdk ? Did it compile if you tried it manually? Could you compile HelloToolchain? (see: Testing the toolchain above)? If I interpret the install.log you pasted at pastebin.com right compiling ar failed.
Regards, toelooper
Sorry, please ignore me. I did something stupid. I managed to get everything to compile by deleting the config.cache's which are in the repos (I think, it hasn't failed yet!). I submitted an issue :) Thanks for your wonderful tool! Matt.
Just thought i would add that this is a brilliant guide and is much simpler and easier than the other guides out there. Just a heads up, I have Ubuntu 8.10 on a HP Pavilion dv7 and i had to install git, gawk and xar. When i had done that it still didn't want to set up the environment so i installed a package called git-core which seemed to do the trick. Also i installed the packages 31337one suggested whilst i was downloading the firmware and that seemed to work also. Next i had ssh issues whereby i kept getting the message about the rsa key not being recognized. To overcome this i just deleted this file HomeFolder?/.ssh/known_hosts which allowed ssh to create a new one with the new key inside. Deployment was a bit buggy, i had to edit the makefile with the IP variable as louis_hi...@yahoo.com mentioned. So all in all this pretty much worked compiled fine and so did the UICatalog from the link above. The only small issue, no biggy, is the fact that i have to type in my password loads of times. Im not really a ssh or makefile expert but i wondered if there were any changes that i could do to this? Below ive posted the terminal output:
keegy@keegy-laptop:~/Projects/iphone/toolchain/apps/HelloToolchain?$ make deploy arm-apple-darwin9-gcc -c src/HelloToolchain?.m -o HelloToolchain?.o arm-apple-darwin9-gcc -lobjc -bind_at_load -framework Foundation -framework CoreFoundation? -framework UIKit -w -o HelloToolchain? HelloToolchain?.o root@192.168.2.246's password: sh: line 0: cd: /Applications/HelloToolchain?.app: No such file or directory not found root@192.168.2.246's password: HelloToolchain? 100% 61 0.1KB/s 00:00 icon.png 100% 1073 1.1KB/s 00:00 Info.plist 100% 746 0.7KB/s 00:00 HelloToolchain? 100% 14KB 13.6KB/s 00:00 root@192.168.2.246's password: keegy@keegy-laptop:~/Projects/iphone/toolchain/apps/HelloToolchain?$ make deploy arm-apple-darwin9-gcc -c src/HelloToolchain?.m -o HelloToolchain?.o arm-apple-darwin9-gcc -lobjc -bind_at_load -framework Foundation -framework CoreFoundation? -framework UIKit -w -o HelloToolchain? HelloToolchain?.o root@192.168.2.246's password: sh: line 0: cd: /Applications/HelloToolchain?.app: No such file or directory not found root@192.168.2.246's password: HelloToolchain? 100% 61 0.1KB/s 00:00 icon.png 100% 1073 1.1KB/s 00:00 Info.plist 100% 746 0.7KB/s 00:00 HelloToolchain? 100% 14KB 13.6KB/s 00:00 root@192.168.2.246's password: keegy@keegy-laptop:~/Projects/iphone/toolchain/apps/HelloToolchain?$
thanks, Kevin
To those having issues with the IP or PATH variables. You did copy/paste the command from the guide? It is strange that it did not work for you. Anyways, glad you got it working and putting the variables into the makefile will actually make it easier in the future since you won't have to specify it every time. Good luck and I hope to see some more examples :)
For me, the sample application installed itself in /Applications, but didn't show up on the springboard.
Apparently (this is according to some other webpage) because my iPhone is firmware 2.2.1, "killall SpringBoard?" is not enough - the Springboard caches application data so you must rebuild the cache.
If you have BossPrefs? installed you can do that by running /Applications/BossPrefs?.app/Respring. Surely there's some way to do it without third-party apps... anyone?
Hints for Ubuntu (probably apply to other Debian-based distros also) -- run the following before running the toolchain script:
sudo apt-get install git git-core gobjc
The script will inform you that you need 'git'. There's a package called git, but the 'git' application itself is located in another package called 'git-core'. Install both.
Additionally, you need the GNU Objective-C compiler installed, package 'gobjc'. The script won't inform you of this.
Otherwise the script is great, the whole process is painless, and this is the only one of three different methods I've tried that actually completes successfully and gives me a working build environment! Many thanks to the developer!
This is an awesome script... I did find a problem though in the firmware decryption key download. The web page link needs updating for the 2.x firmware. It's located here now:
http://www.theiphonewiki.com/wiki/index.php?title=VFDecrypt_Keys:_2.x
FYI, I updated the link in the script and it worked.
Another helpful hint...
On 64-bit systems you must install the 32-bit gcc...this will clear up any build problems with the scripts.
# apt-get install gcc-multilib
link: http://code.google.com/p/iphone-dev/issues/detail?id=14
Running the toolchain, it failed when mounting the decrypted image. It needed -t hfsplus added to the sudo mount line.
Had to change: IPHONEWIKI_KEY_URL="http://www.theiphonewiki.com/wiki/index.php?title=VFDecrypt_Keys" to: IPHONEWIKI_KEY_URL="http://www.theiphonewiki.com/wiki/index.php?title=VFDecrypt_Keys:_2.x"
In order for the script to find my 2.x decrypt key. Should set this URL based on first number of FW_PRODUCT_VERSION instead.
Built the toolchain on AMD64 (Debian), using gcc-multilib.
With firmware 2.2.1, the test application HelloToolchain? will only show up after executing the following (not part of build deploy script):
If you do not want to type your password every time you deploy, try this: http://www.twiphone.com/2008/08/07/how-to-login-into-your-iphone-via-ssh-with-no-password-but-with-key-authentification/
i successfully compiled the chain and the hellotoolchain sample runs on my ipod touch. now i am trying to make an opengles app, but it cannot find the <OpenGLES/gl.h> include... are there any further steps to make this work? where is e.g. the #import <UIKit/UIFont.h> and why does it work, but no opengles? greets
console output: Building cctools-iphone... Build progress logged to: toolchain/bld/cctools-iphone/make.log Build & install failed. Check make.log and install.log I getting too this message can anyone tell what should I do ?
Also modified IPHONEWIKI_KEY_URL="http://www.theiphonewiki.com/wiki/index.php?title=VFDecrypt_Keys:_2.x" in the script with success.
For the list of files to download from "darwin-tools.list", here is a list of alternative URLs that appear to be the same however do not require an Apple ID to download.
http://www.opensource.apple.com/tarballs/cctools/cctools-667.8.0.tar.gz
http://www.opensource.apple.com/tarballs/libsecurity_authorization/libsecurity_authorization-32564.tar.gz
http://www.opensource.apple.com/tarballs/libsecurity_cdsa_client/libsecurity_cdsa_client-32432.tar.gz
http://www.opensource.apple.com/tarballs/libsecurity_cdsa_utilities/libsecurity_cdsa_utilities-33506.tar.gz
http://www.opensource.apple.com/tarballs/libsecurity_cms/libsecurity_cms-32521.tar.gz
http://www.opensource.apple.com/tarballs/libsecurity_codesigning/libsecurity_codesigning-33803.tar.gz
http://www.opensource.apple.com/tarballs/libsecurity_cssm/libsecurity_cssm-32993.tar.gz
http://www.opensource.apple.com/tarballs/libsecurity_keychain/libsecurity_keychain-34101.tar.gz
http://www.opensource.apple.com/tarballs/libsecurity_mds/libsecurity_mds-32820.tar.gz
http://www.opensource.apple.com/tarballs/libsecurity_ssl/libsecurity_ssl-32463.tar.gz
http://www.opensource.apple.com/tarballs/libsecurity_utilities/libsecurity_utilities-32820.tar.gz
http://www.opensource.apple.com/tarballs/libsecurityd/libsecurityd-33470.tar.gz
http://www.opensource.apple.com/tarballs/DiskArbitration/DiskArbitration-183.tar.gz
http://www.opensource.apple.com/tarballs/IOKitUser/IOKitUser-388.2.1.tar.gz
http://www.opensource.apple.com/tarballs/IOGraphics/IOGraphics-193.2.tar.gz
http://www.opensource.apple.com/tarballs/IOHIDFamily/IOHIDFamily-258.3.tar.gz
http://www.opensource.apple.com/tarballs/IOStorageFamily/IOStorageFamily-88.tar.gz
http://www.opensource.apple.com/tarballs/IOCDStorageFamily/IOCDStorageFamily-39.tar.gz
http://www.opensource.apple.com/tarballs/IODVDStorageFamily/IODVDStorageFamily-26.tar.gz
http://www.opensource.apple.com/tarballs/WebCore/WebCore-351.9.tar.gz
http://www.opensource.apple.com/tarballs/CF/CF-476.14.tar.gz
http://www.opensource.apple.com/tarballs/configd/configd-210.tar.gz
http://www.opensource.apple.com/tarballs/xnu/xnu-1228.7.58.tar.gz
http://www.opensource.apple.com/tarballs/xnu/xnu-1228.3.13.tar.gz
http://www.opensource.apple.com/tarballs/Libc/Libc-498.tar.gz
http://www.opensource.apple.com/tarballs/launchd/launchd-258.1.tar.gz
http://www.opensource.apple.com/tarballs/DirectoryService/DirectoryService-514.23.tar.gz
http://www.opensource.apple.com/tarballs/JavaScriptCore/JavaScriptCore-466.1.tar.gz
Hey,
Is OpenGLES not installed with this script. It seems to be a pre-req for using QuartzCore? which is where CoreAnimation? lives.
Does anyone have any info on how to get QuartzCore? or CoreAnimation? to work?
Kevin kboylo(a--t)hotmail.com
hi, would you like to update this toolchain to IPHONE FW3.0? I really need it
hi, i too need toolchain for 3.0
This tutorial also works if you want to develop for FW3.0. But of course, you will only be restricted to the 2.2 API..
um... it cant find the decrypter file for the 2.2.1 firmware. help?
Worked perfectly for 2.1! I just had to change the following line in toolchain.sh:
IPHONEWIKI_KEY_URL="http://www.theiphonewiki.com/wiki/index.php?title=VFDecrypt_Keys:_2.x"
I had to append :_2.x to the URL.
Thank you very much for the hard work!
The script doesn't install the OpenGL ES headers, as others pointed out. Just adding something like
# OpenGLES echo "OpenGLES" mkdir -p OpenGLES cp -R -pf "${IPHONE_SDK_LIBS}"/OpenGLES.framework/Headers/* OpenGLES... somewhere in the toolchain_build function should take care of it.
in case you get this error: Make sure you have libbz2 and libssl available on your system
add: sudo apt-get install libbz2-dev
works a treat on ubuntu using the 3.0SDK and 3.0 3GS firmware.
Are there any tools or tutorials for porting unix commandline tools to the iPhone.
i imagine i need to get ./configure to use the toolchain instead of the native ubuntu tools, any tips?
thanks
Does anyone have a direct link to the iphone 3.0 SDK.
I have tried http://developer.apple.com/iphone/ which only seems to allow access to the 3.1 SDK.
Unfortunately this does not appear to work with the current toolchain.sh script
try this:
http://iphonesdkdev.blogspot.com/2009/06/use-xcode-312-to-build-sdk-30-app-to-30.html
Yep! It's worked!
Just wanted to say thank you! It is about time an up-to-date tool-chain was released for us non-mac users! :-) If you need any help with the 3.1.2 tool-chain please tell me as I am looking forward to it and hope you are still working on it!
Thanks again!!
Hi, I'm trying to build the toolchain for the 3.1.2 SDK with the 3.1 firmware, currently at the "Building gcc-4.2-iphone..." stage. Here are the modifications I made to toolchain.sh so far (in diff format) :
28c28 < TOOLCHAIN_VERSION="3.0" --- > TOOLCHAIN_VERSION="3.1.2" 124c124 < IPHONE_SDK="iphone_sdk_*_final.dmg" --- > IPHONE_SDK="iphone_sdk_*.dmg" 202c202 < if ! ${TOOLS_DIR}/vfdecrypt -i $1 -o $TMP_DECRYPTED -k $3 &> /dev/null; then --- > if ! ${TOOLS_DIR}/vfdecrypt -i $1 -o $TMP_DECRYPTED -k B9CD10DD88AB615C1963E8AA04950B12DD64E0E5B11EA63C79A02AF6DB62334C710D21DA &> /dev/null; then 354d353 < if [ "${TOOLCHAIN_VERSION}" == "3.0" ] ; then 356,360d354 < elif [[ "`vercmp $SDK_VERSION $TOOLCHAIN_VERSION`" == "newer" ]]; then < PACKAGE="iPhoneSDK`echo $TOOLCHAIN_VERSION | sed 's/\./_/g' `.pkg" < else < PACKAGE="iPhoneSDKHeadersAndLibs.pkg" < fi 415a410,411 > FW_FILE="/home/frederic/Projects/iphone/files/firmware/iPhone2,1_3.1_7C144_Restore.ipsw" >Comment by frederic...@free.fr, Oct 18 (2 days ago) Hi, I'm trying to build the toolchain for the 3.1.2 SDK with the 3.1 firmware, currently at the "Building gcc-4.2-iphone..." stage. Here are the modifications I made to toolchain.sh so far (in diff format) : 28c28 < TOOLCHAIN_VERSION="3.0" --- > TOOLCHAIN_VERSION="3.1.2" 124c124 < IPHONE_SDK="iphone_sdk_*_final.dmg" --- > IPHONE_SDK="iphone_sdk_*.dmg" 202c202 < if ! ${TOOLS_DIR}/vfdecrypt -i $1 -o $TMP_DECRYPTED -k $3 &> /dev/null; then --- > if ! ${TOOLS_DIR}/vfdecrypt -i $1 -o $TMP_DECRYPTED -k B9CD10DD88AB615C1963E8AA04950B12DD64E0E5B11EA63C79A02AF6DB62334C710D21DA &> /dev/null; then 354d353 < if [ "${TOOLCHAIN_VERSION}" == "3.0" ] ; then 356,360d354 < elif [[ "`vercmp $SDK_VERSION $TOOLCHAIN_VERSION`" == "newer" ]]; then < PACKAGE="iPhoneSDK`echo $TOOLCHAIN_VERSION | sed 's/\./_/g' `.pkg" < else < PACKAGE="iPhoneSDKHeadersAndLibs.pkg" < fi 415a410,411 > FW_FILE="/home/frederic/Projects/iphone/files/firmware/iPhone2,1_3.1_7C144_Restore.ipsw" >I tried with the 3.12 firmware, and changed this:
if ! ${TOOLS_DIR}/vfdecrypt -i $1 -o $TMP_DECRYPTED -k a8a886d56011d2d98b190d0a498f6fcac719467047639cd601fd53a4a1d93c24e1b2ddc6 &> /dev/null; thenhi , it reports error while trying make. the error msg logged into make.log:
I am try to build the toolchain for the 3.1.2 SDK with the 3.1.2 firmware, and it happens at the "Configuring gcc-4.2-iphone..." stage. Following is my pc:
frederic:
I believe the toolchain version should be rounded to 3.1 instead of putting in 3.1.2. I haven't tested this though.
I am experiencing the same problem as kvnkong. When compiling gcc-4.2-iphone I get the following error.
Here is some information about my environment:
Thanks!
Reported an issue: http://code.google.com/p/iphonedevonlinux/issues/detail?id=23
The MediaPlayer? headers aren't copied over from the toolchain adding MediaPlayer? to the for loop on line 745 should fix :)
I'm getting some weird behavior here. I got the HelloToolchain? application to install and run perfectly, but i cannot get any other to run normally, even not modyfing any code. (i.e HelloToolchain? renamed to HelloToolchain2?, changed in plist, changed object called in main(), etc etc).
The app compiles, links properly and appears in springboard, but it closes as soon as i open it. Something insteresting is that if i open the App over ssh on my cygwin console, and then open it on the phone, it will open properly and even toss the stdout to my cygwin console, which is something really useful. But i still don't know why the app doesn't run normally :S. Any tips with this?
fer662, fake codesign the app.
get LDID from cydia, then in morbileterminal, cd /(exectuabledir)/, ldid -S executable
-S = capital.
NVM, i got it working, somehow my apps were uploading with the wrong permissions, i just added a chmod in my makefile and my apps started appearing fine on springboard and loading :). How do people usually debug this stuff? I have been using the legit SDK at work since it was released and even if xCode is really crappy and crashes all the time it helps a bit to have a debugger. Or will printf's have to suffice?
Hi I just finished building the toolchain for the 3.1.2 SDK, and I deployed HelloToolchain?? :) this is my diff if anyone's interested:
28c28 < TOOLCHAIN_VERSION="3.1.2" --- > TOOLCHAIN_VERSION="3.0" 124c124 < IPHONE_SDK="iphone_sdk*.dmg" --- > IPHONE_SDK="iphone_sdk_*_final.dmg" 354c354 < if [ "${TOOLCHAIN_VERSION}" == "3.1.2" ] ; then --- > if [ "${TOOLCHAIN_VERSION}" == "3.0" ] ; then 521,531c521,529 < #DECRYPTION_KEY_SYSTEM=$( wget --quiet -O - $IPHONEWIKI_KEY_URL | awk '\ < # BEGIN { IGNORECASE = 1; } < # /name="3.0_.28Build_7A341.29"/ { found_3_0 = 1; } < # /name="Root_Filesystem"/ && found_3_0 { found_root = 1; } < # /title="'${HW_BOARD_CONFIG}'"/ && found_root { found_phone = 1; } < # /.*<pre>.*$/ && found_phone { < # sub(/.*<pre>/,"", $0); < # print toupper($0); exit; } < # ') < < DECRYPTION_KEY_SYSTEM="a8a886d56011d2d98b190d0a498f6fcac719467047639cd601fd53a4a1d93c24e1b2ddc6" --- > DECRYPTION_KEY_SYSTEM=$( wget --quiet -O - $IPHONEWIKI_KEY_URL | awk '\ > BEGIN { IGNORECASE = 1; } > /name="3.0_.28Build_7A341.29"/ { found_3_0 = 1; } > /name="Root_Filesystem"/ && found_3_0 { found_root = 1; } > /title="'${HW_BOARD_CONFIG}'"/ && found_root { found_phone = 1; } > /.*<pre>.*$/ && found_phone { > sub(/.*<pre>/,"", $0); > print toupper($0); exit; } > ')Freelance.c,
Which gcc version are you using? I am using 4.3 with Ubuntu 9.10 and 3.1.2 SDK and 3.1.2 FW and I still get the 'library not found for -lc' error. I've also tried gcc 4.2 and same result.
eddy
gcc (Ubuntu 4.3.2-1ubuntu12) 4.3.2
But I still had to copy libc.dylib to make it work because it's a symlink to libSystem.B.dylib
cp sdks/iPhoneOS3.1.2.sdk/usr/lib/libSystem.B.dylib toolchain/bld/gcc-4.2-iphone/gcc/libc.dylib
Thanks! That did it. I also found that if I place libc.dylib in toolchain/bld/sys/usr/lib, it works too.
Thanks to all the instructions listed above, I have my toolchain successfully compiled. However, when I tried to "make" in apps/HelloWorldFirst? I got this error:
>$ make >path/to/arm-apple-darwin9-g++ -I/path/to/toolchain/toolchain/sys/usr/include -lobjc -bind_at_load -w HelloWorldFirst?.c -o HelloWorldFirst? >ld: library not found for -lobjc >collect2: ld returned 1 exit status >make: HelloWorldFirst? Error 1
I googled and learnt that is caused by library of objective c (I am a newbie to objective c), but since everybody else seems to have proceeded smoothly, I am wondering the reason of this error as well as the solution to this problem. Any suggestion is appreciated. _
sorry, I forget my system info. OS: Fedora 10 GCC: gcc version 4.3.2 20081105 (Red Hat 4.3.2-7) (GCC)
lerrytang
Judging from this 'path/to/arm-apple-darwin9-g++ -I/path/to/toolchain/toolchain/sys/usr/include' it looks like you haven't changed the paths to where the sdk is located. Open up up the Makefile and change the CC variable to the location of the toolchain. For example on my setup i have copied the sdk to /usr/local/iphone so my path would be '/usr/local/iphone/pre/bin/arm-apple-darwin9-g++'. Alternatively you could add the toolchain path to the $PATH environment variable and leave the location in the Makefile as just 'arm-apple-darwin9-g++', doing this way would mean you do not have to modify the Makefile for each new project.
Thanks for the reply. I changed the path to the compiler, sorry for the ambiguity in my post. I rebuilt the environment and it magically worked correctly. Guess it was some error with library copying.
Hi all, I've successfully built "HelloToolChain?" and deployed it on my iphone 3.1.2. But it quits almost immediately, any suggestion? Thanks.
Plus, "HelloWorldFirst?" is also successfully built and can be run in MobileTerminal?, but the same problem occurs when it is deployed in /Application.
Hi all, i have a question when i ./toolchain.sh all, i get a error that ERROR: dmg image is corrupted In order to extract 018-5301-002.dmg, I am going to mount it. This needs to be done as root. mount: wrong fs type, bad option, bad superblock on /dev/loop0,
Failed to mount 018-5301-002.dmg. any suggeston? Thanks!!!
I recently upgraded my system to Ubuntu 9.10 and now the toolchain wont compile. The cctools fails with something to do with ld64. Seeing as my system is 32 bit i removed --enable-ld64 from the config and got rid of the lines making ld64 the default linker. Now cctools compiles but iphone-gcc complains that it can't find the linker. I don't know what to do i didn't have any of these problems when i was on 9.04.
Now i fixed the problem of it not finding the linker but now im getting problems with libgcc_s.dylib.
error building HelloToolchain?. it complains about objc library?
I am having the exact same linker error as knightrage in the previous post.
The toolchain built perfectly, but I just cannot get past this error.
I had added the following:
to the LDFLAGS in the makefile but it made no difference.
I have the same problem as abbotdeng mentioned above
Hi all, i have a question when i ./toolchain.sh all, i get a error that ERROR: dmg image is corrupted In order to extract 018-5301-002.dmg, I am going to mount it. This needs to be done as root. mount: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error (could this be the IDE device where you in fact use ide-scsi so that sr0 or sda or so is needed?) In some cases useful info is found in syslog - try dmesg | tail or so
Failed to mount 018-5301-002.dmg. any suggeston? Thanks!!!
The first time I built the toolchain I had the same problem with the DMG. Which version did you download?
I got 'iphone_sdk_3.1.2_with_xcode_3.1.4leopard9m2809.dmg' from apple developper network. The size of file is 2860745kb
Sorry, the correct is 'iPhone1,1_3.1.2_7D11_Restore.ipsw' with 246598 bytes long.
Sorry, the correct is 'iPhone1,1_3.1.2_7D11_Restore.ipsw' with 246598 bytes long.
I'm trying to follow the script exactly. I downloaded
iphone_sdk_3.0leopard9m2736final.dmg iPhone1,2_3.0_7A341_Restore.ipsw
And placed them where the script expected them. However, when it runs, the script complains:
Archive successfully decompressed as /home/zombie/Projects/iphone/toolchain/tmp/iphone_sdk_3.0leopard9m2736final.img
You should be able to mount the image root? by:
modprobe hfsplus mount -t hfsplus -o loop /home/zombie/Projects/iphone/toolchain/tmp/iphone_sdk_3.0leopard9m2736final.img /mnt
In order to extract iphone_sdk_3.0leopard9m2736final.dmg, I am going to mount it. This needs to be done as root. SDK is version 3.0.1 We are trying to build toolchain 3.1.2 but this SDK is 3.0.1. Please download the latest SDK here: http://developer.apple.com/iphone/ Unmounting...
I can't understand why it's trying to build a 3.1.2 SDK, (unless the script is perhaps set for 3.1.2). However, I also can't find the 3.1.2 SDK files (except for the ones including xcode on the apple site, and they don't work).
Any help will be appreciated.
With some fiddling, I'm making progress. I changed the toolchain.sh so that the cctools configure explicitly says --disable-ld64. However, this only gets me to the gcc compile, which fails with no clear logging. Here's the error:
make[2]: Leaving directory /home/zombie/Projects/iphone/toolchain/toolchain/bld/gcc-4.2-iphone/libiberty' make[1]: Leaving directory /home/zombie/Projects/iphone/toolchain/toolchain/bld/gcc-4.2-iphone' make: `all? Error 2
If you know how to get past this point, I'd like to know! Thanks!
I met the samll problem ,and i fixed it successfully!
go to see that is the file (named toolchain/tmp/018-5344-086.dmg.decrypted.img) size is 0!!! if that, the decryption job is not work successfully. it's maybe a bug of this script. to fix it , just go to this link: http://www.theiphonewiki.com/wiki/index.php?title=VFDecrypt_Keys:_3.x or http://www.theiphonewiki.com/wiki/index.php?title=VFDecrypt_Keys:_2.x find out the compatible key for your firmware. and replace it into script file. it will work fine! Sorry for my poor English :p by HunterX
I have the same problem as abbotdeng mentioned above
Comment by abbotdeng, Nov 30, 2009
Hi all, i have a question when i ./toolchain.sh all, i get a error that ERROR: dmg image is corrupted In order to extract 018-5301-002.dmg, I am going to mount it. This needs to be done as root. mount: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error (could this be the IDE device where you in fact use ide-scsi so that sr0 or sda or so is needed?) In some cases useful info is found in syslog - try dmesg | tail or so
Failed to mount 018-5301-002.dmg. any suggeston? Thanks!!!
Thanks. :)
I managed to get the toolchain to successfully build and install HelloToolchain?, and it runs on my iPhone.
I built the toolchain using the latest version of the SDK and 3.1.2 firmware. The problem I was having was missing libraries and frameworks. According to this, as of firmware version 3.1 most of the libraries have been moved into a central cache file on the iPhone, so you can't use the firmware to get the libraries anymore. The libraries are still available in the Apple SDK, however.
My solution was to extract usr/lib and System/Library/Frameworks from Apple's 3.1.2 SDK. I then replaced the directories as created by the build process with the extracted ones. The example now compiles, links, and runs.
Hopefully this will help someone else who is struggling.
Hi brian...
Can you (or anyone) give me some details of you build environment where the toolchain builds correctly?
I'm on Ubuntu 9.10, using gcc-4.4.1 and gcc-4.3.1 without luck. The build dies very mysteriously in the gcc-4.2 build phase. No logging other than the make error2? message.
thanks
Hi icebattle,
I'm running Debian 5.0.3 on a P4 system. gcc --version: gcc (Debian 4.3.2-1.1) 4.3.2.
I keep getting this error:
ERROR: dmg image is corrupted In order to extract 018-6029-014.dmg, I am going to mount it. This needs to be done as root.
Any way I can fix this? Im using firmware 3.1.2
Hey guys,
When trying to build HelloToolchain???.app with iPhone OS 3.1.2. If you were originally getting errors about 'ld: library not found -lobjc' or 'ld: framework not found Foundation', like this:
Here's the solution I used (thanks brian.cr...):
Build the toolchain
In ~/Projects/iphone/toolchain/toolchain/sys, rename folder System to System2
In ~/Projects/iphone/toolchain/toolchain/sys/usr, rename folder lib to lib2
Copy folder ~/Projects/iphone/toolchain/sdks/iPhoneOS3.1.2.sdk/System to ~/Projects/iphone/toolchain/toolchain/sys
Copy folder ~/Projects/iphone/toolchain/sdks/iPhoneOS3.1.2.sdk/usr/lib to ~/Projects/iphone/toolchain/toolchain/sys/usr
Try to build HelloToolchain? again using instructions on this page (above).
Hope that helps. This was the only error I encountered using the toolchain.sh script
I'm new to Open iPhone dev, but what's the difference with the iphone-dev project toolchain ?
Hey y'all
Still trying. cctools builds fine, but I noticed during the configure phase for the gcc build the following (in make.log):
Anyone seen this? Perhaps a missing symlink?
will1234 - how did you solve the dylib issue? I seem to be having the same problem now...
thanks
For everyone getting the 'dmg file is corrupted' error do the following:
Go to http://www.theiphonewiki.com/wiki/index.php?title=Firmware and select the firmware you downloaded. For example Northstar 7D11.
Copy the VFDecrypt from the root file system (quite a big string) and place it in your toolchain.sh.
Search for $DECRYPTION_KEY_SYSTEM and change this to the one you've manually got from the wiki.
icebattle how did you get past this:
make2?: Leaving directory /home/zombie/Projects/iphone/toolchain/toolchain/bld/gcc-4.2-iphone/libiberty' make1?: Leaving directory /home/zombie/Projects/iphone/toolchain/toolchain/bld/gcc-4.2-iphone' make: `all? Error 2
Hi machiel06
I noticed that the configure phase for the gcc-4.2 build was coughing up the following error:
and when I checked I saw that arm-apple-darwin9-ld was a symlink to the 64bit linker. However, the 64 bit linker wasn't being built because I had changed the cctools build to disable-ld64.
It looks liek the toolchain really wants the 64bit stuff.
I have since cleaned everything up, and now I'm trying to figure out a way to get the cctools build to complete without disabling ld64.
Hope this helps. I'd be interested to hear any input you may have.
I was able to build the whole toolchain on a Debian machine. I used VirtualBox? to achieve this.
I could compile it without modifieng the toolchain.sh.
Currently I am trying to export it to my Ubuntu, I hope it will work ;o.
You'll hear from me soon.
Hmm, the exporting to Ubuntu didn't work, or I just do not have enough linux knowledge to do it.
Too bad it builds like it should on Debian, and it doesn't on Ubuntu.
@machiel06 : if you're stuck into 'dmg file is corrupted error', before using your workaround (which works) be sure that your $DEVICE match your firmware file. By default, it's "iPhone_3G" and I was supplying a 3GS's firmware.
@machiel06: I successfully compiled on latest Ubuntu. Be sure to use g++-4.3/gcc-4.3 instead of default one (4.4):
> sudo update-alternatives --quiet --install /usr/bin/g++ g++ /usr/bin/g++-4.3 50 --slave /usr/share/man/man1/g++.1.gz g++.1.gz /usr/share/man/man1/g++-4.3.1.gz
> sudo update-alternatives --quiet --install /usr/bin/gcc gcc /usr/bin/gcc-4.3 50 --slave /usr/share/man/man1/gcc.1.gz gcc.1.gz /usr/share/man/man1/gcc-4.3.1.gz
Thanks nono240, that did the job :)
OK, so I'm able to build apps. At last.
Having struggled to build the toolchain for a few weeks, here's the only solution that worked for me. I'm running Ubuntu 9.10
1. Install VirtualBox?
2. Create an Ubuntu 9.04 virtual machine. DO NOT even try with 9.10. You will be sad.
3. Follow the steps at the top of this page to build the toolchain - I based my build on the 3.1.2 SDK - this required the iphone_sdk_3.1.2_with_xcode_3.1.4leopard9m2809.dmg SDK and iPhone1,2_3.1.2_7D11_Restore.ipsw firmware image.
4. Before attempting to build an app, follow these instructions (thanks to knightrage and others)
5. Now you are ready to build apps.
cheers
Hi, I'm getting this error while buildung the HelloToolchain? App
arm-apple-darwin9-gcc -c src/HelloToolchain?.m -o HelloToolchain?.o arm-apple-darwin9-gcc -lobjc -bind_at_load -framework Foundation -framework CoreFoundation? -framework UIKit -w -o HelloToolchain? HelloToolchain?.o ld: library not found for -lobjc collect2: ld gab 1 als Ende-Status zurück make: HelloToolchain? Fehler 1
any idea to past this? OS is Ubuntu using g++-4.3/gcc-4.3
I have tried all the methods above for getting past the "ERROR: dmg image is corrupted" I replaced the key with the VFDecrypt for 3GS. And replaced the $DEVICE with the iPhone_3GS.
Im using all 3.1.2 firmware and sdk. Can someone please help. It also ends with Failed to mount 018-6029-014.dmg. dmesg says "FAT: bogus number of reserved sectors {{{ VFS: Can't find a valid FAT filesystem on dev loop0. GFS2: gfs2 mount does not exist hfs: unable to find HFS+ superblock hfs: unable to find HFS+ superblock" }}}
@Marchhare22 Just add DECRYPTION_KEY_SYSTEM="47D76295817F74953F8E557B4917FE2201E9778A9900E43FBF311A83F176FE521B996A4B" in the toolchain.sh at the beginning works for me fine ;)
Hi all
Another thing - don't try top build in a VMWare VM on Windows. I tried, and had problems mounting the hfs partition - it looked like it was working, but it wasn't. It was one of the sources of my dmg issues.
Thanks to icebattle for the comment from Dec 25. Those instructions finally got my toolchain built. I have a couple clarifications to save other people some of the headaches I ran into.
1) VirtualBox?? running Ubuntu 9.04 must be the 32 bit version (ubuntu-9.04-desktop-i386.iso). The 64 bit .iso failed to compile the toolchain.
2) In VirtualBox??, the default hard drive size of 8GB is way too small and is not easily changed. Choose at least 20GB to be safe.
3) After running "toolchain.sh all", choose not to clean up. If you do, the sdk directories to use in the renaming and copying instructions will be missing. Running "toolchain.sh headers" will recreate them.
That's it. Thanks again.
@Dragon476 Thanks that worked. It's now built. But now I get a different error.
When I try In ~/Projects/iphone/toolchain/toolchain/sys, rename folder System to System2
In ~/Projects/iphone/toolchain/toolchain/sys/usr, rename folder lib to lib2
Copy folder ~/Projects/iphone/toolchain/sdks/iPhoneOS3.1.2.sdk/System to ~/Projects/iphone/toolchain/toolchain/sys
Copy folder ~/Projects/iphone/toolchain/sdks/iPhoneOS3.1.2.sdk/usr/lib to ~/Projects/iphone/toolchain/toolchain/sys/usr
I do not have a ~/Projects/iphone/toolchain/sdks/iPhoneOS3.1.2.sdk/
specifically /sdks
@Marchhare22 when you build the toolchain, it will ask if the source should deleted , just say no. /sdks will then exist
@Dragon476 I do say no. But those folders do not exist. I even try a slocate / whereis after a updatedb and it has no folders anywhere that have that name.
Anyone have a fix for:
ld: library not found for -lobjc
compiled on Debian/sid a 3.1.2 toolchain : had to add a couple of #include <stdio.h> and #include <stdlib.h> to get through the g++ errors concerning sprintf and fopen (one of the files is toolchain/src/cctools/ld64/src/Options.cpp, the other I have forgotten) (using g++ (Debian 4.4.2-8) 4.4.2).
Works nicely after copying the Apple SDK System and lib to the right place.
It would be worth mentioning though that the whole installation process requires 7.6 GB ! Thanks.
@MarchHare22? Re: missing folders -- run "install.sh headers" should recreate them if I'm understanding what you're talking about
FYI, the first file I had to edit (adding #include<stdio.h> and stdlib.h) was toolchain/src/cctools/ld64/src/ld.cpp
Also, on an iPod touch using firmware 3.1.2, remember to sign the resulting program using ldid (for GNU/Linux, at http://svn.telesphoreo.org/trunk/data/ldid/) or the program will be killed upon execution.
@michael thanks man that worked for me. App is built then deployed. But it needs to be signed so im figuring out how to do that.. I wish they would create a section for it in the instructions.
The solution by HunterRoid? to fix the error "dmg image is corrupted..." works for me. Thank you very much for that.
However, when I run ./toolchain.sh build, it could not connect to git.saurik.com to checkout llvm-gcc-4.2! Anyone has the same problem?
I then tried to download llvm-gcc-4.2-2.6.source.tar.gz from llvm.org and then run toolchain.sh build again. But it failed to build due to the following error:-
~/Projects/iphone/toolchain/toolchain/src/gcc/gcc/config/darwin.c:1579: error: conflicting types for ‘mempcpy’
It would be highly appreciated if someone can help. Thank you very much.
My PC runs ubuntu 9.04.
I get a error that ERROR: dmg image is corrupted In order to extract 018-5301-002.dmg. ...............
So, I modified "toolchain.sh"..
DEVICE="iPhone_3G" ==> DEVICE="iPhone_3GS"
Finally... Success!!!!!
Hi Guys, I'm getting the infamous dmg corrupt error with my iPod 3G. I'm on firmware 3.1.2 and I can't find the vfdecrypt key anywhere. Can anyone help me? Thanks a mil
I replaced DEVICE with IPOD_3G and I get:
Is this right? Should DEVICE be something else or is the 3.1.2 key simply not yet available for the ipod 3g?
Thanks
Hi guys -
I am not expert on this but I tried above steps in my Mac OSX Snow Leopard Terminal.
Following are the errors for in make.log file.
(Last few lines)
d: warning: in append.o, file is not of required architecture ld: warning: in ar.o, file is not of required architecture ld: warning: in archive.o, file is not of required architecture ld: warning: in contents.o, file is not of required architecture ld: warning: in delete.o, file is not of required architecture ld: warning: in extract.o, file is not of required architecture ld: warning: in misc.o, file is not of required architecture ld: warning: in move.o, file is not of required architecture ld: warning: in print.o, file is not of required architecture ld: warning: in replace.o, file is not of required architecture ld: warning: in ../libstuff/libstuff.a, file is not of required architecture Undefined symbols:
ld: symbol(s) not found collect2: ld returned 1 exit status make1?: ar? Error 1 make: ar? Error 2Also, when I run,
./toolchain.sh build
I get this prompt 3/4 times,
Applying patches... ~/Projects/iphone/toolchain/toolchain/sys/usr/include ~/Projects/iphone/toolchain/toolchain/sys can't find file to patch at input line 3 Perhaps you used the wrong -p or --strip option? The text leading up to this was:
|--- /usr/include/Security/Authorization.h 2008-02-19 11:34:25.000000000 +0000 |+++ /usr/include/Security/Authorization.h 2008-03-24 11:07:40.000000000 +0000
File to patch:
I don't know what to enter in file to patch!
Please help.
Hi all,
I'm trying to build the toolchain under cygwin 1.7 and have reached the point where it tries to compile ld64, failing with a 'dereferencing type-punned pointer will break strict-aliasing rules' error. If I add the 'no-strict-aliasing' option to the make process it goes a bit further, but not so much so I think it's not a good idea to go this way. Be aware that since we cannot mount a DMG file under windows, the script has to extract the HFS partition of it and then the content of the HFS partition, so the mount process takes quite a long time and a lot of disk space to complete. Also, I'm far (far, far …) from being a bash master, so any improvement is welcome !
As a side note ... how to edit a comment on this forum ?
Here is an updated list of needed packages :
And here is the diff file of my toolchain.sh script over svn's HEAD one :
Index: toolchain.sh =================================================================== --- toolchain.sh (revision 83) +++ toolchain.sh (working copy) @@ -132,8 +132,18 @@ IPHONEWIKI_KEY_URL="http://www.theiphonewiki.com/wiki/index.php?title=Firmware" AID_LOGIN="https://daw.apple.com/cgi-bin/WebObjects/DSAuthWeb.woa/wa/login?appIdKey=D236F0C410E985A7BB866A960326865E7F924EB042FA9A161F6A628F0291F620&path=/darwinsource/tarballs/apsl/cctools-667.8.0.tar.gz" DARWIN_SOURCES_DIR="$FILES_DIR/darwin_sources" +_7Z_URL="http://sourceforge.net/projects/p7zip/files/p7zip/9.04/p7zip_9.04_src_all.tar.bz2/download" +XAR_URL="http://xar.googlecode.com/files/xar-1.5.2.tar.gz" -NEEDED_COMMANDS="git gcc make sudo mount xar cpio zcat tar wget unzip gawk bison flex patch" +# Platform wise configuration +PLATFORM=$(uname | sed 's|.*CYGWIN.*|Cygwin|g') +if [ $PLATFORM == "Cygwin" ]; then + NEEDED_COMMANDS="git gcc make cpio zcat tar wget unzip gawk bison flex patch" + SUDO= +else + NEEDED_COMMANDS="git gcc make sudo mount xar cpio zcat tar wget unzip gawk bison flex patch" + SUDO=sudo +fi HERE=`pwd` @@ -210,18 +220,34 @@ else local DMG="$1" fi - if [ "`uname -s`" == "Darwin" ]; then + if [ $PLATFORM == "Darwin" ]; then echo "In order to extract `basename $1`, I am going to mount it." echo "This needs to be done as root." - sudo hdiutil attach -mountpoint $2 $DMG + $SUDO hdiutil attach -mountpoint $2 $DMG + elif [ $PLATFORM == "Cygwin" ]; then + local _7Z="${TOOLS_DIR}/7z" + local TMP_DMG_DIR="${TMP_DIR}/tmp_dmg" + + echo "Extracting HFS volume from DMG file..." + local HFS_VOLUME=$("${_7Z}" l ${DMG} | grep -oi '[0-9]*\.hfs.*') + if "$_7Z" x ${DMG} -o${TMP_DMG_DIR} ${HFS_VOLUME} && "$_7Z" x ${TMP_DMG_DIR}/${HFS_VOLUME} -o$2; then + rm -Rf ${TMP_DMG_DIR} + + echo "Moving HFS volume's content to mount point..." + VOLUME_PATH=$2/$(ls $2) + `cd "${VOLUME_PATH}" && find . -mindepth 1 -maxdepth 1 -name '*' -exec mv {} ../ \;` + rm -Rf "${VOLUME_PATH}" + else + rm -Rf ${TMP_DMG_DIR} + fi else # Convert the DMG to an IMG for mounting TMP_IMG=${TMP_DIR}/`basename $DMG .dmg`.img ${TOOLS_DIR}/dmg2img -v -i $DMG -o $TMP_IMG echo "In order to extract `basename $1`, I am going to mount it." echo "This needs to be done as root." - # This is needed for 3.0 sdk and dmg2img 1.6.1 - sudo mount -t hfsplus -o loop,offset=36864 $TMP_IMG $2 + # This is needed for 3.0 sdk and dmg2img 1.6.1 + $SUDO mount -t hfsplus -o loop,offset=36864 $TMP_IMG $2 fi if [ ! $? == 0 ]; then error "Failed to mount `basename $1`." @@ -231,12 +257,14 @@ # Platform independent umount command for the DMGs used in this script umount_dmg() { - if [ "`uname -s`" == "Darwin" ]; then - sudo hdiutil detach $MNT_DIR + if [ $PLATFORM == "Darwin" ]; then + $SUDO hdiutil detach $MNT_DIR + elif [ $PLATFORM == "Cygwin" ]; then + `cd "${MNT_DIR}" && find . -mindepth 1 -maxdepth 1 -name '*' -exec rm -rf {} \;` else # shouldn't we have a DEBUG var and only # delete the TMP_IMG if DEBUG is not set/true - sudo umount -fl $MNT_DIR + $SUDO umount -fl $MNT_DIR fi if [ ! $? == 0 ]; then error "Failed to unmount." @@ -268,7 +296,7 @@ # Builds dmg2img decryption tools and vfdecrypt, which we will use later to convert dmgs to # images, so that we can mount them. -build_tools() { +build_dmg2img() { ([ -x ${TOOLS_DIR}/dmg2img ] && [ -x ${TOOLS_DIR}/vfdecrypt ]) && return mkdir -p $TOOLS_DIR @@ -276,7 +304,6 @@ message_status "Retrieving and building dmg2img 1.6.1 ..." - cd $TMP_DIR if ! wget -O - $DMG2IMG | tar -zx; then error "Failed to get and extract dmg2img-1.6.1 Check errors." exit 1 @@ -297,6 +324,86 @@ message_status "dmg2img is ready!" } +# Builds 7z in order to extract DGMs, the mount utility being incomplete an unsificient under cygwin +build_7z() { + local _7Z_SOURCE_DIR="p7zip_9.04" + local _7Z_ARCHIVE="${_7Z_SOURCE_DIR}.tar.bz2" + + ([ -x ${TOOLS_DIR}/7z ]) && return + + mkdir -p ${TOOLS_DIR} + mkdir -p ${TMP_DIR} + + message_status "Retrieving and building 7z ..." + + if ! ( wget -O ${_7Z_ARCHIVE} ${_7Z_URL} && bzip2 -dc ${_7Z_ARCHIVE} | tar -x); then + error "Failed to get and extract ${_7Z_ARCHIVE}. Check errors." + exit 1 + fi + + pushd ${_7Z_SOURCE_DIR} + + cecho bold "Build progress logged to: $(pwd)/make.log" + if ! make 7z &>make.log; then + error "Failed to make 7z" + exit 1 + fi + + mv bin/* ${TOOLS_DIR} + popd + rm -Rf ${_7Z_SOURCE_DIR}* + + message_status "7z is ready!" +} + +# Builds the xar tool from source, since it does not exists in the cygwin repositories +build_xar() { + local XAR_DIR="/usr/local/bin" + local XAR_LIB_DIR="/usr/local/lib" + local XAR_SOURCE_DIR="xar-1.5.2" + + ([ -x ${XAR_DIR}/xar ]) && return + + mkdir -p $TOOLS_DIR + mkdir -p $TMP_DIR + + message_status "Retrieving and building xar ... in $(pwd)" + + if ! wget -O - ${XAR_URL} | tar -zx; then + error "Failed to get and extract xar. Check errors." + exit 1 + fi + + pushd ${XAR_SOURCE_DIR} + + cecho bold "Build progress logged to: $(pwd)/make.log" + if ! (./configure &>make.log; make &>make.log; make install &>make.log); then + error "Failed to make xar" + exit 1 + fi + + # xar refuses to work on cygwin, complaining that it can't find its library : for now, help xar to find it + cp ${XAR_LIB_DIR}/libxar.so.1 ${XAR_DIR} + popd + rm -Rf ${XAR_SOURCE_DIR} + + message_status "xar is ready!" +} + +# Builds tools needed by each platforms +build_tools() { + pushd ${TMP_DIR} + + build_dmg2img + + if [ $PLATFORM == "Cygwin" ]; then + build_7z + build_xar + fi + + popd +} + toolchain_extract_headers() { build_tools mkdir -p ${MNT_DIR} ${SDKS_DIR} ${TMP_DIR} @@ -328,7 +435,7 @@ # Inform the user why we suddenly need their password message_status "Trying to mount the iPhone SDK dmg..." - mount_dmg $IPHONE_SDK_DMG $MNT_DIR + mount_dmg $IPHONE_SDK_DMG $MNT_DIR # Check the version of the SDK # Apple seems to apply a policy of rounding off the last component of the long version number @@ -547,8 +654,8 @@ message_status "Copying required components of the firmware..." mkdir -p "${FW_VERSION_DIR}" - sudo cp -R -p * "${FW_VERSION_DIR}" - sudo chown -R `id -u`:`id -g` $FW_VERSION_DIR + $SUDO cp -R -p * "${FW_VERSION_DIR}" + $SUDO chown -R `id -u`:`id -g` $FW_VERSION_DIR message_status "Unmounting..." cd "${HERE}" @@ -1031,10 +1138,10 @@ all) check_environment export TOOLCHAIN_CHECKED=1 - ( ./toolchain.sh headers && \ - ./toolchain.sh darwin_sources && \ - ./toolchain.sh firmware && - ./toolchain.sh build ) || exit 1 + ( $0 headers && \ + $0 darwin_sources && \ + $0 firmware && + $0 build ) || exit 1 confirm "Do you want to clean up the source files used to build the toolchain?" && ./toolchain.sh clean message_action "All stages completed. The toolchain is ready."Actually, the error I'm facing has nothing to do with strict-aliasing. It was just the last warning of the make log. The error is the following one :
Any idea of what is hapening ?
Hi all,
today I successfully compiled the 3.0 toolchain in Ubuntu 8.04 (Hardy Heron) on X86 CPU. I was using the toolchain for 2.2.1 quite some time and wanted to switch to 3.0 now. Here is my diff agains Revision 83. It solves the dmg mounting issue as well as the linker problem for -lobjc.
26a27,28 > DECRYPTION_KEY_SYSTEM="47D76295817F74953F8E557B4917FE2201E9778A9900E43FBF311A83F176FE521B996A4B" > 31c33 < DEVICE="iPhone_3G" --- > DEVICE="iPhone_3GS" 530c532 < --- > 750c752 < for framework in UIKit AddressBook CoreLocation OpenGLES; do --- > for framework in UIKit AddressBook AddressBookUI CoreLocation OpenGLES; do 927a930,939 > > echo "Replacing 'System' directory" > cd ${TOOLCHAIN}/sys > rm -rf System 2>/dev/null > cp -a ${IPHONE_SDK}/System . > > echo "Replacing 'lib' directory" > cd ${TOOLCHAIN}/sys/usr > rm -rf lib 2>/dev/null > cp -a ${IPHONE_SDK}/usr/lib .Provided all necessary debs are installed as stated on this wiki page, you should be able to build the toolchain for SDK 3.1.2 with the following commands:
Good luck!
The toolchain build just fine on Ubuntu 8.04 Hardy amd64 without any patch, using the gcc suite version 4.2. The only workaround I had to pull in was to install the i386 version of uuid-dev and libssl-dev as the cctools build process will look for libraries inside /usr/lib instead of /usr/lib32. To do so, just download the 32bit debs from http://packages.ubuntu.com/hardy/uuid-dev and http://packages.ubuntu.com/hardy/libssl-dev and install them using "sudo dpkg --force-architecture -i". This will leave your ubuntu in a inconsistent state, though, so remember to clean your system by removing those two debs after the toolchain has been built.
succesfully compiled the toolchain with gcc-4.3 on Ubuntu 9.10 x86
used michael.apitz' patch together with iphone_sdk_3.1.2_with_xcode_3.1.4leopard9m2809.dmg and iPhone2,1_3.1.2_7D11_Restore.ipsw
thank you so much!
Seriously recommend for Ubuntu users, at least, to sudo apt-get install gobjc. Saves a lot of trouble.
I realize that it says install gobjc-4.3, and while I did this, it either chose not to install or it just didn't want to work. I didn't notice at the time if it didn't install, but when it came time to run build, it definitely didn't work.
is git://git.saurik.com/llvm-gcc-4.2 died? anyone can upload their $GCC_DIR content ?
"is git://git.saurik.com/llvm-gcc-4.2 died? anyone can upload their $GCC_DIR content ?"
Can't access to the git repository ... Never tried before, so I don't know how much time is been down ...
So I'm stuck on building the LLVM-GCC. Any help ?
Thank You.
In fact, right now "git.saurik.com" is refusing petitions (maybe a broken service/new firewall rule?):
Do anyone have a fresh tarball ? Any mirror available ?
Thank you!.
same question to upstair
git.saurik.com do not die. You get "connection refused" error may be caused by the fact that your computer network is behind the firewall/proxy.
please refer to the follow link to setup the git if your computer network behind the proxy. http://www.darraghbailey.com/wordpress/?p=23
Any idea where can I download 3.1.2 SDK? The toolchain doesn't work with 3.1.3 that I downloaded from Apple.
LaiChungGM's suggestion is helpful,3x
My computer wasn't behind any firewall or proxy blocking the connection. But now the git repositories are working again.
When I first built the HelloToolchain?, it compiled, linked, deployed and ran just fine. After creating a new project (just copy HelloToolchain? and change the name everywhere), nothing works anymore. My apps quit on launch.
-I tried to add a chmod in the makefile (for permissions), didnt work -I tried to reboot my ipod, didnt work -I tried to sign manually, signed fine, but didnt help
The weirdest thing is that i can't get the orignal HelloToolchain? to run too.. :\
Any suggestions?
@athlon6000, try this instead: http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_3.1.2__final/iphone_sdk_3.1.2_with_xcode_3.1.4__leopard__9m2809.dmg
I successfully built the toolchain for SDK 3.1.2 and everything works on ubuntu 9.10 running on amd64 (x86_64). Here is a short description:
Files used:
Links are easy to find.
Prerequisite packages: Everything mentioned under 'Packages needed to compile the toolchain' (above), except my versions for g++, gcc, gobjc are 4.4.1 (latest from ubuntu repository)
Build process: I did the toolchain steps manually. The first error was on "./toolchain.sh build". I checked the log file, it was ld error, I also noticed many errors on "sprintf" for some .hpp files. Modifying those files (adding #include <stdio.h> and #include <stdlib.h> as mentioned at some comments here) solved the problem. I had to repeat this couple of times (and don't get the sources again when asked, you don't want your change to be overwritten...) After this, the toolchain build finished successfully (with hell of a lot warnings at the log file).
HelloWorldFirst?, HelloToolchain? compilation: Had some PATH and missing library errors. Replacing 'System' and 'usr/lib' dirs with the ones from the extracted SDK dir (as mentioned in some comments here) and adding the toolchain/pre/bin to my PATH solved everything.
Good luck all.
has anybody found an easy way to convert existing Xcode projects ( such as available from http://github.com/erica/iphone-3.0-cookbook- ) to compile with this toolchain on linux? perhaps an Eclipse IDE project template can be used to import Xcode projects and then compile them (with this toolchain) and deploy them from within the IDE?
Hi guys, I've been having some problems building the toolchain with firmware 3.1.2. The error I get when I run ./toolchain.sh headers (and I also get it when i run ./toolchain.sh all) is: "I couldn't find the folder iPhoneOS3.1.2.sdk. Perhaps this is not the right SDK dmg for toolchain 3.1.2." I have "iphone_sdk_3.1.3_with_xcode_3.1.4leopard9m2809a.dmg" in my files directory and "iPhone1,2_3.1.2_7D11_Restore.ipsw" in my firmware directory. I am using revision 83 of the toolchain. Im running Ubuntu9.10. Any ideas why this is happening?
Download the 3.1.2 sdk.. I had the same problem, and that fixed it. Somehow the 3.1.3 sdk does not work.
oops, looks like i cant tell the difference between 3.1.2 and 3.1.3, thanks :)
I also have meet difficulty when building the toolchain with firmware 3.1.2,the error I get when I run ./toolchain.sh headers "I couldn't find the folder iPhoneOS3.1.2.sdk. Perhaps this is not the right SDK dmg for toolchain 3.1.2.",how to fix this?
I build the toolchain with iPhone1,2_3.1.2_7D11_Restore.ipsw, and i also know get the DECRYPTION_KEY_SYSTEM from http://www.theiphonewiki.com/. but unfortunately, I can't visit the website http://www.theiphonewiki.com/. who can tell the DECRYPTION_KEY_SYSTEM of iPhone1,2_3.1.2_7D11_Restore.ipsw
@ybbaigo: fe431a1e436e5298d3c871359768aab43189fd5e7375a2ced3405dd8a223879a4d64a28e (Northstar 7D11)
Just got this to work for iPad with firmware 3.2! Brilliant script (just needed to change minor things like version numbers and copy System + /usr/lib dir to get the libobjc), thanks!
Hi, I am using
I follow the above instruction: But when I run the Following command:---
root@smluthra-desktop:/home/smluthra/Projects/iphone/toolchain/apps/HelloToolchain#? IP=192.168.0.101 PATH=../../toolchain/pre/bin/:$PATH make deploy arm-apple-darwin9-gcc -c src/HelloToolchain?.m -o HelloToolchain?.o make: arm-apple-darwin9-gcc: Command not found make: [HelloToolchain.o] Error 127
arm-apple-darwin9-gcc: Command not found error occurs.
If anyone is interested I got this working with the 4.0 sdk but it has numerous problems. To get the toolchain to build you need to change the version numbers in the toolchain.sh and then copy across the System folder to /usr/lib to get all the libraries in the correct place. However when you try to build a program it complains about the new backgrounding functions. You can get around this by commenting them out in the header but then you are unable to use them. It also complains about NS_FORMAT_FUNCTION() that is used the stringWithFormat? method. Commenting out NS_FORMAT_FUNCTION will again fix this and afaik the stringWithFormat method still works correctly. The last problem is that it complains of missing definitions for an enum in the NSURLError.h header. I fixed this by searching on the web, I don't remember how exactly. After these problems are fixed it will finally build and the programs work correctly as far as I have tested. Although the linker still complains about bad symbols for NSURLError for me.
@willh1234 Can you explain what you mean by copying the System folder?
I mean copying the System folder from the OSX sdk to usr/lib. This fixes problems where it cand find libobjc etc.
I managed to build the toolchain for the 4.0 sdk but I am getting several errors regarding NSString.h, NSException.h, NSURLError.h, and UIView.h when compiling HelloToolchain?. I used the 4.0 sdk from Apple and 4.0 firmware. FWIW I have been using this toolchain based on 3.1.2 for several months now and it works perfectly.
Here are some of the compiler errors:
/home/brian/iphonedev4.0/toolchain/sys/usr/include/Foundation/NSString.h:282: error: format string argument follows the args to be formatted
/home/brian/iphonedev4.0/toolchain/sys/usr/include/Foundation/NSException.h:62: error: format string argument follows the args to be formatted
Some errors regarding UIView.h:
/home/brian/iphonedev4.0/toolchain/sys/usr/include/UIKit/UIView.h:250: error: expected ‘)’ before ‘^’ token /home/brian/iphonedev4.0/toolchain/sys/usr/include/UIKit/UIView.h:250: error: expected ‘)’ before ‘(’ token /home/brian/iphonedev4.0/toolchain/sys/usr/include/UIKit/UIView.h:250: error: expected ‘)’ before ‘^’ token /home/brian/iphonedev4.0/toolchain/sys/usr/include/UIKit/UIView.h:250: error: expected ‘)’ before ‘(’ token
Thanks in advance!
I've been getting errors similar to brian.cross, here's a link to the full output if it helps: http://pastie.org/1057898
I did a little reading and the '^' token has to do with Apple's block syntax that they have added to the language:
http://developer.apple.com/mac/articles/cocoa/introblocksgcd.html
These extensions must have been added for iOS 4 and the compiler built by this script doesn't support them.
willh1234, what did you do to get the compiler working?
What happened to the iPhone-gcc git repository?
If any one is interested in joining the fight to create flash for the ipad/iphone. Please visit http://wiki.gnashdev.org/Building_for_iOS. I have so far gotten flash running in a standalone app, but need to add it to the safari plugin.
From what I can see now, the 4.0 headers can be grabbed with this toolchain's installation script (run ./toolchain.sh headers), but they can't be used (yet) because of the following problems:
1. If you encounter "missing crt1.o" when compiling, you have to do the trick mentioned in saurik's post: http://www.saurik.com/id/4, which is: {{{cp -af crt1.o crt1.10.5.o cp -af dylib1.o dylib1.10.5.o}}} (Oh and of course you'll need Leopard's SDK too, but it is grabbed by the script as well) This fixed the problem.
2. (And this is more serious) 4.0 introduces pseudo backgrounding and that weird NS_FORMAT_FUNCTION (and of course some other stuff that's harmless). As willh1234 pointed out, you can comment out those stuff, but what's the point of 4.0 without backgrounding? :( I think this is a problem with the old compiler not being able to recognize the new syntaxes. Most notably, backgrounding uses blocks (If you don't know what 'blocks' is, read: http://developer.apple.com/mac/articles/cocoa/introblocksgcd.html) and maybe the old compiler doesn't know how to handle this? Since I'm clueless when it comes to compiler, low level programming and related stuff, any experienced coders willing to patch llvm to work with the new syntaxes? Especially since Apple now adopts llvm as its "flagship" compiler :), the source code to the modified llvm (distributed with Xcode) should be publicly available (right?)
Bottom line is, there is nothing us beginners can do now, leave it to the hands of the experienced ;)
@lpq430, it works
Now I want to built the toolchain with iOS3.2, but i only could get the 4.1 sdk from http://developer.apple.com/devcenter/ios/index.action, where i should get the 3.2 sdk
The first appliance com iphonedevonlinux Ready to Fly...
http://pt.opensuse.org/Utilizador:Cabelo/LiMobile
http://www.youtube.com/watch?v=zHyU0kNVD54
i got a problem whem decompress the SDK
This needs to be done as root. cat: /path/to/toolchain/files/mnt/iPhone SDK.mpkg/Contents/version.plist: No such file or directory SDK is version I tried to extract iPhoneSDKHeadersAndLibs.pkg but I couldn't find it!
the file is really not exist.
Archive successfully decompressed as /path/to/toolchain/tmp/xcode_3.2.5_and_ios_sdk_4.2_gm_seed.img
it says that Archive successfully decompressed.but the file is not exist too .
Hello!
I installed the sdk 4.1 with firmware 4.1 perfectly on Ubuntu 10.10 with the script. I have the same problem like ipq430 commented above while I'm compiling. The compiler says NSCharacter, NSString, NSUrl... etc errors. Does somebody know how to fix it?
In order to use a full screen resolution of an iPad (using a Cocoa graphical application based on a 3.2 toolchain), modify the Info.plist by adding the following entries
doing so, the resolution will automatically adapt whether the application is running on a iPad or an iPhone (otherwise, you only get the low resolution application on the iPad, with the x2 zoom option to use the full screen but still at iPhone resolution)
Toolchain 3.0 built well. HelloToolchain? sample also compiled and deployed onto iPhone 4 (iOS 4.1, firmware 2.10.04) no problem.
I followed the SDK and firmware as listed way up the top ie.: iphone_sdk_3.0leopard9m2736final.dmg and iPhone1,2_3.0_7A341_Restore.ipsw
Thanks everybody for the information. The most useful information I got was: to do it on Ubuntu 9.04. I think someone else also said Debian 5.03 was ok too.
At first I spent days trying to do it on Ubuntu 10.10 with errors. Tried modifying the script and didn't get anywhere. Then I set up Ubuntu 9.04 in Virtualbox (under Ubuntu 10.10 :D ) and everything went relatively well from there.
I also went through each apt-get install myself (ie. automake, then bison, then cpio etc etc) because for some reason one or two of them just didn't install properly.
The second hardest part of this whole thing was probably finding SDK 3 and firmware, and extracting the headers. I basically just googled for a long time and finally found them. Somebody already pulled out iPhoneOS3.0.sdk and MacOSX10.5.sdk for me and so I just fed those to the script. That pretty much bypassed 1/3 of the script, saved it from all those churning, checking, digesting of dmg.
If people are having trouble with the dmg files, try using iDecrypt. You can find it online. It is a front end for vfdecrypt and I think it doesn't even need a key. So basically you can pull out the necessary parts yourself.
Hope this helps.
At global scope: cc1plus: warning: unrecognized command line option "-Wno-long-double" make 1 ld.o Error 1 make 1 Leaving directory `/home/user/Linux-Stored-Projects/toolchain/toolchain/bld/cctools-iphone/ld64' make: ld64 Error 2
Hello!
I was trying to find the 3.0 SDK for days now and cannot find it... @gerogeAu - can you please provide me with a link with the files that you found? That would be great.
With SDK 4.2.1 I get the following error when trying to mount the image:
"I tried to extract iPhoneSDKHeadersAndLibs.pkg but I couldn't find it!"
Some help would be great. Thanks!
I just finished working on sdk4.2. Updating toolchain.sh still in progress. The solution to compile with sdk4.2 is to find a C compiler supporting new 'blocks' Apple feature => this is clang 2.8 + cctools-782 Have converted cctools-782 to odcctools-782. I successful cross-compiled some demos with sdk4.2 and ... miracle, they are now multitask (they don't disapear when returning to the SpringBoard??) ! I'll post the new toolchain.sh for 4.2 in a few days.
Hi, currently i use toolchain llvm-svn_r42498 from iphone-dev, but the project seems to be dead. waiting for your new work :) Thanks.
Hi, toolchain4-src.tar.bzip2 is here http://dl.free.fr/q9LIYF6EP untar it in /usr/toolchain4 and run ./toolchain.sh all (you need of course xcode_3.2.5_and_ios_sdk_4.2_final.dmg) Then install clang 2.8. Note : clang calls /usr/bin/as (hardcoded). To permit a cross compilation, I wrote as_driver that take place in /usr/bin/as. To compile your app, look at GenericMakefileForApps4?.
Please, I have no time to respond to newbies. If you encounter an issue with the script, correct it and publish the new version ! Thx all for your collaborative work.
Hi, i have successfully build and install toolchain4@denis in my debian squeeze. my configuration:
IPHONEDEV_DIR="/home/iphone" TOOLCHAIN="${IPHONEDEV_DIR}" BUILD_DIR="${IPHONEDEV_DIR}/build" SRC_DIR="${IPHONEDEV_DIR}/src" PREFIX="${IPHONEDEV_DIR}" SYS_DIR="${TOOLCHAIN}/sys"i have add iphone user to use .bashrc for automatic exporting var's when i login to iphone user.
some more dependency needed in debian : (apt-get install) udev-dev (uuid/uuid.h) i comment "#" xar and dmg2img section, because is found in debian (lenny) repository. i have remove as_driver section , because i don't use "/usr" remarks: i have copied manually iphone sdk because is mounted and extracted but not copied in ${SYS_DIR} using toolchain.sh script. (is needed to build gcc-4.2-iphone). and i have add "cp files/misc/Makefile.in ... because the extract.sh script stop when trying to patch none existing file" :
pushd cctools2odcctools cp files/misc/Makefile.in odcctools/misc ./extract.sh cp -r odcctools ${SRC_DIR}and all everything else worked fine. Thank-you very-mush denis for your good work :)
i have build wget binary http://dl.free.fr/riqxXHSsf.
to check binary information, copy wget in your iphone and try :
Thanks again :)
i'm also trying installing it on debian. and hoping it can be installed in cygwin someday.
i had build toolchain4 on ubuntu 10.10 and there are something need to be done before runing toolchain.sh. 1. mkdir -p toolchain/pre/bin -- for installing ldid
2. mkdir -p toolchain/src -- for script mv odcctools to src dir
3. modify cctools2odcctools/extract.sh and insert "cp files/misc/Makefile.in ${DISTDIR}/misc/Makefile.in" -- the extract.sh script try to patch none existing file
4. edit toolchain/src/cctools/otools/print-objc.c,comment all because there is no objc runtime headers on ubuntu
5. edit function toolchain_llvmgcc in toolchain.sh,set --with-sysroot to ${SDK_DIR}/iPhoneOS${TOOLCHAIN_VERSION}.sdk. or run toolchain.sh build before llvmgcc
hope this helpful.
but it looks like new toolchain not working because when i complie HelloToolchain? it say: "format string argument follows the args to be formatted" . any suggestion? thx
when i try to open toolchain4-src.tar.bzip2 it says its broken ?
try tar -jxvf toolchain4-src.tar.bzip2 || download again
sorry,i made some mistake,forgot what i posted before
tar xvjf toolchain4-src.tar.bzip2 works great
I am blocked at this point: Building cctools... /usr/toolchain4/cctools2odcctools /usr/toolchain4 odcctools already exists. Please move aside before running mv: impossible de déplacer «odcctools» vers «cctools/odcctools»: Le dossier n'est pas vide /usr/toolchain4 Configuring cctools-iphone... ./toolchain.sh: line 736: /usr/toolchain4/toolchain/src/cctools/configure: Aucun fichier ou dossier de ce type make: Pas de règle pour fabriquer la cible « clean ». Arrêt.
Could someone help me please? Thanks.
Is there a configure file in your cctools directory? In mine, not...
Try this new version http://dl.free.fr/rf06Lwa2u Remember, /usr/toolchain4 must be empty before extracting.
gone a little deeper in the script ./extract.sh, and found my problem. On my Ubuntu, /bin/sh is linked to /bin/dash, and in this interpreter, there is no pushd/popd command. In my case, replacing #!/bin/sh by #!/bin/bash at beginning of extrash.sh did the trick.
I ask myself if you got any problem with clang 2.8? -- clang: error: assembler command failed with exit code 255 -- Any clue of what's happening?
i've build toolchain on ubuntu 10.10, using ios 4.2.1 and xcode 3.2.5. and all steps seems fine. but it looks like new toolchain not working because when i complie HelloToolchain?? it say: "format string argument follows the args to be formatted" . any suggestion? thx
i tried toolchain4 on ubuntu 10.10, using ios 4.2.1 and xcode 3.2.5 , and use GenericMakefileForApps4?, no "format string argument follows the args to be formatted" any more,BUT -- clang: error: assembler command failed with exit code 255--showed up, any clues? louis, do you get through of this?
I managed to compile the simple HelloWorld?.c file using darwin-gcc (part of binaries of toolchain4), producing an executable that I tested on my iphone 3GS.
But, as soon as I use clang to compile a more complex project (like HelloToolchain? project give as example in the former toolchain for linux) I got the clang error: assembler command failed with exit code 255@louis ./toolchain.sh: line 736: /usr/toolchain4/toolchain/src/cctools/configure: Aucun fichier ou dossier de ce type
I have the same error. How did you manage to find the configure file?
assembler command failed with exit code 255
try add "-fasm-blocks" and arch config
"clang error: assembler command failed with exit code 255" because clang used /usr/bin/as,if we have installed as_driver in this toolchain,make a link /usr/bin/arm-apple-darwin-as to /usr/toolchain4/toolchain/pre/arm-apple-darwin-as. I thought it will work for HelloWorldFirst?.
but,the toolchain4 didn't work with HelloToolchain? yet :(
sorry,it should be "arm-apple-darwin9-as"
"format string argument follows the args to be formatted" Only clang can compile the new Apple headers containing new 'Blocks' feature. gcc can't.
that's great! i had successfully build qt-iphone finally on ubuntu, and now i'll try to test it on my 3gs.
this is what i used: modified iPhone SDK 4.2 header, freetype in qt request some header of Kernel framework.
cctool in toolchain4 clang 2.8 came from apt for almost all sources.
llvm-gcc 4.2 in toolchain4 for some c file,i double there was a bug or wrong config for clang when building freetype in qt,but arm-apple-darwin9-gcc worked fine.
i'll report my testing soon.
The firmware downloading function in the script is failing.
When you get to the part where the script asks for the firmware, it first asks if you have it. If you answer no, the script should ask if you want it to download it for you, but instead it acts as if the user entered yes.
The following is the code in question: Beginning at line 437 in toolchain.sh
if ! confirm -N "Do you have it?"; then if confirm "Do you want me to download it?"; then APPLE_DL_URL=$(cat ${HERE}/firmware.list | awk '$1 ~ /'"^${TOOLCHAIN_VERSION}$"'/ && $2 ~ /^iPhone\(3G\)$/ { print $3; }') FW_FILE=`basename "${APPLE_DL_URL}"` if [ ! $APPLE_DL_URL ] ; then error "Can't find a download url for the toolchain version and platform specified." error "You may have to download it manually.". exit 1 else message_status "Downloading: $FW_FILE" cd $TMP_DIR wget -nc -c $APPLE_DL_URL mv $FW_FILE $FW_DIR FW_FILE=$FW_DIR/$FW_FILE fi fi else while [ ! -r "$FW_FILE" ]; do read -p "Location of firmware image: " FW_FILE [ ! -a $FW_FILE ] && error "File not found." done fiHi,I have made the simple qml example of Qt(lighthouse) running on my iphone 3GS.thanks very much! after days trying,i suggests those dev env on linux for iphone,and i think maybe it's the best right choice right now.
1. standard IPhone SDKs with port framework includes to its usr/include,just like what the toolchain script did.
2. clang compiler,maybe the svn/git version is better than 2.8 release because the newest supports ARM much better.
3. cctools came from this toolchain as the binutils
4. as_driver came from this toolchain,because clang call /usr/bin/as as its assember. don't forgot make links to arm-apple-darwin9-as and arm-apple-darwin9-ld in /usr/bin.
with those tools,we can build mostly sources on linux targeting ios. my compiler options for clang :
clang -ccc-host-triple arm-apple-darwin10 -march=arm
don't set arch to armv7,in that case,clang will generate thumb code but cctools will complain it.
by the way,sorry for my poor english :)
iOS 4.3 is now available, why not update? or it works well on IOS 4.3 ?
iOS 3.1.2 or 3.1.3 headers are the only ones that work with the latest GCC because of the new Objective-C coding in 4.x. But, you can still compile against you 4.x file system and it will work fine.
Trying to build cctools with toolchain4 and ubuntu puts the objective c headers in a weird place and the compiling is failing because it can't find the objc headers.
Anyone have any tips on how I can change the script to confine to this? Should I just switch to a debian distro?
Introduction(fennec-ios.googlecode.com)
This project's goal is to port fennec mobile browser to apple's ios operation system.
Details
1,Building the Toolchain
2,Getting the Code
3,Building the Code
4,To do
I'm stuck on this whole objc/objc-runtim.h No such file or directory in debian and in ubuntu. Can anyone point me in the right direction?
If anyone is having problem mounting xcode_3.2.5_and_ios_sdk_4.2_final.dmg on ubuntu 11.04, like i did.
I successfully bypassed this step by using 7zip to extract .dmg file into a folder and then extract the contents of 5.hfs to /usr/toolchain4/files/mnt/
hi, . i was trying to build the toolchain but here is an error
./toolchai.sh all
tar: as/Makefile: marca de fecha sospechosamente antigua 1969-12-31 18:00:00 tar: as/arm.c: marca de fecha sospechosamente antigua 1969-12-31 18:00:00 tar: as/i386-opcode.h: marca de fecha sospechosamente antigua 1969-12-31 18:00:00 tar: as/read.c: marca de fecha sospechosamente antigua 1969-12-31 18:00:00 tar: as/symbols.c: marca de fecha sospechosamente antigua 1969-12-31 18:00:00 ....................... (the same).......
Removing #import Removing private_extern Applying patches Applying patch ar/archive.diff ./extract.sh: 145: pushd: not found can't find file to patch at input line 3 Perhaps you used the wrong -p or --strip option? The text leading up to this was:
|--- ./archive.c.orig 2009-06-11 12:30:56.000000000 -0500 |+++ ./archive.c 2009-06-11 12:30:57.000000000 -0500
File to patch: (I DONT KNOW WHAT FILES IS HERE g: No such file or directory Skip this patch? y? y Skipping patch. 1 out of 1 hunk ignored There was a patch failure. Please manually merge and exit the sub-shell when don
ANYBODY CAN HELP ME?? im on Debian 6.0.2.1 .. my ios sdk 4.2 and FW 4.2.1
Hi guy! Toolchain for sdk 4.3 is here : http://dl.free.fr/g8YwSS2cH
mkdir /usr/toolchain4 cd /usr/toolchain4 Rename it in toolchain.sh You need xcode_3.2.6_and_ios_sdk_4.3.dmg downloaded and installed in ./files
---------------- btw NEWBORN !! My first application iMariner, entirely developed with this toolchain on Linux, then simply recompiled on a friend's Mac, has been accepted and is available on AppStore?.
I just downloaded the lastest sdk from apple, and the firmware of my iphone its 4.2.1 (8C148), but the toolchain does not work, im having problems mounting the image:
In order to extract xcode_3.2.6_and_ios_sdk_4.3.dmg, I am going to mount it. This needs to be done as root. mount: wrong fs type, bad option, bad superblock on /dev/loop0,
Failed to mount xcode_3.2.6_and_ios_sdk_4.3.dmg.
Thanks in advance :)
keep updating the toolchain... congrats and thanks denis!
Trying to build the toolchain on Fedora 15 64bit. I keep getting the error mentioned by others when trying to mount an .img file decoded by dmg2img - whether it's the SDK or the Firmware. Had to get the packages out manually using HFSExplorer - a great tool: http://www.catacombae.org/hfsx.html
Hope this helps someone else. Roel
Hi, could you help me, i'm blocked at this point ./toochain4.sh cctools, i had this error:
Thanks.
some information about my environnement
Here the solution (it works for me) to mount .img file:
http://linuxforums.org.uk/linux-tips-tricks/use-linux-to-install-osx-from-a-dmg-extracted-to-a-partition-without-a-mac-dvd/msg5792/#msg5792
thanks @colas for your reeply but my problem is different. My problem in when i attempt to compile cctools on my platform, the configure process give me this error.
I found an issue for my problem: in file toolchain.sh, in toolchain_cctools() function, in this line:
CFLAGS="-m32" LDFLAGS="-m32" "${CCTOOLS_DIR}"/configure \just remove the CFLAGS and LDFLAGS
"${CCTOOLS_DIR}"/configure \On Debian/unstable it may help to replace each occurrence of lssl with lcrypto, without this change it generates an error message like this : "/lib/libcrypto.so.0.9.8: could not read symbols: Invalid operation".
Could compile HelloToolchain? and HelloWorldFirst? and make them work on my 3GS, thanks Denis for the good job ! :)
I'm confused by this ERROR when i try to build firmware
sunkuan@sunkuan-laptop:/Tools/IOS/toolchain$ ./toolchain.sh firmware Preparing the environment Toolchain version: 3.1.2 Building in: /Tools/IOS/toolchain Environment is ready Extracting firmware files... Archive: /Tools/IOS/toolchain/files/firmware/iPod3,1_3.1.2_7D11_Restore.ipsw
Firmware Details Device Class: iPhone Product Version: 3.1.2 Build Version: 7D11 Restore RamDisk?: 018-6155-014.dmg Restore Image: 018-6152-014.dmg Board Config: n18ap Unzipping 018-6152-014.dmg... Archive: /Tools/IOS/toolchain/files/firmware/iPod3,1_3.1.2_7D11_Restore.ipsw Mounting 018-6152-014.dmg... Decrypting 018-6152-014.dmg...dmg2img v1.6.1 is derived from dmg2iso by vu1tur (to@vu1tur.eu.org)
ERROR: dmg image is corrupted In order to extract 018-6152-014.dmg, I am going to mount it. This needs to be done as root. mount: wrong fs type, bad option, bad superblock on /dev/loop0,
Failed to mount 018-6152-014.dmg.
help me plz...............