Cross compiling HDF5 clib to arm7 android

I am trying hdf5-1.10.6 with autoconf and cmake; the cmake completed the configuration with android clang 9.0.1 based toolchain set in environment. Then during the make phase failed fast. Before giving up, the script produced two binaries for the target system:

  1. H5detect: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /system/, with debug_info, not stripped
  2. H5make_libsettings: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /system/, with debug_info, not stripped

If I understood correctly these executables are to fill in some arch dependent variables; but executing them on target system segmentation faulted --possibly the dynamic linking – even though I asked strictly static linking? The following ldd is ran on host compiled H5detect:

linux-vdso.so.1 (0x00007ffda754c000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fa03ffaa000)
/lib64/ld-linux-x86-64.so.2 (0x00007fa0405b3000)

target armv7 android:

shamu:/data/local # ./H5detect                                                                                                      
Segmentation fault

Did anyone fiddled with these files, possibly hand write them and succeeded?
best wishes:
steven

supporting output/files:

H5Tinit.c: H5detect$(EXEEXT)
	LD_LIBRARY_PATH="$$LD_LIBRARY_PATH`echo $(LDFLAGS) |                 
		sed -e 's/-L/:/g' -e 's/ //g'`"                               \
	$(RUNSERIAL) ./H5detect$(EXEEXT) > $@  ||                               \
	    (test $$HDF5_Make_Ignore && echo "*** Error ignored") ||          \
	    ($(RM) $@ ; exit 1)

H5lib_settings.c: H5make_libsettings$(EXEEXT) libhdf5.settings
	LD_LIBRARY_PATH="$$LD_LIBRARY_PATH`echo $(LDFLAGS) |                  \
		sed -e 's/-L/:/g' -e 's/ //g'`"                               \
	$(RUNSERIAL) ./H5make_libsettings$(EXEEXT) > $@  ||                               \
	    (test $$HDF5_Make_Ignore && echo "*** Error ignored") ||          \
	    ($(RM) $@ ; exit 1)
Scanning dependencies of target H5detect
[  0%] Building C object src/CMakeFiles/H5detect.dir/H5detect.c.o
[  0%] Linking C executable ../bin/H5detect
[  0%] Built target H5detect
Scanning dependencies of target H5make_libsettings
[  0%] Building C object src/CMakeFiles/H5make_libsettings.dir/H5make_libsettings.c.o
[  0%] Linking C executable ../bin/H5make_libsettings
[  0%] Built target H5make_libsettings
Scanning dependencies of target gen_hdf5-static
[  0%] Generating ../H5Tinit.c, ../gen_SRCS.stamp1
/home/steven/src/android/hdf5-1.10.6/build/bin/H5detect: 1: /home/steven/src/android/hdf5-1.10.6/build/bin/H5detect: Syntax error: word unexpected (expecting ")")
src/CMakeFiles/gen_hdf5-static.dir/build.make:61: recipe for target 'H5Tinit.c' failed
make[2]: *** [H5Tinit.c] Error 2
CMakeFiles/Makefile2:92: recipe for target 'src/CMakeFiles/gen_hdf5-static.dir/all' failed
make[1]: *** [src/CMakeFiles/gen_hdf5-static.dir/all] Error 2
Makefile:151: recipe for target 'all' failed
make: *** [all] Error 2

Crossing HDF5 Clib is tedious process, and in most cases can be avoided by installing gcc on the target platform, then compiling the library. For people with armv7 with hardware float I uploaded the compiled binaries: hdf5-1.10.6-arm7f.tar.gz (4.9 MB)

steve

1 Like

Is there by now a way to build HDF5 for Android? It seems quite sad that this is not better supported…

i think you may need to modify this file for android L hdf5-1.14.3-Std-win10_64-vs17\hdf_examples\HDF5Examples\config\toolchain\aarch64.cmake

suggestions are welcomed.

1 Like