Gentoo Archives: gentoo-dev

From: Jaco Kroon <jaco@××××××.za>
To: gentoo-dev@l.g.o, "Michał Górny" <mgorny@g.o>
Subject: Re: [gentoo-dev] [RFC] Dealing with global /usr/bin/libtool use vs CC/CXX etc.
Date: Mon, 11 Jan 2021 08:53:01
Message-Id: 876b9e4e-b86d-f433-2e0d-f69fa0d6ab5a@uls.co.za
In Reply to: [gentoo-dev] [RFC] Dealing with global /usr/bin/libtool use vs CC/CXX etc. by "Michał Górny"
1 Hi Michał,
2
3 On 2021/01/10 15:34, Michał Górny wrote:
4 > Hi,
5 >
6 > The vast majority of libtool-based programs use configure script to
7 > generate libtool. However, a few non-autoconf packages also use libtool
8 > by calling system-installed /usr/bin/libtool. The problem is that this
9 > libtool hardcodes the values of CC/CXX at its' build time, so unless it
10 > is rebuilt frequently, packages end up using the stale values.
11 > The problem is known since 2005 [1] and hasn't been resolved yet.
12 >
13 > I can think of two ways of solving it:
14 >
15 > 1. We could patch system-installed libtool to respect environment
16 > variables such as CC, CXX, etc. This will probably require carrying
17 > a (possibly non-trivial) patch forever. On the bright side, libtool is
18 > not exactly a package seeing frequent releases. I mean, the current
19 > version is from 2015.
20 >
21 > 2. We could regenerate libtool and force local instance of libtool
22 > in the packages needing it. The main advantage of this is that it's
23 > a no-brainer. I could make a quick eclass that does configure a local
24 > instance and prepends it into PATH.
25 >
26 > WDYT?
27
28 3.  Have it always use some fixed compiler somewhere (ie, compile it
29 with CC=/usr/bin/cc-libtool-wrapper CXX=/usr/bin/cxx-libtool-wrapper
30 which quite literally is just scripts that does):
31
32 exec "${CC}" "$@"
33
34 and
35
36 exec "${CXX}" "$@"
37
38 (with some added logic that if those variables points to itself it needs
39 to do a bit of extra work, or use "${LIBTOOL_CC:-${CC}}" style and
40 compile libtool with LIBTOOL_CC=${CC} CC=/usr/bin/cc-libtool-wrapper ...
41 I'd still add logic to detect the infinite recursion of CC=$0 though ...).
42
43 Would be happy to supply a suitable script if you're interested that you
44 can then just symlink the variants to
45 (libtool-tool-wrapper-{cc,cxx,ld,ar,...})
46
47 Kind Regards,
48 Jaco

Replies