LinuxArchitectureIPhoneOS3.1.2 Development Environment instance operations are the content of this article, developmentIPhoneThe application standard environment configuration is based on intel Mac. Although Mac is cheap, most people are still using windows andLinuxSystem. Today we will introduceLinuxCreate onIPhoneDevelopment System. The latest SDK version 3.1.2 is used here. This article mainly introducesLinuxFor the installation, configuration method, windowsCygwin) configuration, refer to here.
My HOST machine environment is as follows:
- uname -a Linux localhost.localdomain 2.6.18-1.2798.fc6
- #1 SMP Mon Oct 16 14:54:20 [/pre] EDT 2006 i686 i686 i386 GNU/Linux gcc -v Using built-in specs.
- Target: i386-redhat-linux config option: ../configure --prefix=/usr --mandir=/usr/share/man [/pre]
- --infodir=/usr/share/info --enable-shared --enable-threads=posix [/pre]
- --enable-checking=release --with-system-zlib --enable-__cxa_atexit [/pre]
- --disable-libunwind-exceptions --enable-libgcj-multifile [/pre]
- --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk [/pre]
- --disable-dssi [/pre]
- --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre [/pre]
- --with-cpu=generic --host=i386-redhat-linux thread model: posix gcc version 4.1.2 20070626 (Red Hat 4.1.2-13)
To be prepared:
3.1.2 use restore file iPhone1, 2_3.1.2_7D11_Restore.ipsw iPhone3.1.2 SDK iphone_sdk_3.1.2_with_xcode_3.1.4 _ leopard _ 9m2809. dmg
Many websites have introduced it. Here we also use toolchain to build the environment. Refer to iphonedevonlinux.
- Checkout toolchain $ mkdir ~ /Toolchain cd ~ /Toolchain svn checkout [url] http://iphonedevonlinux.googlecode.com/svn/trunk/#/url]
- ./Copy the SDK and the firmware file mkdir-p files/firmware mv./iphone_sdk_3.1.2_with_xcode_3.1.4 _ leopard _ 9m2809. dmg
- ./Files/mv./iPhone1, 2_3.1.2_7D11_Restore.ipsw./files/firmware/
The updated toolchain already corresponds to SDK 3.1.2, so you don't need to patch it.
- [blockquote]
If you encounter a problem with "We need the decryption key for 018-6028-014.dmg.", you can
- DECRYPTION_KEY_SYSTEM = $ .....
- Replace with DECRYPTION_KEY_SYSTEM =
- "a8a886d56011d2d98b190d0a498f6fcac719467047639cd601fd53a4a1d93c24e1b2ddc6"
- [/blockquote]
Because the toolchain for checkout is for version 3.0 and cannot be used directly, a patch is required.
Download the patch here and go to the toolchain directory:
- patch < toolchain.sh.patch chmod u+x toolchain.sh
Install/compile
After executing./toolchain. sh all, We will install and compile it all, but there are actually many problems, so we will continue step by step.
Step 1: No problem
- ./toolchain.sh headers
Step 2 also passed
- ./toolchain.sh firmware
Step 3 is also quite smooth
- ./toolchain.sh darwin_sources
The last step requires attention.
- ./toolchain.sh build
Execute the last step to compile the gcc-4.2-iphone and the following error will occur during the link: ld: library not found for-lc
- collect2: ld returned 1 exit status make[3]: *** [libgcc_s.dylib] error 1
- ....
- make[2]: *** [stmp-multilib] error 2
- rm gcov.pod fsf-funding.pod gfdl.pod gpl.pod cpp.pod gcc.pod
- ....
- make[1]: *** [all-gcc] error 2 make[1]:leaving dir `/home/xxx/toolchain/toolchain/bld/gcc-4.2-iphone' make: *** [all] error 2
To solve this problem, run the following command in the toolchain directory:
- cp ./sdks/iPhoneOS3.1.2.sdk/usr/lib/libSystem.B.dylib [/pre] ./toolchain/bld/gcc-4.2-iphone/gcc/libc.dylib[/pre]
Next, execute./toolchain. sh build. The following figure shows the success.
- It seems like the toolchain built![/pre]
Finally, you can execute./toolchain. sh clean to delete files such as the files and sdks in the compilation process.
Test
Next, you can first try the toolchain/apps/test code HelloToolchain below.
The following problems may occur during compilation:
1. compiler file arm-apple-darwin9-gcc not found
Make is directly in the HelloToolchain directory. Probably prompts that there are no commands such as arm-apple-darwin9-gcc.
This is because no compiler path is set. Put the following statement into/etc/profile for all users ),
Or in the. bash_profile file.
- export PATH=/home/xxx/toolchain/toolchain/pre/binPATH
2. Frameworks is prompted during compilation, or the header file cannot be found.
- Classes/ClockAppDelegate.m:10:38: error: AVFoundation/AVFoundation.h: no such file or directory make: *** [Classes/ClockAppDelegate.o] Error 1
Or the following message is displayed during connection:
- ld: library not found for -lobjc collect2: ld returned 1 exit status make: HelloWorldFirst? Error 1[/pre]
First, check whether the path of the library file and header file is configured in your makefile file, for example, the following settings: # iPhone SDK path
- IPHONESDK = /home/xxx/toolchain/toolchain/sys include path (SDK) INCPATH += -I"$(IPHONESDK)/usr/include" include path (gcc) INCPATH += -I"$(IPHONESDK)/usr/include/gcc/darwin/4.2" CFLAGS += $(INCPATH) \ ... LDFLAGS += -L"$(IPHONESDK)/usr/lib" LDFLAGS += -F"$(IPHONESDK)/System/Library/Frameworks" LDFLAGS += -F"$(IPHONESDK)/System/Library/PrivateFrameworks" CFLAGS += -F"$(IPHONESDK)/System/Library/Frameworks" CFLAGS += -F"$(IPHONESDK)/System/Library/PrivateFrameworks"
If the problem persists, there are two methods to get the latest 3.1.2 version library and header file:
Method 1
Download dyldcache, use scp and other tools to send it to the iPhone, and then execute:
- iPhone$ ./dyldcache /System/Library/Caches/com.apple.
- dyld/dyld_shared_cache_armv6
There are about 4 GB of files after decompression. Pay attention to the remaining size of the iPhone.
After decompression, copy the files in the./out directory to The./toolchain/sys/usr/lib directory on linux.
Method 2
If you do not have an iPhone device, you can extract the library files from the sdk files using the following methods.
1. Download The HFSExplorer tool here. Windows)
2. Use HFSExplorer to open the SDK file. dmg ),
In the Packages directory, extract the iPhoneSDKHeadersAndLibs. pkg file to a directory.
Then copy it to linux. For example, copy it to/tmp.
3. Execute the following command to pressurize the data packet:
- cd /tmp xar -xf iPhoneSDKHeadersAndLibs.pkg Payload zcat Payload | cpio -i
After that, several subdirectories will be generated under the/tmp directory. What we need here is the stuff under the Platforms directory.
Copy the./Platforms/iPhoneOS. platform/Developer/SDKs/iPhoneOS3.1.2.sdk directory and Its subdirectory to the sdks directory of toolchain.
- cp -rp ./Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.2.sdk [/pre] /home/xxx/toolchain/sdks/
Note that the toolchain/sdks/directory already contains the iPhoneOS3.1.2.sdk Directory, which is completely overwritten.
After the above modification, the SDK path in the makefile just now needs to be modified, as shown below.
- #iPhone SDK path IPHONESDK = /home/xxx/toolchain/sdks/iPhoneOS3.1.2.sdk
Next, you can compile your own program and test it on the machine. Don't forget to sign with ldid!
Summary:LinuxArchitectureIPhoneOS3.1.2 the content of the Instance operations in the development environment has been introduced. I hope this article will help you!