Create an iPhone OS3.1.2 Development Environment instance on Linux

Source: Internet
Author: User

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:

 
 
  1. uname -a  Linux localhost.localdomain 2.6.18-1.2798.fc6   
  2. #1 SMP Mon Oct 16 14:54:20 [/pre]  EDT 2006 i686 i686 i386 GNU/Linux  gcc -v  Using built-in specs.    
  3. Target: i386-redhat-linux  config option: ../configure --prefix=/usr --mandir=/usr/share/man [/pre]               
  4. --infodir=/usr/share/info --enable-shared --enable-threads=posix [/pre]                
  5. --enable-checking=release --with-system-zlib --enable-__cxa_atexit [/pre]                
  6. --disable-libunwind-exceptions --enable-libgcj-multifile [/pre]                
  7. --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk [/pre]               
  8. --disable-dssi [/pre]               
  9. --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre [/pre]               
  10. --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.

 
 
  1. Checkout toolchain $ mkdir ~ /Toolchain cd ~ /Toolchain svn checkout [url] http://iphonedevonlinux.googlecode.com/svn/trunk/#/url]
  2. ./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
  3. ./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.

 
 
  1. [blockquote] 

If you encounter a problem with "We need the decryption key for 018-6028-014.dmg.", you can

 
 
  1. DECRYPTION_KEY_SYSTEM = $ .....
  2. Replace with DECRYPTION_KEY_SYSTEM =
 
 
  1. "a8a886d56011d2d98b190d0a498f6fcac719467047639cd601fd53a4a1d93c24e1b2ddc6"  
  2. [/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:

 
 
  1. 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

 
 
  1. ./toolchain.sh headers 

Step 2 also passed

 
 
  1. ./toolchain.sh firmware 

Step 3 is also quite smooth

 
 
  1. ./toolchain.sh darwin_sources 

The last step requires attention.

 
 
  1. ./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

 
 
  1. collect2: ld returned 1 exit status  make[3]: *** [libgcc_s.dylib] error 1 
  2.  ....  
  3. make[2]: *** [stmp-multilib] error 2  
  4. rm gcov.pod fsf-funding.pod gfdl.pod gpl.pod cpp.pod gcc.pod  
  5. .... 
  6.  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:

 
 
  1. 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.

 
 
  1. 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.

 
 
  1. export PATH=/home/xxx/toolchain/toolchain/pre/binPATH  

2. Frameworks is prompted during compilation, or the header file cannot be found.

 
 
  1. 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:

 
 
  1. 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

 
 
  1. 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:

 
 
  1. iPhone$ ./dyldcache /System/Library/Caches/com.apple.  
  2. 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:

 
 
  1. 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.

 
 
  1. 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.

 
 
  1. #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!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.