3
votes

Kubuntu 19.10

I followed that instruction exactly:

$ mkdir $HOME/src
$ cd $HOME/src
$ git clone git://sourceware.org/git/glibc.git
$ mkdir -p $HOME/build/glibc
$ cd $HOME/build/glibc
$ $HOME/src/glibc/configure --prefix=/usr
$ make

But during the last command 'make', I get the following error (only the end of the output is given):

make[3]: Leaving directory '/home/denis/src/glibc/elf'
gcc   -nostdlib -nostartfiles -r -o /home/denis/build/glibc/elf/librtld.os '-Wl,-(' /home/denis/build/glibc/elf/dl-allobjs.os /home/denis/build/glibc/elf/rtld-libc.a -lgcc '-Wl,-)' \
          -Wl,-Map,/home/denis/build/glibc/elf/librtld.os.map
gcc   -nostdlib -nostartfiles -shared -o /home/denis/build/glibc/elf/ld.so.new          \
          -Wl,-z,combreloc -Wl,-z,relro -Wl,--hash-style=both -Wl,-z,defs       \
          /home/denis/build/glibc/elf/librtld.os -Wl,--version-script=/home/denis/build/glibc/ld.map            \
          -Wl,-soname=ld-linux-x86-64.so.2                      \
          -Wl,-defsym=_begin=0
/usr/bin/ld: /home/denis/build/glibc/elf/librtld.os: in function `_rtld_main_check':
/home/denis/src/glibc/elf/../sysdeps/x86/dl-prop.h:33: undefined reference to `_dl_cet_check'
/usr/bin/ld: /home/denis/src/glibc/elf/../sysdeps/x86/dl-prop.h:33: undefined reference to `_dl_cet_check'
/usr/bin/ld: /home/denis/src/glibc/elf/../sysdeps/x86/dl-prop.h:33: undefined reference to `_dl_cet_check'
/usr/bin/ld: /home/denis/build/glibc/elf/librtld.os: in function `_dl_open_check':
/home/denis/src/glibc/elf/../sysdeps/x86/dl-prop.h:41: undefined reference to `_dl_cet_open_check'
/usr/bin/ld: /home/denis/build/glibc/elf/ld.so.new: hidden symbol `_dl_cet_open_check' isn't defined
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:510: /home/denis/build/glibc/elf/ld.so] Error 1
make[2]: Leaving directory '/home/denis/src/glibc/elf'
make[1]: *** [Makefile:438: elf/subdir_lib] Error 2
make[1]: Leaving directory '/home/denis/src/glibc'
make: *** [Makefile:9: all] Error 2

What do I need to do to build a library?

1

1 Answers

4
votes

Apparently, your GCC version implicitly enables the -fcf-protection flag. Upstream GCC does not do this, so the glibc configure logic is not prepared for this. You will have to configure explicitly with CET, like this:

$ $HOME/src/glibc/configure --prefix=/usr --enable-cet

As a result, the CET support functionality will be linked in.

EDIT This has been filed as Bug 25225 - ld.so fails to link on x86 if GCC defaults to -fcf-protection. It is now fixed on all glibc branches which support CET.