Building HDF5 and CLapack libraries in Android Studio

298 views
Skip to first unread message

tresalmasenmimente1

unread,
Nov 12, 2015, 5:39:57 PM11/12/15
to android-ndk
I am working on a project that uses the HDF5 library to read and write big .h5 data files and uses CLapack functions to do all the matrix algebra on the data.  I have been trying for a while now with no success to try to get my C code working in android studio but I have had no success so far.  I am using Android Studio 1.4.1 with the latest version of Android NDK. My gradle file looks like this:


apply plugin: 'com.android.model.application'

model {
android {
compileSdkVersion = 23
buildToolsVersion = "23.0.1"

defaultConfig.with {
applicationId = "com.example.project"
minSdkVersion.apiLevel = 15
targetSdkVersion.apiLevel = 23
// versionCode 1
// versionName "1.0"
}



}



android.ndk {
moduleName = "beamformer-control"
//CFlags += '-Wall'
//CFlags += '-O3'
//CFlags += '-Doff64_t=__off64_t'
//CFlags += '-fPIC'
//CFlags += "-I${file("/app/src/main/jni")}".toString()
//CFlags += "-I${file("/app/src/main/jni/clapack/SRC")}".toString()
//CFlags += "-I${file("/app/src/main/jni/clapack/BLAS/SRC")}".toString()


// CFlags += "-I${file("/app/src/main/jni")}".toString()
// ldFlags += "-Lsrc/main/jniLibs/x86_64"
ldLibs += ["z"]


//ldLibs += ["f2c"]
//ldLibs += "-L/app/src/main/jniLibs/arm64-v8a"
//stl = "gnustl_static"
}

//android.productFlavors{
// create ("x86-64"){
// ndk.abiFilters += "x86_64"
// ndk.ldFlags += "-Lsrc/main/jniLibs/x86_64"
//}
//create("all")
//}


android.buildTypes {
release {
minifyEnabled = false
proguardFiles += file('proguard-rules.txt')
}
}






}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
}



As you can see, I have tried many different things but all have failed. (I am not much of a programmer). I need to run it on a Samsung Galaxy Tab Pro running KitKat 4.4.2 (API 19). I tried using the .so files for the hdf5 library that I built in a 64 bit linux environment but the tablet does not support the 64 bit build.

I also tried throwing all the .c and .h files from the hdf5 library into android studio and got it to compile after eliminating all the errors but it still did not work, the app would error out. I also wasted a lot of time grabbing only the functions I was using and throwing them all in one huge .c and .h file. That also did not work. I think I am missing something. 

Is there any way to build the HDF5 and CLapack .so (or static)  libraries using an Android compiler (say arm64-v8a) so that the code runs on an Android device?  Any help would be appreciated, I have been stuck on this for a while.

Jakub Poła

unread,
Dec 31, 2016, 1:15:22 PM12/31/16
to android-ndk
Hi,
any progress with this subject. I'm interested in using hdf5 library on android device. It doesn't seems to be a popular topic.

Thanks,
Jakub.

Cameron Lowell Palmer

unread,
Jan 26, 2017, 5:17:17 PM1/26/17
to android-ndk
Part of the issue is that HDF5 isn't officially cross-compilable. 
Reply all
Reply to author
Forward
0 new messages