Failed to compile glibc 2.25 on Arch Linux

Viewed 43

Background

I started a logic synthesis with Vivado 2020.2 on Arch Linux, and then got a segmentation fault. The solution is to copy glibc 2.25 compiled with the "--disable-lock-elision" option into the Vivado directory.^1 ^2

I downloaded the source code from the Arch Linux repository and compiled it.

(I am sorry, but the following message contains some Japanese sentences. If you need to understand the meaning of this, please let me know.)

$ asp checkout glibc
$ cd glibc
$ git checkout e4db1c823e0d69073c7794671b1f4a68b984645c
$ cd trunk
$ vim PKGBUILD # Replace "--enable-lock-elision" to "--disable-lock-elision"
$ makepkg

...
../misc/syslog.c: 関数 ‘ __vsyslog_chk’  内: 
../misc/syslog.c:121:30: エラー: inlining failed in call to ‘ always_inline’  ‘ syslog’ : function not inlinable
  121 | ldbl_strong_alias (__syslog, syslog)
        |
...

This problem is caused by CFLAGS not being set properly.^3 Therefore I corrected the CFLAGS setting in the PKGBUILD and tried to compile again.

$ rm -rf pkg glibc src
$ vim PKGBUILD # Fix CFLAGS
$ makepkg

...
gcc -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now  -shared -static-libgcc -Wl,-O1  -Wl,-z,defs -Wl,-dynamic-linker=/usr/lib/ld-linux-x86-64.so.2  -B/path/glibc/trunk/src/glibc-build/csu/  -Wl,--version-script=/path/to/glibc/trunk/src/glibc-build/libm.map -Wl,-soname=libm.so.6 -Wl,-z,combreloc -Wl,-z,relro -Wl,--hash-style=both -Wl,-z,now  -L/path/to/glibc/trunk/src/glibc-build -L/path/to/glibc/trunk/src/glibc-build/math -L/path/to/glibc/trunk/src/glibc-build/elf -L/path/to/glibc/trunk/src/glibc-build/dlfcn -L/path/to/glibc/trunk/src/glibc-build/nss -L/path/to/glibc/trunk/src/glibc-build/nis -L/path/to/glibc/trunk/src/glibc-build/rt -L/path/to/glibc/trunk/src/glibc-build/resolv -L/path/to/glibc/trunk/src/glibc-build/crypt -L/path/to/glibc/trunk/src/glibc-build/mathvec -L/path/to/glibc/trunk/src/glibc-build/support -L/path/to/glibc/trunk/src/glibc-build/nptl -Wl,-rpath-link=/path/to/glibc/trunk/src/glibc-build:/path/to/glibc/trunk/src/glibc-build/math:/path/to/glibc/trunk/src/glibc-build/elf:/path/to/glibc/trunk/src/glibc-build/dlfcn:/path/to/glibc/trunk/src/glibc-build/nss:/path/to/glibc/trunk/src/glibc-build/nis:/path/to/glibc/trunk/src/glibc-build/rt:/path/to/glibc/trunk/src/glibc-build/resolv:/path/to/glibc/trunk/src/glibc-build/crypt:/path/to/glibc/trunk/src/glibc-build/mathvec:/path/to/glibc/trunk/src/glibc-build/support:/path/to/glibc/trunk/src/glibc-build/nptl -o /path/to/glibc/trunk/src/glibc-build/math/libm.so  /path/to/glibc/trunk/src/glibc-build/csu/abi-note.o -Wl,--whole-archive /path/to/glibc/trunk/src/glibc-build/math/libm_pic.a -Wl,--no-whole-archive  -Wl,--start-group /path/to/glibc/trunk/src/glibc-build/libc.so /path/to/glibc/trunk/src/glibc-build/libc_nonshared.a -Wl,--as-needed /path/to/glibc/trunk/src/glibc-build/elf/ld.so -Wl,--no-as-needed -Wl,--end-group
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/12.1.1/libgcc_eh.a(unwind-dw2-fde-dip.o): in function `_Unwind_Find_FDE':
(.text+0x1953): undefined reference to `_dl_find_object'
collect2: エラー: ld はステータス 1 で終了しました
make[2]: *** [../Makerules:582: /path/to/glibc/trunk/src/glibc-build/math/libm.so] エラー 1
make[2]: ディレクトリ '/path/to/glibc/trunk/src/glibc/math' から出ます
make[1]: *** [Makefile:215: math/others] エラー 2
make[1]: ディレクトリ '/path/to/glibc/trunk/src/glibc' から出ます
make: *** [Makefile:9: all] エラー 2
==> エラー: build() で問題が発生しました。
    中止...
...

The linking failed here. The symbol _dl_find_object is not found.

Problem

I would like to compile glibc 2.25 completely, but it is failed because of the above problem. I do not know what I should do. Does anyone have any ideas?

The tools version

GCC

$ gcc --version
gcc (GCC) 12.1.1 20220730
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

makepkg

$ makepkg --version
makepkg (pacman) 6.0.1
Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>.
Copyright (C) 2002-2006 Judd Vinet <jvinet@zeroflux.org>.

This is free software; see the source for copying conditions.
There is NO WARRANTY, to the extent permitted by law.

asp

$ asp --version
asp v8

PKGBUILD diff

diff --git a/trunk/PKGBUILD b/trunk/PKGBUILD
index 0fb6c73..5c5cb11 100644
--- a/trunk/PKGBUILD
+++ b/trunk/PKGBUILD
@@ -47,7 +47,7 @@ build() {
   echo "rootsbindir=/usr/bin" >> configparms
 
   # remove fortify for building libraries
-  CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/}
+  CFLAGS=${CFLAGS/-Wp,-D_FORTIFY_SOURCE=2/}
 
   ../${pkgname}/configure \
       --prefix=/usr \
@@ -62,7 +62,7 @@ build() {
       --disable-profile \
       --enable-stackguard-randomization \
       --enable-stack-protector=strong \
-      --enable-lock-elision \
+      --disable-lock-elision \
       --enable-multi-arch \
       --disable-werror
0 Answers
Related