libtool hardcodes native (cross-)compiler, incorrect when using libtool as cross-compiler

  • Open
  • quality assurance status badge
Details
2 participants
  • Ludovic Courtès
  • Maxime Devos
Owner
unassigned
Submitted by
Maxime Devos
Severity
normal
M
M
Maxime Devos wrote on 29 Apr 2021 00:03
(address . bug-guix@gnu.org)(address . libtool@gnu.org)
e83c2512749a164b4f140ff237b3b5bc1b198c4b.camel@telenet.be
Hi,

[CC'ing to libtool mailing list, maybe they can shed some light on the matter
of how libtool can be used as a cross-compiler. This concerns the definition
of the libtool package in guix.]

$ cat $(guix build libtool)/bin/libtool
Some relevant output:

Toggle quote (4 lines)
> # A C compiler.
> LTCC="gcc"
> # Compile-time system search path for libraries.
> sys_lib_search_path_spec="/gnu/store/8zvc5mvk0xm3ygrxsgpyy5ilxb5rzjry-perl-5.30.2/lib /gnu/store/i5a9qb07y9xjh9ry8hp6km43kji16nmd-libltdl-2.4.6/lib /gnu/store/i8h2pcxqdq07ijm3ibkka8f4smn1w48v-bzip2-
1.0.8/lib /gnu/store/9860f1abqj8wjjnwl8a9v54pdcc3bhgf-xz-5.2.4/lib /gnu/store/60g7r3l01fd7c58yjbm6krgcwj1jkpwg-file-5.38/lib /gnu/store/swqdvwri9dbv6zssg6v0by7l05hd6wxp-gawk-5.0.1/lib
/gnu/store/m1z7cdbqsqyp9xnjw5cvlb4a7gkcg3m4-binutils-2.34/lib /gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31/lib /gnu/store/s3dcqzwqaakv1yx37by9chksdbkgih17-glibc-2.31-static/lib
/gnu/store/hwcky7446s952w0mwchhmm211ll07zrq-glibc-utf8-locales-2.31/lib /gnu/store/01b4w3m6mp55y531kyi1g8shh722kwqm-gcc-7.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/7.5.0
/gnu/store/01b4w3m6mp55y531kyi1g8shh722kwqm-gcc-7.5.0-lib/lib "

Usually, libtool uses the compiler it was passed.
However, during linking, (at least during the compilation of libtomsmath IIRC),
libtool uses LTCC instead. Thus, when a package X has libtool in native-inputs,
and it is being cross-compiled, it should really use a variant of libtool that has
been configured to set LTCC=TARGET-gcc (or LTCC=TARGET-clang).

There do not seem to exist any such variants currently. (For a relatively clean
method for automatically using a cross-compiling variant, see the "pkg-config"
macro.) Thus, I thought it would ‘simply’ be a matter of passing an appropriate
"--target=TARGET" option to libtool's configure script when libtool is being used
as cross-compiler. But alas, libtool configure only supports --build and --host,
no --target in sight!

Any ideas?
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYInbtRccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7vZeAQCGtyJdyUTwNktd8k1Ac6KrNlAA
T3rqzbc6WwUYHTNC1QD9EQ6twfYyfl1s8VPhthGN3/ZrFEHqNnwAnZ0oTcINdwU=
=GdcH
-----END PGP SIGNATURE-----


L
L
Ludovic Courtès wrote on 29 Apr 2021 13:52
(name . Maxime Devos)(address . maximedevos@telenet.be)
87o8dxl33x.fsf@gnu.org
Hi Maxime,

Maxime Devos <maximedevos@telenet.be> skribis:

Toggle quote (3 lines)
> $ cat $(guix build libtool)/bin/libtool
> Some relevant output:

[...]

Toggle quote (3 lines)
> However, during linking, (at least during the compilation of libtomsmath IIRC),
> libtool uses LTCC instead. Thus, when a package X has libtool in native-inputs,

The ‘libtool’ script provided by the ‘libtool’ package is usually
unused. The modus operandi for Libtool is that packages generate their
own ‘libtool’ script at configure time, tailored for the given
configuration options, based on a template installed by ‘libtoolize’
(itself invoked by ‘autoreconf’).

Perhaps the ‘libtomsmath’ package is doing something unusual?

HTH,
Ludo’.
M
M
Maxime Devos wrote on 29 Apr 2021 19:18
(name . Ludovic Courtès)(address . ludo@gnu.org)
0bcb6ff1fc169172a0ad85851948874fd97cafae.camel@telenet.be
Severity: minor

Hi Ludo,

Ludovic Courtès schreef op do 29-04-2021 om 13:52 [+0200]:
Toggle quote (9 lines)
> [...]
> The ‘libtool’ script provided by the ‘libtool’ package is usually
> unused. The modus operandi for Libtool is that packages generate their
> own ‘libtool’ script at configure time, tailored for the given
> configuration options, based on a template installed by ‘libtoolize’
> (itself invoked by ‘autoreconf’).
>
> Perhaps the ‘libtomsmath’ package is doing something unusual?

Yes, it does not have a configure script, and invokes "libtool" directly from
the makefile. It seems like ‘we’ will have to patch libtomsmath appropriately.
I might eventually look into the issue, but probably not in the near future.

Let's stop CC'ing libtool@gnu.org; this issue isn't really a bug in libtool.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYIrqgBccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7msUAQDD/YlF55a++VTJEZObiWZepvFR
YcN7K1C3jkw8rw+NmAD/Yj4vhORhppPzAT/i7PfIBWem9eDYNrbz/j+v3uUyOQg=
=m45U
-----END PGP SIGNATURE-----


?