Tasklist

FS#71 - libtool issues with crosscompilation

Attached to Project: CRUX-ARM
Opened by Jose V Beneyto (sepen) - Monday, 23 February 2015, 00:33 GMT
Last edited by Victor Martinez (pitillo) - Tuesday, 17 May 2016, 18:54 GMT
Task Type Bug Report
Category crossrootfs
Status Closed
Assigned To Jose V Beneyto (sepen)
Victor Martinez (pitillo)
Operating System CRUX-ARM
Severity Low
Priority Normal
Reported Version devel
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

libtool tries to relink during installation but failed due to host libraries

libtool: relink: arm-crux-linux-gnueabihf-g++ -fPIC -DPIC -shared -nostdlib /home/sepen/devel/crux-arm/toolchain/clfs/usr/lib/crti.o /home/sepen/devel/crux-arm/toolchain/crosstools/lib/gcc/arm-crux-linux-gnueabihf/4.8.3/crtbeginS.o .libs/dummy.o cxx/.libs/isfuns.o cxx/.libs/ismpf.o cxx/.libs/ismpq.o cxx/.libs/ismpz.o cxx/.libs/ismpznw.o cxx/.libs/limits.o cxx/.libs/osdoprnti.o cxx/.libs/osfuns.o cxx/.libs/osmpf.o cxx/.libs/osmpq.o cxx/.libs/osmpz.o -Wl,-rpath -Wl,/home/sepen/devel/crux-arm/toolchain/crosstools/lib/gcc/arm-crux-linux-gnueabihf/4.8.3/../../../../arm-crux-linux-gnueabihf/lib -L/home/sepen/devel/crux-arm/ports/crossrootfs/libgmp/work/pkg/usr/lib -L/usr/lib -lgmp -L/home/sepen/devel/crux-arm/toolchain/crosstools/lib/gcc/arm-crux-linux-gnueabihf/4.8.3 -L/home/sepen/devel/crux-arm/toolchain/crosstools/lib/gcc/arm-crux-linux-gnueabihf/4.8.3/../../../../arm-crux-linux-gnueabihf/lib -L/home/sepen/devel/crux-arm/toolchain/clfs/lib -L/home/sepen/devel/crux-arm/toolchain/clfs/usr/lib -L/home/sepen/devel/crux-arm/ports/crossrootfs/libgmp/work/pkg/home/sepen/devel/crux-arm/toolchain/crosstools/lib/gcc/arm-crux-linux-gnueabihf/4.8.3/../../../../arm-crux-linux-gnueabihf/lib -lstdc++ -lm -lc -lgcc_s /home/sepen/devel/crux-arm/toolchain/crosstools/lib/gcc/arm-crux-linux-gnueabihf/4.8.3/crtendS.o /home/sepen/devel/crux-arm/toolchain/clfs/usr/lib/crtn.o -O2 -mfloat-abi=hard -Wl,-soname -Wl,libgmpxx.so.4 -o .libs/libgmpxx.so.4.4.0
/usr/lib/libstdc++.so: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status
libtool: install: error: relink `libgmpxx.la' with the above command before installing it

There is a good explanation of the problem in this thread:

https://lists.debian.org/debian-devel/2011/02/msg00196.html (Fun with libtool and cross-builds)

We can reproduce that problem when building crossrootfs on a x86_64 host. Our final target is arm 32bits so we can't link against non-32bits objects, and that is for what we didn't detect issues when building crossrootfs on a x86 host.
I'm not happy with this situation.

This task depends upon

Closed by  Victor Martinez (pitillo)
Tuesday, 17 May 2016, 18:54 GMT
Reason for closing:  Fixed
Comment by Jose V Beneyto (sepen) - Monday, 23 February 2015, 00:42 GMT
Most people avoid using 'make install' and to copy the files from .libs manually.
I tried that on a couple of ports (libgmp, utils-linux, etc.) and worked, but I'm still researching some more.
Comment by Victor Martinez (pitillo) - Thursday, 12 November 2015, 12:46 GMT
After some reasearch and tests... I finally found what seems to be a solution...
We can force mabi=32 on LD which should't confuse the linker and fix current problems:

export LD="$CTARGET-ld -mabi=32" in pkgmk-cross.conf

This needs some testing.
Comment by Victor Martinez (pitillo) - Thursday, 19 November 2015, 14:18 GMT
Tested and there are some problems:

arm-crux-linux-gcc can't create shared libraries but arm-crux-linux-g++ can.
Comment by Victor Martinez (pitillo) - Thursday, 03 March 2016, 13:19 GMT
After more research related to this problem, finally we saw the real problem.

libtool tries to link with /usr/lib/libstdc++.so because we weren't installing this file into CLFS. After installing it (and libgcc_s.so), builds run without problems.

Current changes in toolchain are shown in this commit (3.2 branch):
https://crux-arm.nu/gitweb?p=toolchain.git;a=commit;h=ebc15011db0ba00d3ed23ede0417b71bebb2d6e3

Finally seems that we are able to start using an updated CRUX jail to build crossrootfs. Work on the way to see if there are more problems related to these changes.
Comment by Victor Martinez (pitillo) - Thursday, 17 March 2016, 07:39 GMT
We have find some problems with other ports while building with libtool relink stage:
- gcc (we can disable some options to build it but we'll face problems later with other ports:
--disable-libsanitizer --disable-libgomp
Comment by Victor Martinez (pitillo) - Tuesday, 17 May 2016, 18:54 GMT
John Vogel provided a set of patches fixing these issues:
gcc: https://crux-arm.nu/gitweb?p=crossrootfs.git;a=commit;h=6c5365d2b585cb5ad291b32a2d1fd8ef93271e0f
gettext: https://crux-arm.nu/gitweb?p=crossrootfs.git;a=commit;h=05030d9810f16d89a1d69edaf4f21057b143808c

and libgmp updated to 6.1.0 solve the problem with cross builds

Loading...