Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 331489 - sys-devel/libtool-2.2.6b: --mode=compile respects specified compiler but --mode=link does not
Summary: sys-devel/libtool-2.2.6b: --mode=compile respects specified compiler but --mo...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-07 10:15 UTC by Andrey Batyiev
Modified: 2011-07-28 10:14 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
problem fix (libtool-2.2.6-fix-wrong-gcc-problem.patch,321 bytes, patch)
2010-08-07 10:16 UTC, Andrey Batyiev
Details | Diff
portage ebuild diff (libtool-2.2.6b.ebuild.diff,612 bytes, patch)
2010-08-07 10:24 UTC, Andrey Batyiev
Details | Diff
embedded-cross overlay ebuild diff (libtool-2.2.6b.ebuild.embedded.diff,699 bytes, patch)
2010-08-07 10:24 UTC, Andrey Batyiev
Details | Diff
example build log of dev-libs/libtommath-0.41 (build.log,90.74 KB, text/plain)
2010-08-09 12:01 UTC, Andrey Batyiev
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Batyiev 2010-08-07 10:15:34 UTC
Some library packages in tree use libtool to create library files. While compilation via libtool works flawlessly, linking stage had wrong gcc bug problem: libtool tries to use host compiler not cross-compiler.

Debugging libtool I found that variable $archive_cmds, which contains commands needed to link library. It use non-overridable $CC or $LD (in fact compiler name from commandline doesn't in use at all), which point to host compiler.

I make hack that allows to override $CC or $LD from commandline, so cross compilation with libtool became possible.

Reproducible: Always

Steps to Reproduce:
Comment 1 Andrey Batyiev 2010-08-07 10:16:34 UTC
Created attachment 241731 [details, diff]
problem fix
Comment 2 Andrey Batyiev 2010-08-07 10:24:16 UTC
Created attachment 241733 [details, diff]
portage ebuild diff
Comment 3 Andrey Batyiev 2010-08-07 10:24:53 UTC
Created attachment 241735 [details, diff]
embedded-cross overlay ebuild diff
Comment 4 SpanKY gentoo-dev 2010-08-09 06:10:32 UTC
post an actual build log (as an attachment) of a package failing to cross-compile.  i cross-compile packages that use libtool every day without problems.  i'm not going to add random patches based on vague problem descriptions.
Comment 5 Andrey Batyiev 2010-08-09 12:01:27 UTC
Created attachment 241969 [details]
example build log of dev-libs/libtommath-0.41

build fails because libtool call host compiler (i686-pc-linux-gnu-gcc) instead of cross-compiler (armv7a-softfloat-linux-gnueabi-gcc) for linking
Comment 6 Andrey Batyiev 2010-08-09 12:04:22 UTC
attachment posted
Comment 7 SpanKY gentoo-dev 2010-08-09 17:25:32 UTC
libtommath shouldnt be using `libtool` in PATH, it should be.  many other aspects of libtool arent going to work correctly.  since --mode=compile is respecting the specified compiler, then --mode=link probably should as well, but this still doesnt mean that libtommath is doing the right thing.  any package using `libtool` from PATH is broken.
Comment 8 SpanKY gentoo-dev 2010-08-15 03:26:21 UTC
looks like i truncated my last comment.  first sentence:
..., it should be bundling a local version and configuring/running that.
Comment 9 SpanKY gentoo-dev 2010-08-15 03:48:42 UTC
testing libtool-2.2.10 seems to work fine for me

$ echo 'main(){}' > test.c
$ CHOST=alpha-unknown-linux-gnu

$ libtool --mode=compile --tag=CC ${CHOST}-gcc -c test.c
libtool: compile:  alpha-unknown-linux-gnu-gcc -c test.c  -fPIC -DPIC -o .libs/test.o
libtool: compile:  alpha-unknown-linux-gnu-gcc -c test.c -o test.o >/dev/null 2>&1

$ libtool --mode=link --tag=CC ${CHOST}-gcc test.o -o test
libtool: link: alpha-unknown-linux-gnu-gcc test.o -o test