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

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

    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
    does it also work for 3.1.2 ?

  5. #25
    Yes floppycode, this works for 3.1.2.

  6. #26
    Hey damagedpunk.
    Thanks. I'll try it now.

    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:
    Last edited by haiyyu; 2010-01-14 at 10:51 PM. Reason: Automerged Doublepost
    Sorry for my bad English - I'm from Austria.

  7. #27
    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
    Thanks, I'll instantly try it.

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

  9. #29
    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 :

    Then search for toolchain

    Check that out. Reply back your results.

  10. #30
    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
    rpetrich, will that install the toolchain on the device? Will it work?

  12. #32
    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
    So you need to run this on a Mac? Have you tried this: I haven't yet. Anyone knows if it works?
    Last edited by mohitd2000; 2010-05-27 at 02:44 AM.

  14. #34
    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
    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
    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 (2011-02-19)

  18. #37
    whats the command???

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

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