Home :: Documentation :: Download :: Development :: Community :: Ports :: Packages :: Bugs :: Links :: About :: Donors
Attached to Project: CRUX-ARM
Opened by Jose V Beneyto - 2015-02-23
Last edited by Victor Martinez - 2016-05-17

FS#71 - libtool issues with crosscompilation

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, -o .libs/
/usr/lib/ file not recognized: File format not recognized
collect2: error: ld returned 1 exit status
libtool: install: error: relink `’ with the above command before installing it

There is a good explanation of the problem in this thread: (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.

Closed by  Victor Martinez
Tuesday, 17 May 2016, 18:54 GMT
Reason for closing:  Fixed
Project Manager
Jose V Beneyto commented on 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.

Project Manager
Victor Martinez commented on 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.

Project Manager
Victor Martinez commented on 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.

Project Manager
Victor Martinez commented on 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/ because we weren’t installing this file into CLFS. After installing it (and, builds run without problems.

Current changes in toolchain are shown in this commit (3.2 branch):;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.

Project Manager
Victor Martinez commented on 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:

  1. -disable-libsanitizer –disable-libgomp
Project Manager
Victor Martinez commented on Tuesday, 17 May 2016, 18:54 GMT

John Vogel provided a set of patches fixing these issues:
gcc:;a=commit;h=6c5365d2b585cb5ad291b32a2d1fd8ef93271e0f gettext:;a=commit;h=05030d9810f16d89a1d69edaf4f21057b143808c

and libgmp updated to 6.1.0 solve the problem with cross builds


Available keyboard shortcuts


Task Details

Task Editing