Danilo's Tech Blog

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Tuesday, 12 February 2013

How to build the gcc Fortran cross-compiler for Android (ARM and x86)

Posted on 07:09 by Unknown
If you need to cross-compile for Android a program written in Fortran, you know already that the official Android NDK does not come with the gfortran compiler, and if like me you need to port to Android code that depends on Fortran (such as the lapack libraries), you are out of luck.
Fortunately I managed to compile the gcc Fortran cross-compiler with the help of  Mike Long's blog. As an added bonus, I managed to build gfortran 4.8.0 not only for the ARM but also for the x86 toolchain, as well as update the script to the latest Android NDK (currently r8d).
What you need to do is the following:
  1. download the fortran4android shell script.
  2. download the ndk-r8d fortran patch.
  3. run the script in your directory:

    $ fortran4android
  4. wait, wait, wait, ... and you will see in the android-ndk-r8d/toolchains directory two new toolchains called arm-linux-androideabi-4.8.0 and x86-4.8.0
  5. Enjoy your new gfortran compiler.

Note that I've successfully tested the script only on Ubuntu 12.04.

Addendum of August 30, 2013

I now have available a patch for the newer android-ndk-r9. To use this instead of the patch above:
  1. download the ndk-r9-fortran-patch
  2. change the fortran4android script by replacing "r8d" with "r9" everywhere
  3. run the fortran4android script in your directory.
 Note that r9 of the NDK already comes with a 4.8 gcc toolchain and to keep it separated, the fortran4android script will still generate in output a "4.8.0" toolchain.
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in Android, ARM, Fortran, Linux, x86 | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • Problems with new version of rpmbuild
    The Problem With the new version of rpmbuild installed on CentOS 6.x, if you try to use an old RPM spec file, you will get an error like the...
  • Python For Android (Py4A)
    A better solution for cross-compiling Python for Android is to use the Py4A project which is made to be used together with SL4A (Scripting L...
  • Configuring the Apple Airport Extreme with Verizon FIOS
    I have Verizon FIOS triple-play service and I love the TV picture quality and internet speed and reliability, but I don't like Verizon...
  • Arduino and 7-segment LED counter driven by two tactile switches
    I have posted on YouTube a couple of videos about a project I made with the Arduino prototype board. The circuit uses an Arduino mini and ...
  • Welcome
    After many years of searching the web for tips and tricks about computers, operating systems and programming languages, it's finally tim...
  • How to cross-compile Python for Android
    When it comes to cross-compiling Python for Android, I've followed Gabriel's blog post @ http://mdqinc.com/blog/2011/09/cross-compil...
  • Transferring Files from a computer to your Android device
    Android devices have file systems similar to regular computers. Subject to permissions restrictions, we can transfer files from a computer t...
  • How to Cross-Compile libiconv for Android
    If your legacy C/C++ code includes <iconv.h> to convert the encoding of characters from one coded character set to another, and you ne...
  • Porting your Legacy C/C++ project to Android
    This is a recurring problem people have often: trying to port a big C/C++ project to the Android platform. You have thousands of lines of te...
  • Installing the Android NDK
    These instructions refer to a Ubuntu 12.04.1 LTS system running on an Intel processor. Head to the  http://developer.android.com/tools/sdk/n...

Categories

  • Android
  • Apple
  • Arduino
  • ARM
  • busybox
  • CentOS
  • DHCP
  • Fortran
  • GNU
  • GPON
  • iMac
  • Javascript
  • ksh
  • Linux
  • MacOSX
  • Mips
  • Network
  • Python
  • Router
  • UNIX
  • Windows
  • x86

Blog Archive

  • ▼  2013 (12)
    • ►  October (1)
    • ►  August (1)
    • ►  May (1)
    • ▼  February (3)
      • How to compile busybox with Android NDK for both A...
      • How to build the gcc Fortran cross-compiler for An...
      • How to root Motorola RAZRi XT890 running Android 4...
    • ►  January (6)
  • ►  2012 (11)
    • ►  December (2)
    • ►  November (2)
    • ►  October (7)
Powered by Blogger.

About Me

Unknown
View my complete profile