Hide Forgot
Description of problem: using the latest source rpm, during crossc-compilation (build arch is x86_64, host arch is i686) I get the following error: libtool: link: gcc .libs/radiusdS.o -m32 -Wl,--as-needed -Wl,--library-path=/usr/lib -pie -o .libs/radiusd .libs/acct.o .libs/auth.o .libs/client.o .libs/conffile.o .libs/crypt.o .libs/exec.o .libs/files.o .libs/listen.o .libs/log.o .libs/mainconfig.o .libs/modules.o .libs/modcall.o .libs/radiusd.o .libs/stats.o .libs/soh.o .libs/session.o .libs/threads.o .libs/util.o .libs/valuepair.o .libs/version.o .libs/xlat.o .libs/event.o .libs/realms.o .libs/evaluate.o .libs/vmps.o .libs/detail.o -Wl,--export-dynamic /home/mr-4/rpmbuild/BUILD/freeradius-server-2.1.12/src/lib/.libs/libfreeradius-radius.so -lnsl -lresolv -lpthread -lcrypt -lltdl -lssl -lcrypto -Wl,-rpath -Wl,/usr/lib/freeradius /usr/bin/ld: i386:x86-64 architecture of input file `.libs/radiusdS.o' is incompatible with i386 output collect2: ld returned 1 exit status gmake[4]: *** [radiusd] Error 1 gmake[4]: Leaving directory `/home/mr-4/rpmbuild/BUILD/freeradius-server-2.1.12/src/main' gmake[3]: *** [main] Error 2 gmake[3]: Leaving directory `/home/mr-4/rpmbuild/BUILD/freeradius-server-2.1.12/src' gmake[2]: *** [all] Error 2 gmake[2]: Leaving directory `/home/mr-4/rpmbuild/BUILD/freeradius-server-2.1.12/src' gmake[1]: *** [src] Error 2 gmake[1]: Leaving directory `/home/mr-4/rpmbuild/BUILD/freeradius-server-2.1.12' make: *** [all] Error 2 Version-Release number of selected component (if applicable): FreeRADIUS 2.1.12, FC16 How reproducible: Always Steps to Reproduce: 1. rpm -ivh freeradius-2.1.12-2.fc16.src.rpm 2. cd rpmbuild/SPECS 3. rpmbuild -bb --target=i686 freeradius.spec Actual results: Log ending with the following: libtool: compile: gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=pentium4 -fasynchronous-unwind-tables -fpic -Wall -D_GNU_SOURCE -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DNDEBUG -I/home/mr-4/rpmbuild/BUILD/freeradius-server-2.1.12/src -DHOSTINFO=\"i686-redhat-linux-gnu\" -DRADIUSD_VERSION=\"2.1.12\" -DOPENSSL_NO_KRB5 -c detail.c -o detail.o >/dev/null 2>&1 /usr/bin/libtool --mode=link gcc -export-dynamic -dlopen self \ -m32 -Wl,--as-needed,--library-path=/usr/lib -pie -o radiusd acct.lo auth.lo client.lo conffile.lo crypt.lo exec.lo files.lo listen.lo log.lo mainconfig.lo modules.lo modcall.lo radiusd.lo stats.lo soh.lo session.lo threads.lo util.lo valuepair.lo version.lo xlat.lo event.lo realms.lo evaluate.lo vmps.lo detail.lo \ /home/mr-4/rpmbuild/BUILD/freeradius-server-2.1.12/src/lib/libfreeradius-radius.la -lnsl -lresolv -lpthread \ -lcrypt -lltdl -lcrypto -lssl -lcrypto libtool: link: rm -f .libs/radiusd.nm .libs/radiusd.nmS .libs/radiusd.nmT libtool: link: (cd .libs && gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC -c -fno-builtin "radiusdS.c") libtool: link: rm -f ".libs/radiusdS.c" ".libs/radiusd.nm" ".libs/radiusd.nmS" ".libs/radiusd.nmT" libtool: link: gcc .libs/radiusdS.o -m32 -Wl,--as-needed -Wl,--library-path=/usr/lib -pie -o .libs/radiusd .libs/acct.o .libs/auth.o .libs/client.o .libs/conffile.o .libs/crypt.o .libs/exec.o .libs/files.o .libs/listen.o .libs/log.o .libs/mainconfig.o .libs/modules.o .libs/modcall.o .libs/radiusd.o .libs/stats.o .libs/soh.o .libs/session.o .libs/threads.o .libs/util.o .libs/valuepair.o .libs/version.o .libs/xlat.o .libs/event.o .libs/realms.o .libs/evaluate.o .libs/vmps.o .libs/detail.o -Wl,--export-dynamic /home/mr-4/rpmbuild/BUILD/freeradius-server-2.1.12/src/lib/.libs/libfreeradius-radius.so -lnsl -lresolv -lpthread -lcrypt -lltdl -lssl -lcrypto -Wl,-rpath -Wl,/usr/lib/freeradius /usr/bin/ld: i386:x86-64 architecture of input file `.libs/radiusdS.o' is incompatible with i386 output collect2: ld returned 1 exit status gmake[4]: *** [radiusd] Error 1 gmake[4]: Leaving directory `/home/mr-4/rpmbuild/BUILD/freeradius-server-2.1.12/src/main' gmake[3]: *** [main] Error 2 gmake[3]: Leaving directory `/home/mr-4/rpmbuild/BUILD/freeradius-server-2.1.12/src' gmake[2]: *** [all] Error 2 gmake[2]: Leaving directory `/home/mr-4/rpmbuild/BUILD/freeradius-server-2.1.12/src' gmake[1]: *** [src] Error 2 gmake[1]: Leaving directory `/home/mr-4/rpmbuild/BUILD/freeradius-server-2.1.12' make: *** [all] Error 2 Expected results: Compilation to succeed Additional info: Please note the following, which might pinpoint the source of the error (I strongly suspect libtool misconfiguration, but my knowledge of this abomination is not up-to-date to correct this error myself): libtool: link: (cd .libs && gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC -c -fno-builtin "radiusdS.c") The above compilation (from whatever place is generated) will succeed, BUT it is for the wrong arch - it assumes some made-up "generic" settings (wrong 1) of my build arch (wrong 2) instead of the specified settings of my host arch, therefore the object file produced - radiusdS.o - will have the wrong architecture ("generic x86_64" instead of "pentium4 i686") and linking with it later on will produce the above error! As evident from the above log excerpt, the "normal" gcc compilation uses the correct parameters (CFLAGS etc) and not some made-up nonsense. If you require further info, just let me know.
I think I found what causes this - as I suspected, it stems from my host libtool script and the following line in particular (taken from /usr/bin/libtool): LTCFLAGS="-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC" As evident from the above, LTCFLAGS settings are replaced regardless of what arch is used for the actual compilation and regardless of whether they were set previously by something else, causing the link error. As I already pointed out, I am no libtool expert and can't be 100% sure that libtool is solely to blame for this (I avoid using it like the plague!). I've already submitted this as a new libtool bug (see https://bugzilla.redhat.com/show_bug.cgi?id=771076 for details), but thought to comment on here as well, just in case libtool is not the only one to blame for this. In the libtool bug I've also proposed a work-around for this particular problem, which I can verify that it works and I am able to cross-compile freeradius (x86_64->i686 and x86_64->e604).
Upstream has removed the use of libtool in future releases because of the myriad problems it created. Given that upstream is deprecating the use of libtool and we make no guarantees concerning cross compilation environments I see little value in trying to rectify this problem at this juncture.