java-native-access / jna

Java Native Access
Other
8.54k stars 1.68k forks source link

Native Android Build Relies on CPP #1311

Open xloem opened 3 years ago

xloem commented 3 years ago

The newer android NDKS (I'm using 21.4.7075529) do not include a CPP binary. It's replaced by passing -E to CC (so, something like aarch64-linux-android21-clang -E).

native:
     [exec] Generating configure
     [exec] autoreconf: Entering directory `.'
     [exec] autoreconf: configure.ac: not using Gettext
     [exec] autoreconf: running: aclocal -I m4
     [exec] autoreconf: configure.ac: tracing
     [exec] autoreconf: running: libtoolize --copy
     [exec] libtoolize: putting auxiliary files in '.'.
     [exec] libtoolize: copying file './ltmain.sh'
     [exec] libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
     [exec] libtoolize: copying file 'm4/libtool.m4'
     [exec] libtoolize: copying file 'm4/ltoptions.m4'
     [exec] libtoolize: copying file 'm4/ltsugar.m4'
     [exec] libtoolize: copying file 'm4/ltversion.m4'
     [exec] libtoolize: copying file 'm4/lt~obsolete.m4'
     [exec] autoreconf: running: /usr/bin/autoconf
     [exec] autoreconf: running: /usr/bin/autoheader
     [exec] autoreconf: running: automake --add-missing --copy --no-force
     [exec] configure.ac:31: installing './compile'
     [exec] configure.ac:19: installing './install-sh'
     [exec] configure.ac:19: installing './missing'
     [exec] Makefile.am: installing './depcomp'
     [exec] doc/Makefile.am:3: installing 'doc/mdate-sh'
     [exec] doc/Makefile.am:3: installing 'doc/texinfo.tex'
     [exec] Configuring libffi (aarch64)
     [exec] autoreconf: Leaving directory `.'
     [exec] checking build system type... x86_64-pc-linux-gnu
     [exec] checking host system type... aarch64-unknown-linux-android
     [exec] checking target system type... aarch64-unknown-linux-android
     [exec] checking for gsed... sed
     [exec] checking for a BSD-compatible install... /usr/local/bin/install -c
     [exec] checking whether build environment is sane... yes
     [exec] checking for aarch64-linux-android-strip... aarch64-linux-android-strip
     [exec] checking for a thread-safe mkdir -p... /usr/local/bin/mkdir -p
     [exec] checking for gawk... gawk
     [exec] checking whether make sets $(MAKE)... yes
     [exec] checking whether make supports nested variables... yes
     [exec] checking for aarch64-linux-android-gcc... aarch64-linux-android21-clang
     [exec] checking whether the C compiler works... yes
     [exec] checking for C compiler default output file name... a.out
     [exec] checking for suffix of executables... 
     [exec] checking whether we are cross compiling... yes
     [exec] checking for suffix of object files... o
     [exec] checking whether we are using the GNU C compiler... yes
     [exec] checking whether aarch64-linux-android21-clang accepts -g... yes
     [exec] checking for aarch64-linux-android21-clang option to accept ISO C89... none needed
     [exec] checking whether aarch64-linux-android21-clang understands -c and -o together... yes
     [exec] checking whether make supports the include directive... yes (GNU style)
     [exec] configure: WARNING: using cross tools not prefixed with host triplet
     [exec] checking dependency style of aarch64-linux-android21-clang... gcc3
     [exec] checking for aarch64-linux-android-g++... no
     [exec] checking for aarch64-linux-android-c++... no
     [exec] checking for aarch64-linux-android-gpp... no
     [exec] checking for aarch64-linux-android-aCC... no
     [exec] checking for aarch64-linux-android-CC... no
     [exec] checking for aarch64-linux-android-cxx... no
     [exec] checking for aarch64-linux-android-cc++... no
     [exec] checking for aarch64-linux-android-cl.exe... no
     [exec] checking for aarch64-linux-android-FCC... no
     [exec] checking for aarch64-linux-android-KCC... no
     [exec] checking for aarch64-linux-android-RCC... no
     [exec] checking for aarch64-linux-android-xlC_r... no
     [exec] checking for aarch64-linux-android-xlC... no
     [exec] checking for g++... g++
     [exec] checking whether we are using the GNU C++ compiler... yes
     [exec] checking whether g++ accepts -g... yes
     [exec] checking dependency style of g++... gcc3
     [exec] checking dependency style of aarch64-linux-android21-clang... gcc3
     [exec] checking how to print strings... printf
     [exec] checking for a sed that does not truncate output... /bin/sed
     [exec] checking for grep that handles long lines and -e... /bin/grep
     [exec] checking for egrep... /bin/grep -E
     [exec] checking for fgrep... /bin/grep -F
     [exec] checking for ld used by aarch64-linux-android21-clang... /opt/android/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/aarch64-linux-android/bin/ld
     [exec] checking if the linker (/opt/android/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/aarch64-linux-android/bin/ld) is GNU ld... yes
     [exec] checking for BSD- or MS-compatible name lister (nm)... /opt/android/ndk/21.4.7075529/platforms/android-21/../../toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin//aarch64-linux-android-nm -B
     [exec] checking the name lister (/opt/android/ndk/21.4.7075529/platforms/android-21/../../toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin//aarch64-linux-android-nm -B) interface... BSD nm
     [exec] checking whether ln -s works... yes
     [exec] checking the maximum length of command line arguments... 1572864
     [exec] checking how to convert x86_64-pc-linux-gnu file names to aarch64-unknown-linux-android format... func_convert_file_noop
     [exec] checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
     [exec] checking for /opt/android/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/aarch64-linux-android/bin/ld option to reload object files... -r
     [exec] checking for aarch64-linux-android-objdump... aarch64-linux-android-objdump
     [exec] checking how to recognize dependent libraries... pass_all
     [exec] checking for aarch64-linux-android-dlltool... no
     [exec] checking for dlltool... no
     [exec] checking how to associate runtime and link libraries... printf %s\n
     [exec] checking for aarch64-linux-android-ar... aarch64-linux-android-ar
     [exec] checking for archiver @FILE support... @
     [exec] checking for aarch64-linux-android-strip... (cached) aarch64-linux-android-strip
     [exec] checking for aarch64-linux-android-ranlib... aarch64-linux-android-ranlib
     [exec] checking command to parse /opt/android/ndk/21.4.7075529/platforms/android-21/../../toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin//aarch64-linux-android-nm -B output from aarch64-linux-android21-clang object... ok
     [exec] checking for sysroot... no
     [exec] checking for a working dd... /usr/local/bin/dd
     [exec] checking how to truncate binary pipes... /usr/local/bin/dd bs=4096 count=1
     [exec] checking for aarch64-linux-android-mt... no
     [exec] checking for mt... no
     [exec] checking if : is a manifest tool... no
     [exec] checking how to run the C preprocessor... aarch64-linux-android-cpp
     [exec] configure: error: in `/shared/src/jna/build/native-android-aarch64/libffi':
     [exec] configure: error: C preprocessor "aarch64-linux-android-cpp" fails sanity check
     [exec] See `config.log' for more details
     [exec] make: *** [/shared/src/jna/build/native-android-aarch64/libffi/.libs/libffi.a] Error 1

BUILD FAILED
/shared/src/jna/build.xml:1141: exec returned: 2

Additionally the need to pass the correct compiler to ant via CC= should be added to the android documentation in the /www/ subfolder.

matthiasblaesing commented 3 years ago

Fixes are welcome, please don't break builds on old NDKs.