Opened 15 years ago

Closed 15 years ago

#1055 closed Bugs (fixed)

boost build system uses wrong `ar` for cross compilation.

Reported by: pluto@… Owned by: Vladimir Prus
Milestone: To Be Determined Component: Building Boost
Version: Severity: Showstopper
Keywords: Cc:

Description

for cross compilation i'm using a custom user-config.jam like this:

import toolset : using ; using gcc : 4.1 : x86_64-gnu-linux-g++ ;

with such config the boost build system always uses hardcoded ar for creating archives which can create wrong archive in some cases. i have a RHEL4(i686) builder with old preinstalled toolchain: gcc-3.4.5-2, binutils-2.15.92.0.2-18. on this machine i'm building boost for i486, x86_64, sparc and sparc64 with custom toolchain based on gcc-4.1.x and binutils-2.17.50.0.12.

boost uses system-wide ar which creates different archive than $crosstarget-ar and finally breaks linking of the custom application.

example, libboost_filesystem for x86_64 target:

$ pwd /local/devel/buildenv41-src/boost_1_34_0/bin.v2/libs/filesystem/build/gcc-4.1/release/inlining-on/link-static/threading-multi

$ rm *.a $ ar rc x.a *.o <- boost uses this. $ x86_64-gnu-linux-ar rc y.a *.o <- i want this. $ ls -l *.a

103670 Jun 16 09:41 x.a 114776 Jun 16 09:41 y.a

the library created by boost can't be used with my cross toolchain anymore:

x86_64-gnu-linux-g++ x.a x.a: could not read symbols: Archive has no index; run ranlib to add one collect2: ld returned 1 exit status

while the other one works fine:

x86_64-gnu-linux-g++ y.a /local/devel/toolchain41/x86_64-gnu-linux/usr/lib/../lib64/crt1.o: In function `_start': (.text+0x20): undefined reference to `main' collect2: ld returned 1 exit status

Change History (3)

comment:1 by anonymous, 15 years ago

one could the "archiver" option as a workaround:

using gcc : 3.4.5_mingw : mingw32-g++ : <archiver>mingw32-ar ;

maybe somebody could provide a full MinGW example please

comment:2 by Eric Niebler, 15 years ago

Owner: set to Vladimir Prus

comment:3 by Vladimir Prus, 15 years ago

Resolution: fixed
Status: newclosed

This bug was fixed by Rene in CVS HEAD. It remains a mistery to me how 'ar' can be incompatible between versions -- I though it's completely dump.

Note: See TracTickets for help on using tickets.