To whom it may concern, I wanted to raise a question, regarding binutils-devel shipping libiberty library with deprecated functions (sys_nerr, sys_errlist) causing the following errors in Rocky Linux versions using glibbc 2.32 and up.
Why the following doesn't work, if binutils ships liberty specifically for this? Correct? Any workaround? If the workaround is to change code and move away from using liberty, could you please explain the reason why? Thanks before hand!! ------------------------------ The error we get: /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/libiberty.a(strerror.o): in function errno_max': /builddir/build/BUILD/binutils-2.35.2/build-x86_64-redhat-linux/libiberty/../../libiberty/strerror.c:600: undefined reference to sys_nerr' Reproduction Steps: Create file: $vi errno_max.c $ cat errno_max.c #include <stdio.h> #include <errno.h> #include <libiberty.h> int main() { int max_errno = errno_max(); printf("The maximum value of errno is: %d\n", max_errno); return 0; } Run: gcc -o errno_max errno_max.c -liberty Debug version (-v) gcc -o errno_max errno_max.c /usr/lib64/libiberty.a /usr/bin/ld: /usr/lib64/libiberty.a(strerror.o): in function errno_max': /builddir/build/BUILD/binutils-2.35.2/build-x86_64-redhat-linux/libiberty/../../libiberty/strerror.c:600: undefined reference tosys_nerr' collect2: error: ld returned 1 exit status [root@localhost ~]# gcc -o errno_max errno_max.c -liberty -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/11/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-redhat-linux Configured with: ../configure --enable-bootstrap --enable-host-pie --enable-host-bind-now --enable-languages=c,c++,fortran,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl= https://bugs.rockylinux.org/ --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --enable-plugin --enable-initfini-array --without-isl --enable-multilib --with-linker-hash-style=gnu --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_64=x86-64-v2 --with-arch_32=x86-64 --build=x86_64-redhat-linux --with-build-config=bootstrap-lto --enable-link-serialization=1 Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 11.5.0 20240719 (Red Hat 11.5.0-2) (GCC) COLLECT_GCC_OPTIONS='-o' 'errno_max' '-v' '-mtune=generic' '-march=x86-64-v2' /usr/libexec/gcc/x86_64-redhat-linux/11/cc1 -quiet -v errno_max.c -quiet -dumpbase errno_max.c -dumpbase-ext .c -mtune=generic -march=x86-64-v2 -version -o /tmp/ccuHbsxT.s GNU C17 (GCC) version 11.5.0 20240719 (Red Hat 11.5.0-2) (x86_64-redhat-linux) compiled by GNU C version 11.5.0 20240719 (Red Hat 11.5.0-2), GMP version 6.2.0, MPFR version 4.1.0-p9, MPC version 1.2.1, isl version none GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/11/include-fixed" ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/11/../../../../x86_64-redhat-linux/include" include "…" search starts here: include <…> search starts here: /usr/lib/gcc/x86_64-redhat-linux/11/include /usr/local/include /usr/include End of search list. GNU C17 (GCC) version 11.5.0 20240719 (Red Hat 11.5.0-2) (x86_64-redhat-linux) compiled by GNU C version 11.5.0 20240719 (Red Hat 11.5.0-2), GMP version 6.2.0, MPFR version 4.1.0-p9, MPC version 1.2.1, isl version none GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 519d0e643a1f182db008ad234ddca59c COLLECT_GCC_OPTIONS='-o' 'errno_max' '-v' '-mtune=generic' '-march=x86-64-v2' as -v --64 -o /tmp/ccuT5lPu.o /tmp/ccuHbsxT.s GNU assembler version 2.35.2 (x86_64-redhat-linux) using BFD version version 2.35.2-54.el9 COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/11/:/usr/libexec/gcc/x86_64-redhat-linux/11/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/11/:/usr/lib/gcc/x86_64-redhat-linux/ LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/11/:/usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/11/../../../:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-o' 'errno_max' '-v' '-mtune=generic' '-march=x86-64-v2' '-dumpdir' 'errno_max.' /usr/libexec/gcc/x86_64-redhat-linux/11/collect2 -plugin /usr/libexec/gcc/x86_64-redhat-linux/11/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-redhat-linux/11/lto-wrapper -plugin-opt=-fresolution=/tmp/ccyV9Cjs.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o errno_max /usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/11/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/11 -L/usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/11/../../.. /tmp/ccuT5lPu.o -liberty -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-redhat-linux/11/crtend.o /usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/crtn.o /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/libiberty.a(strerror.o): in function errno_max': /builddir/build/BUILD/binutils-2.35.2/build-x86_64-redhat-linux/libiberty/../../libiberty/strerror.c:600: undefined reference to sys_nerr' collect2: error: ld returned 1 exit status Arian Cabrera *Customer Support Engineer* *P* 510 9880618 #558 | *E* acabr...@ciq.com | *W* ciq.com