Compile FORTRAN code for iOS

Discussion in 'iOS Programming' started by seidju, Jun 20, 2014.

  1. seidju macrumors newbie

    Joined:
    Jun 20, 2014
    #1
    Hello everyone!

    I have some Fortran application, and i want to compile it for iOS. As i understand correctly i need to configure GCC (from gcc.gnu.org) as cross-compiler, with --target=arm-apple-darwin and --enable-languages=c,c++, fortran.

    With --target=arm-elf, --target=arm-apple-darwin i got error, that it's not supported.

    With --target=arm-none-eabi i got cannot compute suffix of object files: cannot compile Maybe is that because i'm setting wrong configure parameters.

    My question is : what is correct ./confgiure parameters to create gcc cross compiler for iOS platform, which supports FORTRAN.

    Is this the only (right?) way to build cross-compiler for iOS platform, or i could use existing LLVM-GCC? Thanks!
     
  2. mfram macrumors 65816

    Joined:
    Jan 23, 2010
    Location:
    San Diego, CA USA
    #2
    How about trying a FORTRAN-to-C compiler? That would be better than nothing.
     
  3. seidju thread starter macrumors newbie

    Joined:
    Jun 20, 2014
    #3
    I tried f2c, but there's too much work to make this translated code work, it's better to create a static library fro, fortran code and use c functions to access it
     
  4. ArtOfWarfare macrumors G3

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #4
    You can only run C, Obj-C, C++, Obj-C++, and JS code on iOS. If you'd like to run your Fortran code, you're either going to have to port it to one of the supported languages (maybe you can find something that will automate that) or you'll have to write an interpreter or emulator for Fortran in one of the supported languages.

    It may be possible to use other languages if you jailbreak your iPhone, but I don't think people here would be very experienced with that.

    One more thing... iOS devices have ARM processors. Is there even a Fortran compiler that will compile to an ARM processor (just curious - not saying there is or isn't one).
     
  5. seidju thread starter macrumors newbie

    Joined:
    Jun 20, 2014
    #5
    Well, i found post on stackoverflow http://stackoverflow.com/questions/...all-to-fortran-code-to-a-project-in-xcode-4-5

    And i wanted to try to do the same way. But for now my main problem is create GCC Cross-compiler for ARM (iOS) that supports Fortran. I read a tons of information, but still i cannot understand what i should put in --target parameter, when i configure GCC.
     
  6. ArtOfWarfare macrumors G3

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #6
    Why would you ever go through all the described effort? In the end you still need to write a C/H file for each FORTRAN source file. Surely it's much easier to just rewrite your FORTRAN code in C.
     
  7. firewood macrumors 604

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #7
    OS X and the iOS abi no longer officially support gcc or gcc output. Instead, try using f2c to create C source code from Fortran, and then encapsulate the generated C source inside an Objective C wrapper if necessary.
     

Share This Page