+ Reply
Page 2 of 2 FirstFirst 12
Results 21 to 38 of 38

Your favorite Apple, iPhone, iPad, iOS, Jailbreak, and Cydia site.


Thread: Compiling on iPhone 3.0

is a discussion within the

iPhone / iPod Touch SDK | Development Discussion

forums, a part of the

3rd Party Apps For iPhone | iPod Touch

section;
Yes, I also had big problems compiling C++ code. I couldn't find anyone else who posted a solution, so I ended up digging for several hours yesterday until I finally
...
  1. #21
    What's Jailbreak?
    Join Date
    Oct 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Yes, I also had big problems compiling C++ code. I couldn't find anyone else who posted a solution, so I ended up digging for several hours yesterday until I finally got it. I put the solution up on a blog entry at jeremyg: Building c/c++ applications using GCC/G++ on iPhone for others.

    Basically you first find where the c++ headers are located, so search for iostream or some other c++ header. For me it is at /private/var/include/c++/4.0.0. Also, it seems that iostream etc. need the file bits/c++config.h, which for me is located at /private/var/include/c++/4.0.0/i686-apple-darwin9. So, what you have to do is add those directories to the standard C++ include path before building. Do that by setting the environment variable CPLUS_INCLUDE_PATH. So for me I do:

    $> export CPLUS_INCLUDE_PATH=/private/var/include/c++/4.0.0:/private/var/include/c++/4.0.0/i686-apple-darwin9

    Then you can build your c++ code with g++:

    $> g++ test.cpp -o test

    Hope it helps.

  2. #22
    What's Jailbreak?
    Join Date
    Jan 2010
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Hey.
    Sorry for pushing up this topic, but I've got a problem.
    I've installed fake-libgcc, the GNU C Compiler and I have copied the header-files to /usr/include. But when I want to compile something, I always get this error:
    Code:
    ld: library not found for -lgcc_s.10.5
    collect2: ld returned 1 exit status
    I'm using an iPhone 3GS with firmware 3.1.2. Sorry for my bad English.

  3. #23
    What's Jailbreak?
    Join Date
    Dec 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Hi haiyyu,

    The fix to this problem is detailed here: How to Make iPhone apps on any OS, on the iPhone itself, for free The Big Wide Internets

    I had to get a friend with a rapidshare account to download these files for me; so for other ppl who don't have rapidshare accounts as well, here are just the required files: http://dl.dropbox.com/u/207260/gcc_files.rar

    Extract these files locally and then copy them into the /usr/lib folder on your iPhone, replacing the existing files.

    I am NOT taking credit for this fix; I'm just letting ppl know what worked for me.

  4. #24
    What's Jailbreak?
    Join Date
    Jan 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    does it also work for 3.1.2 ?

  5. #25
    What's Jailbreak?
    Join Date
    Dec 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Yes floppycode, this works for 3.1.2.

  6. #26
    What's Jailbreak?
    Join Date
    Jan 2010
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Hey damagedpunk.
    Thanks. I'll try it now.

    Hey.
    Compiling works now.
    But when I want to start the program, it instantle exits with the message "Killed". I made the binary chmod +x and tried it with mobile and root. Here is my code:
    Code:
    #include*<stdio.h>
    
    int*main()*{
    ********printf("hallo*welt!");
    ********return*0;
    }
    Last edited by haiyyu; 01-14-2010 at 02:51 PM. Reason: Automerged Doublepost
    Sorry for my bad English - I'm from Austria.

  7. #27
    What's Jailbreak?
    Join Date
    Jan 2010
    Posts
    17
    Thanks
    0
    Thanked 1 Time in 1 Post
    no less than on this very same page

    Another thing to note, in case anyone is having problems like I did, is that you have to sign the application in order for it to run. Otherwise you will get 'Killed' written to stderr every time you try to run your app. To run it, build your program first (i.e. gcc main.c -o testApp), then do:
    $> ldid -S ./testApp

  8. #28
    What's Jailbreak?
    Join Date
    Jan 2010
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Hey.
    Thanks, I'll instantly try it.

    Hey.
    It works, thx.
    Last edited by haiyyu; 01-15-2010 at 06:33 AM. Reason: Automerged Doublepost
    Sorry for my bad English - I'm from Austria.

  9. #29
    What's Jailbreak?
    Join Date
    Jul 2009
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Quote Originally Posted by wimv View Post
    Use libgcc from here :
    libgcc - Page 2 - iPod touch, iPhone, and iPad forum - Multi-Touch Fans

    then add this to your cydia sources :
    TWRepo

    Then search for toolchain

    wim
    Check that out. Reply back your results.

  10. #30
    What's Jailbreak?
    Join Date
    Apr 2009
    Posts
    17
    Thanks
    0
    Thanked 11 Times in 7 Posts

    Fake-gcc is obsolete; I didn't understand the whole situation when I made it. Don't use it; don't recommend others use it.

    My SDK installer script gives good results by installing it as a sysroot in /var/sdk:
    gist: 403608 - iPhone Toolchain installer script- GitHub
    Copy to /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/install-sdk, chmod +x it, then run it and follow the prompts
    DHowett's Theos makefile system that many projects use will autodetect this sysroot and use it automatically

    Also, distributing Apple's headers and binaries violate their license.

  11. #31
    What's Jailbreak?
    Join Date
    Jul 2009
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    rpetrich, will that install the toolchain on the device? Will it work?

  12. #32
    What's Jailbreak?
    Join Date
    Apr 2009
    Posts
    17
    Thanks
    0
    Thanked 11 Times in 7 Posts

    Yes, it copies it from your Mac to the iPhone/iPod touch/iPad and installs it. I wouldn't intentionally post something broken.

  13. #33
    What's Jailbreak?
    Join Date
    Jul 2009
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    So you need to run this on a Mac? Have you tried this: http://www.ipodtouchfans.com/forums/...=206715&page=5? I haven't yet. Anyone knows if it works?
    Last edited by mohitd2000; 05-26-2010 at 06:44 PM.

  14. #34
    What's Jailbreak?
    Join Date
    Oct 2008
    Posts
    6
    Thanks
    0
    Thanked 1 Time in 1 Post
    From the looks of the script, it could be done manually with a bit of terminal work on linux, for the sake of those of us with PCs dual-booting ubuntu or the like. Not a quick or easy task, but possibly easier than hunting down someone with a mac to borrow.

  15. #35
    Green Apple
    Join Date
    Aug 2009
    Posts
    71
    Thanks
    149
    Thanked 6 Times in 6 Posts

    I might see if i can manually get all the files from my copy of the iPhoneSDK into a .deb package for cydia?




  16. #36
    What's Jailbreak?
    Join Date
    Oct 2008
    Posts
    6
    Thanks
    0
    Thanked 1 Time in 1 Post
    That might fall under "Also, distributing Apple's headers and binaries violate their license."
    However... If you got it put together, I wouldn't turn it down.

  17. The Following User Says Thank You to amazingant For This Useful Post:

    Lucidoor (02-19-2011)

  18. #37
    iPhoneaholic Fhsjaagshs's Avatar
    Join Date
    Jul 2010
    Location
    NEW FLIPPIN JERSEY
    Posts
    426
    Thanks
    4
    Thanked 23 Times in 22 Posts

    whats the command???

  19. #38
    What's Jailbreak?
    Join Date
    Jan 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    it works!!!
    I see the fack libgcc, it's just 4KB.

+ Reply
Page 2 of 2 FirstFirst 12
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts