[sr #111202] Libtool strips -static flag from CFLAGS

Droopy <[email protected]> Thu, 27 Feb 2025 18:30:43 -0500 (EST)
Newsgroups gmane.comp.gnu.libtool.general
Message-ID <[email protected]>
--8323329-1313482842-1740699043=:3614772
Content-Type: TEXT/plain; CHARSET=utf-8
Content-Transfer-Encoding: QUOTED-PRINTABLE
Content-Disposition: inline

URL:=0A  <https://savannah.gnu.org/support/?111202>=0A=0A                 S=
ummary: Libtool strips -static flag from CFLAGS=0A                   Group:=
 GNU Libtool=0A               Submitter: droopy4096=0A               Submit=
ted: Thu 27 Feb 2025 11:30:40 PM UTC=0A                Category: None=0A   =
             Priority: 5 - Normal=0A                Severity: 3 - Normal=0A=
                  Status: None=0A                 Privacy: Public=0A       =
      Assigned to: None=0A        Originator Email:=0A             Open/Clo=
sed: Open=0A         Discussion Lock: Any=0A        Operating System: None=
=0A=0A=0A    _______________________________________________________=0A=0AF=
ollow-up Comments:=0A=0A=0A------------------------------------------------=
-------=0ADate: Thu 27 Feb 2025 11:30:40 PM UTC By: Droopy <droopy4096>=0AI=
'm working on building toolchain within Alpine linux container. As one=0Aex=
ample - building `pkgconf` with `CFLAGS=3D-static` and `./configure=0A--dis=
able-shared` still results in dynamically linked binary:=0A=0A```=0A/src $ =
ldd /tmp/pkconf.default=0A        /lib/ld-musl-x86_64.so.1 (0x7fbf5b4af000)=
=0A        libc.musl-x86_64.so.1 =3D> /lib/ld-musl-x86_64.so.1 (0x7fbf5b4af=
000)=0A```=0A=0Awhen I try to force static binary generation via `LDFLAGS=
=3D-Wl,-static` I get=0A"broken" binary as libtool ends up assembling binar=
y without an entry point=0A(crt1.o) as far as I can tell. =0A=0AIssue is re=
ally visible here:=0A=0A```=0A/bin/sh ./libtool  --tag=3DCC   --mode=3Dlink=
 clang=0A-DPERSONALITY_PATH=3D\"/opt/gitlab/bootstrap/share/pkgconfig/perso=
nality.d:/opt/gitlab/bootstrap/etc/pkgconfig/personality.d\"=0A-DPKG_DEFAUL=
T_PATH=3D\"/opt/gitlab/bootstrap/lib64/pkgconfig:/opt/gitlab/bootstrap/shar=
e/pkgconfig\"=0A-DSYSTEM_INCLUDEDIR=3D\"/opt/gitlab/bootstrap/include\"=0A-=
DSYSTEM_LIBDIR=3D\"/opt/gitlab/bootstrap/lib64\" -fuse-ld=3Dlld=0A--rtlib=
=3Dcompiler-rt -static -no-pie  -L/opt/gitlab/bootstrap/lib64 -lc=0A-L/usr/=
lib -o bomtool cli/bomtool/bomtool-main.o cli/bomtool-getopt_long.o=0Alibpk=
gconf.la=0Alibtool: link: clang=0A"-DPERSONALITY_PATH=3D\"/opt/gitlab/boots=
trap/share/pkgconfig/personality.d:/opt/gitlab/bootstrap/etc/pkgconfig/pers=
onality.d\""=0A"-DPKG_DEFAULT_PATH=3D\"/opt/gitlab/bootstrap/lib64/pkgconfi=
g:/opt/gitlab/bootstrap/share/pkgconfig\""=0A"-DSYSTEM_INCLUDEDIR=3D\"/opt/=
gitlab/bootstrap/include\""=0A"-DSYSTEM_LIBDIR=3D\"/opt/gitlab/bootstrap/li=
b64\"" -fuse-ld=3Dlld=0A--rtlib=3Dcompiler-rt -no-pie -o bomtool cli/bomtoo=
l/bomtool-main.o=0Acli/bomtool-getopt_long.o  -L/opt/gitlab/bootstrap/lib64=
 -L/usr/lib=0A./.libs/libpkgconf.a -lc=0A```=0A=0Anote that second line is =
**missing** `-static`. Same command *with* `-static`=0Aflag produces proper=
 binary.=0A=0A=0A=0A=0A=0A=0A=0A    _______________________________________=
________________=0A=0AReply to this item at:=0A=0A  <https://savannah.gnu.o=
rg/support/?111202>=0A=0A_______________________________________________=0A=
Message sent via Savannah=0Ahttps://savannah.gnu.org/=0A
--8323329-1313482842-1740699043=:3614772
Content-Type: APPLICATION/pgp-signature; name=signature.asc

-----BEGIN PGP SIGNATURE-----

iHUEABYIAB0WIQQk97aszIMMAvLLwm6qLAuaBUf3TgUCZ8D1owAKCRCqLAuaBUf3
Tj4GAQCskNX1xFv/Rd6BSc4F63P1xjPGAoiTp29BwtpUwdVB0gEA7CFQ5Na5yoS0
KATr5xHenDT55nW/GwVozDw8HfgyWgA=
=to5Z
-----END PGP SIGNATURE-----

--8323329-1313482842-1740699043=:3614772--