cross compilation of freeradius-server-3.0.10 fails at link of radeapclient, undefined references
When I start the build of FreeRADIUS it fails with an error because it can't execute jlibtool. If I use the native compiler rather than the cross compiler to build jlibtool the build proceeds. $ gcc scripts/jlibtool.c -o build/make/jlibtool However it breaks again when it tries to link build/bin/local/radeapclient (sorry my mail client is adding newlines to long single lines). LTIB> build/make/jlibtool --silent --mode=link gcc -o build/bin/local/radeapclient -rpath /spare1/aaron/0339/ltib/rpm/BUILD/freeradius-server-3.0.10/build/lib/local//.libs --shared -L/spare1/aaron/0339/ltib/rootfs/usr/lib -Wl,-rpath,/spare1/aaron/0339/ltib/rootfs/usr/lib build/objs/src/modules/rlm_eap/radeapclient.lo build/objs/src/main/files.lo build/objs/src/main/threads.lo build/objs/src/main/version.lo build/objs/src/main/cb.lo build/objs/src/main/tls.lo build/lib/local/libfreeradius-radius.la build/lib/local/libfreeradius-server.la build/lib/local/libfreeradius-eap.la -lcrypto -lssl -ltalloc -lpcre -lcap -lnsl -lresolv -ldl -lpthread -lcrypto -lssl However, if I change the command to the following it works. LTIB> gcc -o build/bin/local/radeapclient -Wl,-rpath /spare1/aaron/0339/ltib/rpm/BUILD/freeradius-server-3.0.10/build/lib/local//.libs --shared -L/spare1/aaron/0339/ltib/rootfs/usr/lib -Wl,-rpath,/spare1/aaron/0339/ltib/rootfs/usr/lib -L/spare1/aaron/0339/ltib/rpm/BUILD/freeradius-server-3.0.10/build/lib/local//.libs build/objs/src/modules/rlm_eap/radeapclient.o build/objs/src/main/files.o build/objs/src/main/threads.o build/objs/src/main/version.o build/objs/src/main/cb.o build/objs/src/main/tls.o -lfreeradius-radius -lfreeradius-server -lfreeradius-eap -lcrypto -lssl -ltalloc -lpcre -lcap -lnsl -lresolv -ldl -lpthread -lcrypto -lssl Now the build stops right away at the next link, build/bin/radeapclient. The problem is tedious to work around issuing calls to gcc because after that link it stops at: build/bin/local/smbencrypt build/bin/smbencrypt build/bin/local/dhcpclient build/bin/dhcpclient ...and so on. Don't know how may of these there are. I'm attaching the original failed command with the -Wl,--verbose flag added to the link to this email so that it's not formatted funny. Any help would be appreciated, I'm new to jlibtool and have no clue what's going on. The linker seems to be finding the shared objects and I check the shared objects for the undefined references it is complaining about and they seem to be in libfreeradius-radius.so, for instance: $ nm --defined-only -o build/lib/local//.libs/libfreeradius-radius.so | grep fr_pair_value_strcpy build/lib/local//.libs/libfreeradius-radius.so:000210ac T fr_pair_value_strcpy So I'm at a loss for why this link is failing. Thanks, Aaron
On Apr 22, 2016, at 9:53 AM, Aaron Wegner <aaron@cs.wisc.edu> wrote:
When I start the build of FreeRADIUS it fails with an error because it can't execute jlibtool. If I use the native compiler rather than the cross compiler to build jlibtool the build proceeds.
The build system isn't really set up to do cross-compilation.
$ gcc scripts/jlibtool.c -o build/make/jlibtool
That helps.
However it breaks again when it tries to link build/bin/local/radeapclient (sorry my mail client is adding newlines to long single lines).
LTIB> build/make/jlibtool --silent --mode=link gcc -o build/bin/local/radeapclient -rpath /spare1/aaron/0339/ltib/rpm/BUILD/freeradius-server-3.0.10/build/lib/local//.libs --shared -L/spare1/aaron/0339/ltib/rootfs/usr/lib -Wl,-rpath,/spare1/aaron/0339/ltib/rootfs/usr/lib build/objs/src/modules/rlm_eap/radeapclient.lo build/objs/src/main/files.lo build/objs/src/main/threads.lo build/objs/src/main/version.lo build/objs/src/main/cb.lo build/objs/src/main/tls.lo build/lib/local/libfreeradius-radius.la build/lib/local/libfreeradius-server.la build/lib/local/libfreeradius-eap.la -lcrypto -lssl -ltalloc -lpcre -lcap -lnsl -lresolv -ldl -lpthread -lcrypto -lssl
However, if I change the command to the following it works.
LTIB> gcc -o build/bin/local/radeapclient -Wl,-rpath /spare1/aaron/0339/ltib/rpm/BUILD/freeradius-server-3.0.10/build/lib/local//.libs --shared -L/spare1/aaron/0339/ltib/rootfs/usr/lib -Wl,-rpath,/spare1/aaron/0339/ltib/rootfs/usr/lib -L/spare1/aaron/0339/ltib/rpm/BUILD/freeradius-server-3.0.10/build/lib/local//.libs build/objs/src/modules/rlm_eap/radeapclient.o build/objs/src/main/files.o build/objs/src/main/threads.o build/objs/src/main/version.o build/objs/src/main/cb.o build/objs/src/main/tls.o -lfreeradius-radius -lfreeradius-server -lfreeradius-eap -lcrypto -lssl -ltalloc -lpcre -lcap -lnsl -lresolv -ldl -lpthread -lcrypto -lssl
You're running the local "gcc", and not the cross-compiler. You should do: $ CC=/path/to/cross/cc ./configure ... args ... $ gcc scripts/jlibtool.c -o build/make/jlibtool $ make That lets you build jlibtool with the native C compiler, and the rest of the build system will then use the cross compiler. Alan DeKok.
On 2016-04-22 11:42, Alan DeKok wrote:
On Apr 22, 2016, at 9:53 AM, Aaron Wegner <aaron@cs.wisc.edu> wrote:
When I start the build of FreeRADIUS it fails with an error because it can't execute jlibtool. If I use the native compiler rather than the cross compiler to build jlibtool the build proceeds.
The build system isn't really set up to do cross-compilation.
$ gcc scripts/jlibtool.c -o build/make/jlibtool
That helps.
However it breaks again when it tries to link build/bin/local/radeapclient (sorry my mail client is adding newlines to long single lines).
LTIB> build/make/jlibtool --silent --mode=link gcc -o build/bin/local/radeapclient -rpath /spare1/aaron/0339/ltib/rpm/BUILD/freeradius-server-3.0.10/build/lib/local//.libs --shared -L/spare1/aaron/0339/ltib/rootfs/usr/lib -Wl,-rpath,/spare1/aaron/0339/ltib/rootfs/usr/lib build/objs/src/modules/rlm_eap/radeapclient.lo build/objs/src/main/files.lo build/objs/src/main/threads.lo build/objs/src/main/version.lo build/objs/src/main/cb.lo build/objs/src/main/tls.lo build/lib/local/libfreeradius-radius.la build/lib/local/libfreeradius-server.la build/lib/local/libfreeradius-eap.la -lcrypto -lssl -ltalloc -lpcre -lcap -lnsl -lresolv -ldl -lpthread -lcrypto -lssl
However, if I change the command to the following it works.
LTIB> gcc -o build/bin/local/radeapclient -Wl,-rpath /spare1/aaron/0339/ltib/rpm/BUILD/freeradius-server-3.0.10/build/lib/local//.libs --shared -L/spare1/aaron/0339/ltib/rootfs/usr/lib -Wl,-rpath,/spare1/aaron/0339/ltib/rootfs/usr/lib -L/spare1/aaron/0339/ltib/rpm/BUILD/freeradius-server-3.0.10/build/lib/local//.libs build/objs/src/modules/rlm_eap/radeapclient.o build/objs/src/main/files.o build/objs/src/main/threads.o build/objs/src/main/version.o build/objs/src/main/cb.o build/objs/src/main/tls.o -lfreeradius-radius -lfreeradius-server -lfreeradius-eap -lcrypto -lssl -ltalloc -lpcre -lcap -lnsl -lresolv -ldl -lpthread -lcrypto -lssl
You're running the local "gcc", and not the cross-compiler.
You should do:
$ CC=/path/to/cross/cc ./configure ... args ... $ gcc scripts/jlibtool.c -o build/make/jlibtool $ make
That lets you build jlibtool with the native C compiler, and the rest of the build system will then use the cross compiler.
In the LTIB environment "gcc" is the cross compiler. It's spoofed, not the native compiler. [aaron@geiswbuild1 /spare1/aaron/0339/ltib Fri Apr 22 12:59:44] $ ./ltib -m shell LTIB> gcc --version powerpc-linux-gnu-gcc (Sourcery CodeBench 2014.11-97) 4.9.1 LTIB> exit exit [aaron@geiswbuild1 /spare1/aaron/0339/ltib Fri Apr 22 13:00:54] $ gcc --version gcc (GCC) 4.6.3 20120306 (Red Hat 4.6.3-2) Both 3.0.10 and 3.0.11 are working for me now. I tried to duplicate the errors from yesterday and I no longer can, sorry for what seems to be an unnecessary request for help. Moving forward, thanks.
Alan DeKok.
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
participants (2)
-
Aaron Wegner -
Alan DeKok