[How-to] Install iPhone SDK on Windows

Discussion in 'iOS Development' started by MrFairladyz, Feb 14, 2009.

  1. MrFairladyz

    MrFairladyz Active Member

    Joined:
    Mar 2, 2008
    Messages:
    1,042
    Likes Received:
    0
    Device:
    iPod touch
    note- this is not installing the sdk directly onto windows. this a method that uses virtualpc 2007. We are going to install ubuntu on virtualpc then install the sdk on ubuntu. Also, this is not my article. original is here try this at your own risk, i wont be providing any help.

    [How-to] Install Ubuntu 8.1 in Virtual PC 2007 for iPhone SDK / Android SDK development

    Install Linux in VMWare is rather straight forward but in Microsoft Virtual PC, it will have screen display problem and fail during installation. The following guide describe the steps involved for the installation, the only pitfall is that sound is not working for the virtual machine of Ubuntu in Virtual PC 2007

    Requirement:
    Windows XP Pro or above
    Microsoft Virtual PC 2007 is free, you can download it from
    http://www.microsoft.com/windows/downloads/virtualpc/default.mspx

    Ubuntu 8.1 is also free
    you should download the 32 bit Intel i386 Desktop version
    http://www.ubuntu.com/getubuntu/download
    MD5 (ubuntu-8-1.10-desktop-i386.iso) = 24ea1163ea6c9f5dae77de8c49ee7c03

    Here are the steps to install Ubuntu 8.1 in Virtual PC 2007.

    (1) Setup the new Virtual Machine in VPC 2007 and mount the iso image (ubuntu-8-1.10-desktop-i386.iso).

    The virtual machine setting is : Harddisk Size 8G (after installation of SDKs and packages of this guide, it will take up about 5G)

    Ram 512MB (more ram is not that useful in this VM)

    (2) Inside the Ubuntu Install Screen, first Press "F4" and Select "Safe Graphics mode"

    (3) Then press down arrow and highlight the menu "Install Ubuntu" (highlight only and don't press Enter)

    (4) Press "F6" to bring up the "Other Options"
    Then type "vesa vga=771" at the end of the option line
    Then Press "Enter", the installation will start instantly.

    Note: If you want other resolution, you can try say vga=791 instead of vga=771

    I did not try all these, some of them might not work. The codes are listed out for reference only.

    vga=769 means 600x480 8 bits color
    vga=785 means 600x480 16 bits color
    vga=786 means 600x480 24 bits color
    vga=771 means 800x600 8 bits color
    vga=788 means 800x600 16 bits color
    vga=789 means 800x600 24 bits color
    vga=773 means 1024x768 8 bits color
    vga=791 means 1024x768 16 bits color
    vga=792 means 1024x768 24 bits color

    During Installation just choose your timezone and language, you will be asked for the username and password and remember what you type

    I choose English Language because I found out that if you choose Chinese, the default folder name will also be in Chinese which is very odd for me. If you choose English, you can enable the lanaguage support in the desktop and add input method later.

    I use sdkuser as username for the installation guide below

    (5) After installation, it will prompt to restart. But the restart might not work and you have to manually reset the VM in VPC 2007

    (6) Then release the mounted iso image and to reset the VM that is in VPC 2007 menu do Action -> Reset

    Please Register or Log in to view images



    After you have installed the Ubuntu 8.1 in VPC 2007, you will have to start installation the necessary packages in Ubuntu

    The purpose of this virtual machine is to develop apps for iPhone SDK and Android SDK. So it will have
    (a) llvm-gcc for iPhone toolchain SDK 2.0
    (b) Android SDK
    (c) Eclipse IDE
    (d) apache 2 websever with php and sqlite3 support (so that you can test some http get/post locally and install your local cydia repository as well)
    (e) samba and open ssh server (so that you can smb mount it or ssh/scp to it)

    (7) Install build essential packages so that you can compile llvm-gcc for iPhone toolchain SDK2.0

    you need to open the Terminal and type these commands


    Code:
     sudo apt-get update 
     sudo apt-get install build-essential bison flex
    

    (8) install server packages so that you can have local webserver and ssh and samba server


    Code:
     sudo apt-get install apache2 php5 libapache2-mod-php5 php5-cli php5-common php5-cgi php5-sqlite openssh-server samba 



    Install php5-sqlite3


    Code:
     sudo apt-get install php-db php-pear 
     wget http://us.archive.ubuntu.com/ubuntu/pool/universe/p/php-sqlite3/php-sqlite3_0.5-1_i386.deb  
     sudo dpkg -i php-sqlite3_0.5-1_i386.deb 



    (9) Create Project folder for smb mount (guest login ok) so that you can use windows / smb mount the virtual machine folder
    (assume sdkuser is the default user account)

    Code:
    mkdir -p /home/sdkuser/Projects 
     chmod 777 /home/sdkuser/Projects


    edit the smb.conf

    Code:
    sudoedit /etc/samba/smb.conf

    and add the followings at the end


    Code:
      
     [Projects] 
        comment = Projects Folder Share 
        writable = yes 
        locking = no 
        path = /home/sdkuser/Projects 
        public = yes 
        browseable = yes 
        guest ok = yes 
        create mask = 0666 
        directory mask = 0777 



    Note : you have to restart samba server to make the new configuration effective if you need to use it right now
    Code:
    sudo /etc/init.d/samba restart


    (10) install jdk6 so that you can compile Andriod app

    Code:
    sudo apt-get install sun-java6-jdk
    

    (11) Download Android SDK http://dl.google.com/android/android-sdk-linux_x86-1.0_r1.zip from http://code.google.com/android/download_list.html

    Install the SDK in ~/Android/
    Code:
    mkdir -p ~/Android/ 
     sudo unzip ~/Desktop/android-sdk-linux_x86-1.0_r1.zip -d ~/Android/ 
     sudo chown -R sdkuser:sdkuser ~/Andriod 



    Create sd card & test emulator and create data directory
    Code:
    ~/Android/android-sdk-linux_x86-1.0_r1/tools/mksdcard -l SD500M 500M ~/Android/sd500m.img 
      
     ~/Android/android-sdk-linux_x86-1.0_r1/tools/emulator -datadir ~/Android -scale 0.7 -sdcard ~/Android/sd500m.img & 



    (12) Download and Install Eclipse 3.4.1 (you can't use the debian package eclipse which is 3.2 only)
    from http://www.eclipse.org/downloads/
    http://www.eclipse.org/downloads/do...R1/eclipse-java-ganymede-SR1-linux-gtk.tar.gz

    Install eclipse in /usr/lib

    Code:
    cd /usr/lib; sudo tar -xzvf ~/Desktop/eclipse-java-ganymede-SR1-linux-gtk.tar.gz 



    Add main menu & icon for eclipse in GNOME
    Code:
    sudoedit /usr/share/applications/eclipse.desktop 



    and save this

    Code:
     
     [Desktop Entry] 
     Name=Eclipse 
     Comment=Develop applications in a variety of different programming languages 
     Exec=/usr/lib/eclipse/eclipse 
     Icon=eclipse48.png 
     Terminal=false 
     Type=Application 
     Categories=Development; 
     StartupNotify=true
    

    There is no eclipse icon in the download file eclipse-java-ganymede-SR1-linux-gtk.tar.gz. You can get it from eclipse 3.2.2 package and install it manually

    download the eclipse 3.2.2 package
    Code:
    wget http://us.archive.ubuntu.com/ubuntu/pool/universe/e/eclipse/eclipse_3.2.2-5ubuntu2_i386.deb


    extract the package and copy the icons to /usr/share/pixmaps/ and clean up
    Code:
    dpkg -x eclipse_3.2.2-5ubuntu2_i386.deb tmp 
     sudo cp tmp/usr/share/pixmaps/* /usr/share/pixmaps/ 
     rm -fr tmp 



    Install Android sdk plug-in for Eclipse
    (based on http://code.google.com/android/intro/installing.html#installingplugin)
    add this site and install in Eclipse
    http://dl-ssl.google.com/android/eclipse/

    Edit Eclipse's preference for Andriod (Window -> Preferences -> Android)

    SDK location
    /home/sdkuser/Android/android-sdk-linux_x86-1.0_r1/

    emulator options
    -scale 0.7 -sdcard /home/sdkuser/Android/sd500m.img

    Test HelloActivity in Eclipse
    (a) Create a New Android Project in Eclipse (File -> New -> Project... -> Android -> Android Project)
    (b) Choose Create project from existing source and browse to ~/Android/android-sdk-linux_x86-1.0_r1/samples/HelloActivity
    (c) Run HelloActivity as Android Application
    (d) Then the emulator will start Hello, World! will be on the emulator screen

    Note: Please don't set the workspace of Eclipse to the sample project folder
    ~/Android/android-sdk-linux_x86-1.0_r1/samples/
    or else you will get error when importing project from existing source

    (13) Install iPhone llvm-gcc and toolchain SDK2.0

    Refer to this article and download the file UpgradeToolChain2.tgz and run the build_20.sh to build the llvm-gcc for iPhone

    http://www.iphone.org.hk/cgi-bin/ch/topic_show.cgi?id=9359

    new!! install ldid in Linux, so that you can fake codesign it


    Code:
     cd ~/Projects 
     wget http://svn.telesphoreo.org/trunk/data/ldid/ldid-1.0.476.tgz  
     tar -zxf ldid-1.0.476.tgz 
     cd ldid-1.0.476 
     g++ -I . -o util/ldid{,.cpp} -x c util/{lookup2,sha1}.c 
     sudo cp -a util/ldid /usr/bin 



    If you need to codesign the iPhone binary in Linux
    add this to your build script


    Code:
     export CODESIGN_ALLOCATE=/usr/toolchain2/pre/bin/arm-apple-darwin9-codesign_allocate; ldid -S $(PROJECTNAME) 


    (14) test apache2 and php so as to see the php info page in the local webserver

    In Firefox browser of Ubuntu enter this address
    http://localhost/

    enable php5 (sometimes you need this)
    Code:
    a2enmod php5


    restart apache server

    Code:
    sudo /etc/init.d/apache2 restart


    create this test.php script in /var/www

    Code:
    sudo chown -R sdkuser:sdkuser /var/www 
     echo "<?php phpinfo(); ?>" > /var/www/test.php
    

    and see the php server info in Firefox browser of Ubuntu
    http://localhost/test.php

    (15) create sqlite3 db for testing


    Code:
     sudo chown -R sdkuser:sdkuser /var/www 
     cd /var/www 
     sqlite3 test.db 
     sqlite> create table test (id integer primary key, value text); 
     sqlite> insert into test (value) values('eenie'); 
     sqlite> 
     sqlite> insert into test (value) values('meenie'); 
     sqlite> insert into test (value) values('miny'); 
     sqlite> insert into test (value) values('mo'); 
     sqlite> select * from test; 
     sqlite> 
     sqlite> .exit 



    and test sqlite3 & php5-sqlite3 by using testdb.php script to test the access to sqlite3 db on webserver


    Code:
     <// Version 0.01 
     <html> 
     <head><meta http-equiv="Content-Type" content="text-html; charset=UTF-8" /></head> 
     <title>iPhone Database</title> 
     <body> 
     <?php 
      
      $ip_dbpath[] = '/var/www/test.db'; 
      
     //   $ip_dbpath[] = '/var/www/sms.db'; 
     //   $ip_dbpath[] = '/var/www/call_history.db'; 
     //   $ip_dbpath[] = '/var/www/notes.db'; 
     //   $ip_dbpath[] = '/var/www/AddressBook.sqlitedb'; 
     //   $ip_dbpath[] = '/var/www/Calendar.sqlitedb'; 
      
     // db location in iPhone /private/var/mobile/Library/SMS/sms.db 
     // db location in iPhone /private/var/mobile/Library/CallHistory/call_history.db 
     // db location in iPhone /private/var/mobile/Library/Notes/notes.db 
     // db location in iPhone /private/var/mobile/Library/AddressBook/AddressBook.sqlitedb 
     // db location in iPhone /private/var/mobile/Library/Calendar/Calendar.sqlitedb 
      
      $ip_dbdesc[] = 'test'; 
      
     //   $ip_dbdesc[] = 'SMS'; 
     //   $ip_dbdesc[] = 'Call History'; 
     //   $ip_dbdesc[] = 'Notes'; 
     //   $ip_dbdesc[] = 'Address Book'; 
     //   $ip_dbdesc[] = 'Calendar'; 
      
     $ip_query[] = 'SELECT * from test order by 1'; 
     // $ip_query[] = 'SELECT  date, address, text FROM message order by 1 desc, 2;'; 
     // $ip_query[] = 'SELECT  date, address, duration FROM call order by 1 desc;'; 
     // $ip_query[] = 'SELECT  creation_date, data, title FROM Note inner join note_bodies on Note.ROWID = note_bodies.note_id order by 1;'; 
     // $ip_query[] = 'SELECT First, Last, Middle, CreationDate, ModificationDate FROM ABPerson;'; 
     // $ip_query[] = 'SELECT start_date, end_date, summary, location, description FROM Event order by 1, 2;'; 
      
     // $dbcount = sizeof($ip_dbpath); 
     // if you uncomment the above db & query and add copy the iPhone db , you can list out the content of sqlitedb of iPhone 
     $dbcount = 1; 
      
     for ($dbnum=0;$dbnum<$dbcount;$dbnum++){ 
      
      try { 
        $dbpath = $ip_dbpath[ $dbnum ]; 
        $dbh = new PDO('sqlite:'.$dbpath); 
        $query = $ip_query[ $dbnum ]; 
        $stmt = $dbh->prepare($query); 
        $stmt->execute(); 
      } 
      catch (PDOException $e) { 
        die("Could not open database" . $e->getMessage()); 
      } 
      $colcount = $stmt->columnCount(); 
      echo "<h1>". $ip_dbdesc[ $dbnum ] . "</h1>"; 
      echo "<table cellpadding=10 border=1>"; 
      
        for ($i=0;$i<$colcount;$i++) { 
           $meta = $stmt->getColumnMeta($i); 
           echo "<td>".$meta["name"]."</td>"; 
        } 
      
        while ($row = $stmt->fetch()) { 
            echo "<tr>"; 
            for ($i=0;$i<$colcount;$i++) { 
              $meta = $stmt->getColumnMeta($i); 
              if ($meta["native_type"] == "null") { 
                echo "<td> </td>"; 
              } 
              elseif (preg_match("/date$/i", $meta["name"])) { 
                echo "<td>". date("j M Y D g.i a", $row&i;)."</td>"; 
              } 
              elseif (preg_match("/[call|sms]$/i", $meta["name"]) && $meta["name"] == "address" && strlen(rtrim($row[ $i])) == 8) { 
               echo "<td><A href='Tel:".$row&i;."'>".$row&i;."</A></td>"; 
              } 
              else { 
                echo "<td>".$row[ $i]."</td>"; 
              } 
            } 
            echo "</tr>"; 
        } 
        echo "</table>"; 
     } 
     ?> 
     </body> 
     </html> 

    Please Register or Log in to view images




    Additional Notes

    -----------------------
    If you need to install flash plugin in firefox

    Code:
    sudo apt-get install flashplugin-nonfree


    If you need to install java plugin in firefox

    Code:
    sudo apt-get install sun-java6-plugin


    If you need to install xpdf
    Code:
    sudo apt-get install xpdf-reader


    If you need to install jedit

    Code:
    sudo apt-get install jedit

    .....
  2. Tyr0

    Tyr0 New Member

    Joined:
    Dec 17, 2007
    Messages:
    533
    Likes Received:
    6
    Device:
    iPhone 3GS (White)
    trying now in my REAL linux partition...
    so... if i read it correctly, this allows me to PROGRAM FOR the IPHONE in linux? wow.
  3. tttooommm

    tttooommm New Member

    Joined:
    Sep 28, 2008
    Messages:
    119
    Likes Received:
    0
    Device:
    iPhone 3GS (Black)
    this works?
  4. MrFairladyz

    MrFairladyz Active Member

    Joined:
    Mar 2, 2008
    Messages:
    1,042
    Likes Received:
    0
    Device:
    iPod touch
    i havent tried it, just found the article and pasted it here

    Please Register or Log in to view images


    ------------------double post merged------------------
    you may want to try this then http://www.ifans.com/forums/showthread.php?t=145268

    i tried it but cant get it to run.... im a total linux n00b, so i dno if i did it right.
  5. Tyr0

    Tyr0 New Member

    Joined:
    Dec 17, 2007
    Messages:
    533
    Likes Received:
    6
    Device:
    iPhone 3GS (White)
    PHP:
    yeah, i already did that, worked fine on my Ubuntu 8.04.1 installation. But i wanna see if this Eclipse SDK works too. just bored and was something new to try.

    Please Register or Log in to view images

  6. MrFairladyz

    MrFairladyz Active Member

    Joined:
    Mar 2, 2008
    Messages:
    1,042
    Likes Received:
    0
    Device:
    iPod touch
    seiously?? the sdk is up and running? how did you start the app? edit: and was it that tut you followed? if not, which one? i seariously want the sdk, but it think i installed wrong. running 8.10

    edit: im just gonna try this tut.

    edit: how do i save my modifications after i typed




    [Projects]
    comment = Projects Folder Share
    writable = yes
    locking = no
    path = /home/user/Projects
    public = yes
    browseable = yes
    guest ok = yes
    create mask = 0666
    directory mask = 0777

    onto samba.whatever in terminal? it says "modified" but i dno how to save... edit: had to use "gksudo gedit /etc/samba/smb.conf" instead of just "sudo"
  7. gleesonger

    gleesonger New Member

    Joined:
    Nov 27, 2008
    Messages:
    40
    Likes Received:
    0
    Device:
    2G iPod touch
    Personally I installed kalyway 10.5.2 onto a separate partition which was no problem followed a guide to update to 10.5.6 as .4 up is required for the sdk.Installed fine but the keyboard/touchpad didn't work at all.After reading many many articles I read that in the .1 to .2 it was at times necessary to replace a particular .kext so I had to set my mac partition to inactive boot to kalyway installation disk launch terminal and replace the file.All in all I have a perfectly working mackintosh dual booted with xp.Now to learn objective C...
  8. Tyr0

    Tyr0 New Member

    Joined:
    Dec 17, 2007
    Messages:
    533
    Likes Received:
    6
    Device:
    iPhone 3GS (White)
    @gleesonger, yeah, did that too, actually im booted in leopard now. But i found that iPC 10.5.6 was easier, as no need to go through update hassles, and super easy to install on my Sony Vaio VGN-FZ220U. Just a couple things wrong, but i just got it mostly working now, FULL REZ FTW! Already know objective-c, so now i gotta get the Open SDK!
    p.s. got a mac on my desk too,

    Please Register or Log in to view images

  9. manutdfan539

    manutdfan539 New Member

    Joined:
    Jan 16, 2009
    Messages:
    611
    Likes Received:
    0
    Device:
    iPhone 4 (Black)
    This looks like a lazy Saturday thing...

    Is there anyway I could get Mac OS instead of Ubuntu? Thanx
  10. MrFairladyz

    MrFairladyz Active Member

    Joined:
    Mar 2, 2008
    Messages:
    1,042
    Likes Received:
    0
    Device:
    iPod touch
    hackint0sh... try something called kalyway.

    then just install strait from apple.

Share This Page