Skip to content
Advertisement

Jlibfprint cross compilation

I’m trying to cross-compile the JNI Bridge Jlibfprint using buildroot.

This is the source code.

Here is the .mk file:

JLIBFPRINT_VERSION = 775295f08174d11d39da9e327120b128ef270fc4
JLIBFPRINT_SITE = $(call github,eduardobogoni,jlibfprint,$(JLIBFPRINT_VERSION))
JLIBFPRINT_AUTORECONF = YES

JLIBFPRINT_SUBDIR = JlibFprint_jni
#JLIBFPRINT_CONF_OPTS = --enable-debug-log --enable-udev-rules=no --disable-debug-log

JLIBFPRINT_INSTALL_STAGING = YES

define PREPARE_FILES_AND_FIX_DIRECTORY
    cd $(@D)/JlibFprint_jni && 
    libtoolize
endef

JLIBFPRINT_PRE_CONFIGURE_HOOKS += PREPARE_FILES_AND_FIX_DIRECTORY

$(eval $(autotools-package))

Extract, Patch, Update, Configure, Autoreconfiguring, Patching libtool run without problem.

Then it failed at Building stage with this:

libfprint_jni_la-jlibfprint_JlibFprint.o
In file included from jlibfprint_Device.cpp:1:0:
jlibfprint_Device.h:5:10: fatal error: jni.h: No such file or directory
 #include <jni.h>
          ^~~~~~~
compilation terminated.

Then I added, these includes to the /JlibFprint_jni/src/Makefile.am

ADD_INCLUDES=-I/usr/lib/jvm/java-11-openjdk-amd64/include -I/usr/lib/jvm/java-11-openjdk-amd64/include/linux -I/home/mariano/buildroot/output/build/libfprint-0.7.0 -I/home/mariano/buildroot/output/build/libfprint-0.7.0/libfprint/nbis/include

And now it fails with:

arm-linux-gnueabihf-g++: ERROR: unsafe header/library path used in cross-compilation: '-I/usr/lib/jvm/java-11-openjdk-amd64/include'
arm-linux-gnueabihf-g++: ERROR: unsafe header/library path used in cross-compilation: '-I/usr/lib/jvm/java-11-openjdk-amd64/include'
libtool: compile:  /home/mariano/buildroot/output/host/bin/arm-linux-gnueabihf-g++ -DPACKAGE_NAME="libfprint_jni" -DPACKAGE_TARNAME="libfprint_jni" -DPACKAGE_VERSION="1.0" "-DPACKAGE_STRING="libfprint_jni 1.0"" -DPACKAGE_BUGREPORT="" -DPACKAGE_URL="" -DPACKAGE="libfprint_jni" -DVERSION="1.0" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STRING=1 -DHAVE_IOSTREAM=1 -DHAVE_LIBFPRINT_FPRINT_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=".libs/" -I. -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/lib/jvm/java-11-openjdk-amd64/include -I/usr/lib/jvm/java-11-openjdk-amd64/include/linux -I/home/mariano/buildroot/output/build/libfprint-0.7.0 -I/home/mariano/buildroot/output/build/libfprint-0.7.0/libfprint/nbis/include -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -c jlibfprint_JlibFprint.cpp  -fPIC -DPIC -o .libs/libfprint_jni_la-jlibfprint_JlibFprint.o
Makefile:496: recipe for target 'libfprint_jni_la-jlibfprint_Device.lo' failed

Advertisement

Answer

I downloaded JDK for ARM 32 bits and addded the includes into that folder.

I removed the BR2_COMPILER_PARANOID_UNSAFE_PATH=n as Arnout said it was wrong. And it cross-compiled without issues.

I ran the Sample Run and it worked with an Upek fingerprint scanner.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement