Skip to contentSkip to conversation

Can't build with GCC 16.1.0 - libatomic problem

DISCUSSION [email protected] 2 participants 3 messages May 10

lore
Share & tools
lore
#0 lore raw

Hi,
Doing a static build on a system where static version of libatomic is not available system-wide.

Attempt 1:

export CC="musl-gcc"
./configure --enable-static
# FAIL, from config.log:
configure:4037: checking whether the C compiler works
configure:4059: musl-gcc conftest.c >&5
/usr/bin/ld: cannot find -latomic_asneeded: No such file or directory
collect2: error: ld returned 1 exit status

Attempt 2 (telling build system not to use libatomic):

export CC="musl-gcc"
export LDFLAGS="-fno-link-libatomic"
./configure --enable-static
# OK, but:
make all-recursive
make[1]: Entering directory '/home/me/media/930_GiB/dash-0.5.13.4' Making all in src
make[2]: Entering directory '/home/me/media/930_GiB/dash-0.5.13.4/src'

  CC       builtins.def
  GEN      builtins.h
  CC       mknodes

/usr/bin/ld: cannot find -latomic_asneeded: No such file or directory
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:831: mknodes] Error 1
make[2]: Leaving directory '/home/me/media/930_GiB/dash-0.5.13.4/src' make[1]: *** [Makefile:357: all-recursive] Error 1 make[1]: Leaving directory '/home/me/media/930_GiB/dash-0.5.13.4'
make: *** [Makefile:298: all] Error 2

Attempt 3 (built libatomic.a separately, trying to use it):

export CC="musl-gcc"
export CFLAGS="-Os -I/home/me/media/930_GiB/gcc-build/gcc/include" export LDFLAGS="-L/home/me/media/930_GiB/gcc-build/gcc" ./configure --enable-static
# OK, but:
make
make all-recursive
make[1]: Entering directory '/home/me/media/930_GiB/dash-0.5.13.4' Making all in src
make[2]: Entering directory '/home/me/media/930_GiB/dash-0.5.13.4/src'

  CC       builtins.def
  GEN      builtins.h
  CC       mknodes

/usr/bin/ld: cannot find -latomic_asneeded: No such file or directory
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:831: mknodes] Error 1
make[2]: Leaving directory '/home/me/media/930_GiB/dash-0.5.13.4/src' make[1]: *** [Makefile:357: all-recursive] Error 1 make[1]: Leaving directory '/home/me/media/930_GiB/dash-0.5.13.4'
make: *** [Makefile:298: all] Error 2

Looks like "mknodes" step ignores CFLAGS/LDFLAGS.

/Regards, Aleksej

#2 lore raw
Quoted 3 lines · Sam James

This is a bug in the musl-gcc wrapper (other than possibly some concern about the dash build system wrt flags):
https://gcc.gnu.org/PR125235

Hi Sam,
When building other programs I successfully worked around it by using -fno-link-libatomic, dash is the only exception so far.