./configure --prefix=/usr --host=arm-unknown-linux-gnu --build=i686-pc-linux-gnu make fails at native/jni/java-net (see log below). I'm afraid that I haven't been able to fix it, but I've been trying for 2 days. It definitely has something to do with autotools' attempts to find The Right (TM) directory containing libmagic.so. In my case, it's /usr/arm-unknown-linux-gnu/usr/lib, but that is somehow mistaken for /usr/lib. If I change native/jni/java-net/Makefile* as shown below, then it works for me, although that's obviously not portable. I would suggest somehow preventing -lmagic from being substituted with /usr/lib/libmagic.so.1.0.0 @@ -339,8 +339,7 @@ $(local_sources) libjavanet_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo \ - $(top_builddir)/native/jni/native-lib/libclasspathnative.la \ - $(LIBMAGIC) + $(top_builddir)/native/jni/native-lib/libclasspathnative.la ... - $(LINK) -rpath $(nativeexeclibdir) $(libjavanet_la_LDFLAGS) $(libjavanet_la_OBJECTS) $(libjavanet_la_LIBADD) $(LIBS) + $(LINK) -rpath $(nativeexeclibdir) $(libjavanet_la_LDFLAGS) $(libjavanet_la_OBJECTS) $(libjavanet_la_LIBADD) $(LIBS) /usr/arm-unknown-linux-gnu/usr/lib/libmagic.so.1.0.0 Build log: Making all in java-net make[3]: Entering directory `/home/cfriedt/Desktop/blah/classpath-0.97.1/native/jni/java-net' /bin/sh ../../../libtool --tag=CC --mode=compile arm-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I../../../include -I../../../include -I../../../native/jni/classpath -I../../../native/jni/native-lib -W -Wall -Wmissing-declarations -Wwrite-strings -Wmissing-prototypes -Wno-long-long -Wstrict-prototypes -pedantic -g -O2 -c -o javanet.lo javanet.c mkdir .libs arm-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I../../../include -I../../../include -I../../../native/jni/classpath -I../../../native/jni/native-lib -W -Wall -Wmissing-declarations -Wwrite-strings -Wmissing-prototypes -Wno-long-long -Wstrict-prototypes -pedantic -g -O2 -c javanet.c -fPIC -DPIC -o .libs/javanet.o arm-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I../../../include -I../../../include -I../../../native/jni/classpath -I../../../native/jni/native-lib -W -Wall -Wmissing-declarations -Wwrite-strings -Wmissing-prototypes -Wno-long-long -Wstrict-prototypes -pedantic -g -O2 -c javanet.c -o javanet.o >/dev/null 2>&1 /bin/sh ../../../libtool --tag=CC --mode=compile arm-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I../../../include -I../../../include -I../../../native/jni/classpath -I../../../native/jni/native-lib -W -Wall -Wmissing-declarations -Wwrite-strings -Wmissing-prototypes -Wno-long-long -Wstrict-prototypes -pedantic -g -O2 -c -o java_net_VMInetAddress.lo java_net_VMInetAddress.c arm-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I../../../include -I../../../include -I../../../native/jni/classpath -I../../../native/jni/native-lib -W -Wall -Wmissing-declarations -Wwrite-strings -Wmissing-prototypes -Wno-long-long -Wstrict-prototypes -pedantic -g -O2 -c java_net_VMInetAddress.c -fPIC -DPIC -o .libs/java_net_VMInetAddress.o arm-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I../../../include -I../../../include -I../../../native/jni/classpath -I../../../native/jni/native-lib -W -Wall -Wmissing-declarations -Wwrite-strings -Wmissing-prototypes -Wno-long-long -Wstrict-prototypes -pedantic -g -O2 -c java_net_VMInetAddress.c -o java_net_VMInetAddress.o >/dev/null 2>&1 /bin/sh ../../../libtool --tag=CC --mode=compile arm-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I../../../include -I../../../include -I../../../native/jni/classpath -I../../../native/jni/native-lib -W -Wall -Wmissing-declarations -Wwrite-strings -Wmissing-prototypes -Wno-long-long -Wstrict-prototypes -pedantic -g -O2 -c -o java_net_VMNetworkInterface.lo java_net_VMNetworkInterface.c arm-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I../../../include -I../../../include -I../../../native/jni/classpath -I../../../native/jni/native-lib -W -Wall -Wmissing-declarations -Wwrite-strings -Wmissing-prototypes -Wno-long-long -Wstrict-prototypes -pedantic -g -O2 -c java_net_VMNetworkInterface.c -fPIC -DPIC -o .libs/java_net_VMNetworkInterface.o arm-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I../../../include -I../../../include -I../../../native/jni/classpath -I../../../native/jni/native-lib -W -Wall -Wmissing-declarations -Wwrite-strings -Wmissing-prototypes -Wno-long-long -Wstrict-prototypes -pedantic -g -O2 -c java_net_VMNetworkInterface.c -o java_net_VMNetworkInterface.o >/dev/null 2>&1 /bin/sh ../../../libtool --tag=CC --mode=compile arm-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I../../../include -I../../../include -I../../../native/jni/classpath -I../../../native/jni/native-lib -W -Wall -Wmissing-declarations -Wwrite-strings -Wmissing-prototypes -Wno-long-long -Wstrict-prototypes -pedantic -g -O2 -c -o java_net_VMURLConnection.lo java_net_VMURLConnection.c arm-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I../../../include -I../../../include -I../../../native/jni/classpath -I../../../native/jni/native-lib -W -Wall -Wmissing-declarations -Wwrite-strings -Wmissing-prototypes -Wno-long-long -Wstrict-prototypes -pedantic -g -O2 -c java_net_VMURLConnection.c -fPIC -DPIC -o .libs/java_net_VMURLConnection.o arm-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I../../../include -I../../../include -I../../../native/jni/classpath -I../../../native/jni/native-lib -W -Wall -Wmissing-declarations -Wwrite-strings -Wmissing-prototypes -Wno-long-long -Wstrict-prototypes -pedantic -g -O2 -c java_net_VMURLConnection.c -o java_net_VMURLConnection.o >/dev/null 2>&1 /bin/sh ../../../libtool --tag=CC --mode=compile arm-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I../../../include -I../../../include -I../../../native/jni/classpath -I../../../native/jni/native-lib -W -Wall -Wmissing-declarations -Wwrite-strings -Wmissing-prototypes -Wno-long-long -Wstrict-prototypes -pedantic -g -O2 -c -o gnu_java_net_VMPlainSocketImpl.lo gnu_java_net_VMPlainSocketImpl.c arm-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I../../../include -I../../../include -I../../../native/jni/classpath -I../../../native/jni/native-lib -W -Wall -Wmissing-declarations -Wwrite-strings -Wmissing-prototypes -Wno-long-long -Wstrict-prototypes -pedantic -g -O2 -c gnu_java_net_VMPlainSocketImpl.c -fPIC -DPIC -o .libs/gnu_java_net_VMPlainSocketImpl.o arm-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I../../../include -I../../../include -I../../../native/jni/classpath -I../../../native/jni/native-lib -W -Wall -Wmissing-declarations -Wwrite-strings -Wmissing-prototypes -Wno-long-long -Wstrict-prototypes -pedantic -g -O2 -c gnu_java_net_VMPlainSocketImpl.c -o gnu_java_net_VMPlainSocketImpl.o >/dev/null 2>&1 /bin/sh ../../../libtool --tag=CC --mode=compile arm-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I../../../include -I../../../include -I../../../native/jni/classpath -I../../../native/jni/native-lib -W -Wall -Wmissing-declarations -Wwrite-strings -Wmissing-prototypes -Wno-long-long -Wstrict-prototypes -pedantic -g -O2 -c -o gnu_java_net_local_LocalSocketImpl.lo gnu_java_net_local_LocalSocketImpl.c arm-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I../../../include -I../../../include -I../../../native/jni/classpath -I../../../native/jni/native-lib -W -Wall -Wmissing-declarations -Wwrite-strings -Wmissing-prototypes -Wno-long-long -Wstrict-prototypes -pedantic -g -O2 -c gnu_java_net_local_LocalSocketImpl.c -fPIC -DPIC -o .libs/gnu_java_net_local_LocalSocketImpl.o arm-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I../../../include -I../../../include -I../../../native/jni/classpath -I../../../native/jni/native-lib -W -Wall -Wmissing-declarations -Wwrite-strings -Wmissing-prototypes -Wno-long-long -Wstrict-prototypes -pedantic -g -O2 -c gnu_java_net_local_LocalSocketImpl.c -o gnu_java_net_local_LocalSocketImpl.o >/dev/null 2>&1 /bin/sh ../../../libtool --tag=CC --mode=link arm-unknown-linux-gnu-gcc -W -Wall -Wmissing-declarations -Wwrite-strings -Wmissing-prototypes -Wno-long-long -Wstrict-prototypes -pedantic -g -O2 -module -version-info 0:0:0 -no-undefined -o libjavanet.la -rpath /opt/gnu-classpath-0.97/lib/classpath javanet.lo java_net_VMInetAddress.lo java_net_VMNetworkInterface.lo java_net_VMURLConnection.lo gnu_java_net_VMPlainSocketImpl.lo gnu_java_net_local_LocalSocketImpl.lo ../../../native/jni/classpath/jcl.lo ../../../native/jni/native-lib/libclasspathnative.la -lmagic arm-unknown-linux-gnu-gcc -shared .libs/javanet.o .libs/java_net_VMInetAddress.o .libs/java_net_VMNetworkInterface.o .libs/java_net_VMURLConnection.o .libs/gnu_java_net_VMPlainSocketImpl.o .libs/gnu_java_net_local_LocalSocketImpl.o ../../../native/jni/classpath/.libs/jcl.o -Wl,--whole-archive ../../../native/jni/native-lib/.libs/libclasspathnative.a -Wl,--no-whole-archive /usr/lib/libmagic.so -Wl,-soname -Wl,libjavanet.so.0 -o .libs/libjavanet.so.0.0.0 /usr/lib/libmagic.so: could not read symbols: Invalid operation collect2: ld returned 1 exit status make[3]: *** [libjavanet.la] Error 1 make[3]: Leaving directory `/home/cfriedt/Desktop/blah/classpath-0.97.1/native/jni/java-net' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/home/cfriedt/Desktop/blah/classpath-0.97.1/native/jni' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/cfriedt/Desktop/blah/classpath-0.97.1/native' make: *** [all-recursive] Error 1
Ah, I found out what the problem was. It's quite similar to what's described as 'a libtool minefield' on the site below: http://www.metastatic.org/text/libtool.html The magic_open test in the configure script certainly passes the test of linking to libmagic, but when it reads the .la file actually in my sysroot, which is /usr/arm-unknown-linux-gnu, the linker script tells it that it should look in /usr/lib for itself. This is actually true from the perspective of the libmagic library. As far as it knows, it exists in /usr/lib. I believe that this problem has existed for quite some time in various open source projects and it should be considered as a libtool defect. Libtool should test for cross-compilation and adjust the path returned from .la files by prefixing the appropriate sysroot location. It would be great if someone could fix this bug in the classpath sources, but it's really a problem that is more deeply rooted in libtool. I fixed the build by editing /usr/arm-unknown-linux-gnu/usr/lib/libmagic.la, and replacing libdir='/usr/lib' with libdir='/usr/arm-unknown-linux-gnu/usr/lib' Of course, directly after the build was finished, I changed .la file back to its original state.
Yeah, as far as I know, this is an issue with libtool. I don't know of any workarounds we can do in Classpath. I'm going to close this as INVALID. Glad I could help, indirectly ;-)