OpenDDS / OpenDDS-Android

An OpenDDS Build Matrix for Android
8 stars 3 forks source link

Iconv Fails to Compile using r22 #7

Closed iguessthislldo closed 3 years ago

iguessthislldo commented 3 years ago

Link

configure: creating ./config.status
config.status: creating Makefile
config.status: creating lib/Makefile
config.status: creating include/localcharset.h
config.status: creating include/localcharset.h.inst
config.status: creating config.h
config.status: executing libtool commands
builddir="`pwd`"; cd libcharset && make all && make install-lib libdir="$builddir/lib" includedir="$builddir/lib"
make[1]: Entering directory '/home/runner/work/OpenDDS-Android/OpenDDS-Android/iconv_source/libcharset'
if [ ! -d include ] ; then mkdir include ; fi
cp ./include/libcharset.h.in include/libcharset.h
make[1]: Leaving directory '/home/runner/work/OpenDDS-Android/OpenDDS-Android/iconv_source/libcharset'
cd lib && make all
make[2]: Entering directory '/home/runner/work/OpenDDS-Android/OpenDDS-Android/iconv_source/libcharset/lib'
/bin/bash ../libtool --mode=compile arm-linux-androideabi-clang -I. -I. -I.. -I./.. -I../include -fPIE -fPIC -fvisibility=hidden  -DBUILDING_LIBCHARSET -DHAVE_CONFIG_H -c ./relocatable-stub.c
libtool: compile:  arm-linux-androideabi-clang -I. -I. -I.. -I./.. -I../include -fPIC -fvisibility=hidden -DBUILDING_LIBCHARSET -DHAVE_CONFIG_H -c ./relocatable-stub.c  -fPIC -DPIC -o .libs/relocatable-stub.o
libtool: compile:  arm-linux-androideabi-clang -I. -I. -I.. -I./.. -I../include -fPIC -fvisibility=hidden -DBUILDING_LIBCHARSET -DHAVE_CONFIG_H -c ./relocatable-stub.c -fPIE -o relocatable-stub.o >/dev/null 2>&1
make[2]: Leaving directory '/home/runner/work/OpenDDS-Android/OpenDDS-Android/iconv_source/libcharset/lib'
make[2]: Entering directory '/home/runner/work/OpenDDS-Android/OpenDDS-Android/iconv_source/libcharset/lib'
/bin/bash ../libtool --mode=compile arm-linux-androideabi-clang -I. -I. -I.. -I./.. -I../include -fPIE -fPIC -fvisibility=hidden  -DBUILDING_LIBCHARSET -DHAVE_CONFIG_H -c ./localcharset.c
libtool: compile:  arm-linux-androideabi-clang -I. -I. -I.. -I./.. -I../include -fPIC -fvisibility=hidden -DBUILDING_LIBCHARSET -DHAVE_CONFIG_H -c ./localcharset.c  -fPIC -DPIC -o .libs/localcharset.o
libtool: compile:  arm-linux-androideabi-clang -I. -I. -I.. -I./.. -I../include -fPIC -fvisibility=hidden -DBUILDING_LIBCHARSET -DHAVE_CONFIG_H -c ./localcharset.c -fPIE -o localcharset.o >/dev/null 2>&1
make[2]: Leaving directory '/home/runner/work/OpenDDS-Android/OpenDDS-Android/iconv_source/libcharset/lib'
make[2]: Entering directory '/home/runner/work/OpenDDS-Android/OpenDDS-Android/iconv_source/libcharset/lib'
/bin/bash ../libtool --mode=link arm-linux-androideabi-clang -pie -fPIE -fPIC -fvisibility=hidden -o libcharset.la -rpath /home/runner/work/OpenDDS-Android/OpenDDS-Android/secdeps_prefix/lib -version-info 1:0:0 -no-undefined localcharset.lo relocatable-stub.lo
libtool: link: arm-linux-androideabi-ar cru .libs/libcharset.a  localcharset.o relocatable-stub.o
libtool: link: arm-linux-androideabi-ranlib .libs/libcharset.a
libtool: link: ( cd ".libs" && rm -f "libcharset.la" && ln -s "../libcharset.la" "libcharset.la" )
make[2]: Leaving directory '/home/runner/work/OpenDDS-Android/OpenDDS-Android/iconv_source/libcharset/lib'
cd lib && make all
make[2]: Nothing to be done for 'all'.
cd lib && make install-lib libdir='/home/runner/work/OpenDDS-Android/OpenDDS-Android/iconv_source/lib' includedir='/home/runner/work/OpenDDS-Android/OpenDDS-Android/iconv_source/lib'
make[2]: Entering directory '/home/runner/work/OpenDDS-Android/OpenDDS-Android/iconv_source/libcharset/lib'
/usr/bin/install: cannot stat '.libs/libcharset.so': No such file or directory
/bin/bash ../build-aux/mkinstalldirs /home/runner/work/OpenDDS-Android/OpenDDS-Android/iconv_source/lib
make[2]: *** [install-lib] Error 1
/bin/bash ../libtool --mode=install /usr/bin/install -c libcharset.la /home/runner/work/OpenDDS-Android/OpenDDS-Android/iconv_source/lib/libcharset.la
make[1]: *** [install-lib] Error 2
libtool: install: /usr/bin/install -c .libs/libcharset.so /home/runner/work/OpenDDS-Android/OpenDDS-Android/iconv_source/lib/libcharset.so
make: *** [lib/localcharset.h] Error 2
Makefile:66: recipe for target 'install-lib' failed
make[2]: Leaving directory '/home/runner/work/OpenDDS-Android/OpenDDS-Android/iconv_source/libcharset/lib'
Makefile:43: recipe for target 'install-lib' failed
Makefile:41: recipe for target 'lib/localcharset.h' failed
Error: Process completed with exit code 2.
mitza-oci commented 3 years ago

I assume you are configuring GNU libiconv with --disable-shared, but it still wants to install a *.so file?

iguessthislldo commented 3 years ago

It's not configured like that. Out of curiosity I just tried it locally with --disable-shared. It gets further, but gets to another strange error.

...
cd po && make all
make[1]: Nothing to be done for 'all'.
cd man && make all
make[1]: Nothing to be done for 'all'.
if test -d tests; then cd tests && make all; fi
make[1]: Nothing to be done for 'all'.
mkdir: missing operand
Try 'mkdir --help' for more information.
iguessthislldo commented 3 years ago

I also tried it with r21d locally and it failed there too... I think I messed up something, but I'm not sure what.

mitza-oci commented 3 years ago

docs/android.md says we should use --disable-shared. Was there a change in GNU libiconv itself? Or is this using a pegged version?

iguessthislldo commented 3 years ago

I think that's for OpenSSL.

mitza-oci commented 3 years ago
Xerces requires a supported "transcoder" library. For API levels greater than
or equal to 28 one of these, GNU libiconv, is included with Android. Before 28
any of the transcoders supported by Xerces would work theoretically but GNU
libiconv was the one tested.  If GNU libiconv is used, build it as an archive
library (--disable-shared) so that the users of Xerces (ACE and OpenDDS) don't
need to be aware of it as an additional runtime dependency.
iguessthislldo commented 3 years ago

Alright, but I've never configured it like that here.

iguessthislldo commented 3 years ago

So I checked again using the last working commit and the difference is in the NDKs. This is the diff between the two up to the error:

diff --git a/r21 b/r22
index 789b6a5..4f61465 100644
--- a/r21
+++ b/r22
@@ -50,9 +50,9 @@ checking how to print strings... printf
 checking for a sed that does not truncate output... /bin/sed
 checking for fgrep... /bin/grep -F
 checking for ld used by aarch64-linux-android-clang... aarch64-linux-android-ld
-checking if the linker (aarch64-linux-android-ld) is GNU ld... yes
-checking for BSD- or MS-compatible name lister (nm)... /home/fred/oci/dds/android/OpenDDS-Android/r21d-arm64-android-27-toolchain/bin/aarch64-linux-android-nm -B
-checking the name lister (/home/fred/oci/dds/android/OpenDDS-Android/r21d-arm64-android-27-toolchain/bin/aarch64-linux-android-nm -B) interface... BSD nm
+checking if the linker (aarch64-linux-android-ld) is GNU ld... no
+checking for BSD- or MS-compatible name lister (nm)... /home/fred/oci/dds/android/OpenDDS-Android/r22-arm64-android-27-toolchain/bin/aarch64-linux-android-nm -B
+checking the name lister (/home/fred/oci/dds/android/OpenDDS-Android/r22-arm64-android-27-toolchain/bin/aarch64-linux-android-nm -B) interface... BSD nm
 checking whether ln -s works... yes
 checking the maximum length of command line arguments... 1572864
 checking how to convert x86_64-pc-linux-gnu file names to aarch64-unknown-linux-android format... func_convert_file_noop
@@ -67,7 +67,7 @@ checking for aarch64-linux-android-ar... (cached) aarch64-linux-android-ar
 checking for archiver @FILE support... @
 checking for aarch64-linux-android-strip... (cached) aarch64-linux-android-strip
 checking for aarch64-linux-android-ranlib... (cached) aarch64-linux-android-ranlib
-checking command to parse /home/fred/oci/dds/android/OpenDDS-Android/r21d-arm64-android-27-toolchain/bin/aarch64-linux-android-nm -B output from aarch64-linux-android-clang object... ok
+checking command to parse /home/fred/oci/dds/android/OpenDDS-Android/r22-arm64-android-27-toolchain/bin/aarch64-linux-android-nm -B output from aarch64-linux-android-clang object... ok
 checking for sysroot... no
 checking for a working dd... /bin/dd
 checking how to truncate binary pipes... /bin/dd bs=4096 count=1
@@ -84,7 +84,6 @@ checking if aarch64-linux-android-clang static flag -static works... no
 checking if aarch64-linux-android-clang supports -c -o file.o... yes
 checking if aarch64-linux-android-clang supports -c -o file.o... (cached) yes
 checking whether the aarch64-linux-android-clang linker (aarch64-linux-android-ld) supports shared libraries... yes
-checking whether -lc should be explicitly linked in... no
 checking dynamic linker characteristics... Android linker
 checking how to hardcode library paths into programs... immediate
 checking whether stripping libraries is possible... yes
@@ -92,7 +91,7 @@ checking if libtool supports shared libraries... yes
 checking whether to build shared libraries... yes
 checking whether to build static libraries... no
 checking for ld... aarch64-linux-android-ld
-checking if the linker (aarch64-linux-android-ld) is GNU ld... yes
+checking if the linker (aarch64-linux-android-ld) is GNU ld... no
 checking for shared library path variable... LD_LIBRARY_PATH
 checking whether to activate relocatable installation... no
 checking how to copy files... cp -p
@@ -307,9 +306,9 @@ checking how to print strings... printf
 checking for a sed that does not truncate output... /bin/sed
 checking for fgrep... /bin/grep -F
 checking for ld used by aarch64-linux-android-clang... aarch64-linux-android-ld
-checking if the linker (aarch64-linux-android-ld) is GNU ld... yes
-checking for BSD- or MS-compatible name lister (nm)... /home/fred/oci/dds/android/OpenDDS-Android/r21d-arm64-android-27-toolchain/bin/aarch64-linux-android-nm -B
-checking the name lister (/home/fred/oci/dds/android/OpenDDS-Android/r21d-arm64-android-27-toolchain/bin/aarch64-linux-android-nm -B) interface... BSD nm
+checking if the linker (aarch64-linux-android-ld) is GNU ld... no
+checking for BSD- or MS-compatible name lister (nm)... /home/fred/oci/dds/android/OpenDDS-Android/r22-arm64-android-27-toolchain/bin/aarch64-linux-android-nm -B
+checking the name lister (/home/fred/oci/dds/android/OpenDDS-Android/r22-arm64-android-27-toolchain/bin/aarch64-linux-android-nm -B) interface... BSD nm
 checking whether ln -s works... yes
 checking the maximum length of command line arguments... 1572864
 checking how to convert x86_64-pc-linux-gnu file names to aarch64-unknown-linux-android format... func_convert_file_noop
@@ -325,7 +324,7 @@ checking for archiver @FILE support... @
 checking for aarch64-linux-android-strip... aarch64-linux-android-strip
 checking for aarch64-linux-android-ranlib... aarch64-linux-android-ranlib
 checking for gawk... gawk
-checking command to parse /home/fred/oci/dds/android/OpenDDS-Android/r21d-arm64-android-27-toolchain/bin/aarch64-linux-android-nm -B output from aarch64-linux-android-clang object... ok
+checking command to parse /home/fred/oci/dds/android/OpenDDS-Android/r22-arm64-android-27-toolchain/bin/aarch64-linux-android-nm -B output from aarch64-linux-android-clang object... ok
 checking for sysroot... no
 checking for a working dd... /bin/dd
 checking how to truncate binary pipes... /bin/dd bs=4096 count=1
@@ -342,7 +341,6 @@ checking if aarch64-linux-android-clang static flag -static works... no
 checking if aarch64-linux-android-clang supports -c -o file.o... yes
 checking if aarch64-linux-android-clang supports -c -o file.o... (cached) yes
 checking whether the aarch64-linux-android-clang linker (aarch64-linux-android-ld) supports shared libraries... yes
-checking whether -lc should be explicitly linked in... no
 checking dynamic linker characteristics... Android linker
 checking how to hardcode library paths into programs... immediate
 checking whether stripping libraries is possible... yes
@@ -350,7 +348,7 @@ checking if libtool supports shared libraries... yes
 checking whether to build shared libraries... yes
 checking whether to build static libraries... yes
 checking for ld... aarch64-linux-android-ld
-checking if the linker (aarch64-linux-android-ld) is GNU ld... yes
+checking if the linker (aarch64-linux-android-ld) is GNU ld... no
 checking for shared library path variable... LD_LIBRARY_PATH
 checking whether to activate relocatable installation... no
 checking whether the -Werror option is usable... yes
@@ -386,7 +384,6 @@ libtool: compile:  aarch64-linux-android-clang -I. -I. -I.. -I./.. -I../include
 make[2]: Leaving directory '/data/work/oci/dds/android/OpenDDS-Android/iconv_source/libcharset/lib'
 make[2]: Entering directory '/data/work/oci/dds/android/OpenDDS-Android/iconv_source/libcharset/lib'
 /bin/bash ../libtool --mode=link aarch64-linux-android-clang -pie -fPIE -fPIC -fvisibility=hidden -o libcharset.la -rpath /home/fred/oci/dds/android/OpenDDS-Android/secdeps_prefix/lib -version-info 1:0:0 -no-undefined localcharset.lo relocatable-stub.lo
-libtool: link: aarch64-linux-android-clang -shared  -fPIC -DPIC  .libs/localcharset.o .libs/relocatable-stub.o      -Wl,-soname -Wl,libcharset.so -o .libs/libcharset.so
 libtool: link: aarch64-linux-android-ar cru .libs/libcharset.a  localcharset.o relocatable-stub.o
 libtool: link: aarch64-linux-android-ranlib .libs/libcharset.a
 libtool: link: ( cd ".libs" && rm -f "libcharset.la" && ln -s "../libcharset.la" "libcharset.la" )
@@ -398,956 +395,11 @@ make[2]: Entering directory '/data/work/oci/dds/android/OpenDDS-Android/iconv_so
 /bin/bash ../build-aux/mkinstalldirs /home/fred/oci/dds/android/OpenDDS-Android/iconv_source/lib
 /bin/bash ../libtool --mode=install /usr/bin/install -c libcharset.la /home/fred/oci/dds/android/OpenDDS-Android/iconv_source/lib/libcharset.la
 libtool: install: /usr/bin/install -c .libs/libcharset.so /home/fred/oci/dds/android/OpenDDS-Android/iconv_source/lib/libcharset.so
-libtool: install: /usr/bin/install -c .libs/libcharset.lai /home/fred/oci/dds/android/OpenDDS-Android/iconv_source/lib/libcharset.la
-libtool: install: /usr/bin/install -c .libs/libcharset.a /home/fred/oci/dds/android/OpenDDS-Android/iconv_source/lib/libcharset.a
-libtool: install: chmod 644 /home/fred/oci/dds/android/OpenDDS-Android/iconv_source/lib/libcharset.a
-libtool: install: aarch64-linux-android-ranlib /home/fred/oci/dds/android/OpenDDS-Android/iconv_source/lib/libcharset.a
-libtool: warning: remember to run 'libtool --finish /home/fred/oci/dds/android/OpenDDS-Android/secdeps_prefix/lib'
+/usr/bin/install: cannot stat '.libs/libcharset.so': No such file or directory
+Makefile:66: recipe for target 'install-lib' failed
+make[2]: *** [install-lib] Error 1
 make[2]: Leaving directory '/data/work/oci/dds/android/OpenDDS-Android/iconv_source/libcharset/lib'

It looks like the only real difference up to the point where it decides not to run libtool: link: aarch64-linux-android-clang -shared -fPIC -DPIC .libs/localcharset.o .libs/relocatable-stub.o -Wl,-soname -Wl,libcharset.so -o .libs/libcharset.so is that it sees ld is not GNU ld. This was changed in r22. Appending ".gold" to LD fixes the issue with r22. I don't think this is a real solution though because everything should probably be using the same linker.

iguessthislldo commented 3 years ago

Okay the actual issue is that LLVM ld isn't being prefixed like GNU ld was (ex: aarch64-linux-android-ld), so autoconf can't find the linker I'm telling it about. It's kinda annoying because I thought they are already a little inconsistent about what the names of the programs are. Will push a change to use LLD if the NDK is r22 or higher.