I have a library that contains a significant amount of fortran code in it, which I want to build into my android application. Just running make fails, but that seems due to the android toolchain not supporting fortran. So, does anyone have experience getting this to work?
A toolchain which is ready to use with all the configuration that is the system headers and libraries in the correct path . For Android it will also have the API headers in the path where the toolchain can look it up. Why the term "standalone"?
Using Android Studio 2.2 and higher, you can use the NDK to compile C and C++ code into a native library and package it into your APK using Gradle, the IDE's integrated build system. Your Java code can then call functions in your native library through the Java Native Interface (JNI) framework.
$NDK/sysroot is the unified headers and is what you should be using when compiling. When linking, you should still be using $NDK/platforms/android-$API/arch-$ARCH . We do have a doc explaining how to use unified headers in a custom build system: android.googlesource.com/platform/ndk/+/master/docs/….
Ive never used it before but I googled ndk fortran and found this on a blog:
http://specificimpulses.blogspot.com/2011/10/android-fortran-step-by-step-part-3.html
It looks like it could be pretty promising.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With