步骤是:
tar zxf glibc-2.28.tar.gz && cd glibc-2.28
mkdir build && cd build
../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
make -j 8
我得到了以下内容:
inux-gnu/12.2.0/include-fixed -isystem /usr/include -D_LIBC_REENTRANT -include /root/source/glibc-2.28/build/libc-modules.h -DMODULE_NAME=libc -include ../include/libc-symbols.h -DTOP_NAMESPACE=glibc \
-DGEN_AS_CONST_HEADERS -x c - \
-MD -MP -MF /root/source/glibc-2.28/build/tcb-offsets.h.dT -MT '/root/source/glibc-2.28/build/tcb-offsets.h.d /root/source/glibc-2.28/build/tcb-offsets.h'
In file included from ../include/pthread.h:1,
from ../nptl/../nptl_db/thread_db.h:25,
from ../nptl/descr.h:32,
from ../sysdeps/x86_64/nptl/tls.h:130,
from ../sysdeps/unix/sysv/linux/x86_64/sysdep.h:24,
from <stdin>:1:
../sysdeps/nptl/pthread.h:744:47: error: argument 1 of type 'struct __jmp_buf_tag *' declared as a pointer [-Werror=array-parameter=]
744 | extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROWNL;
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~
In file included from ../include/setjmp.h:2,
from ../nptl/descr.h:24:
../setjmp/setjmp.h:54:46: note: previously declared as an array 'struct __jmp_buf_tag[1]'
54 | extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask) __THROWNL;
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [../Makerules:287: /root/source/glibc-2.28/build/tcb-offsets.h] Error 1
make[2]: Leaving directory '/root/source/glibc-2.28/csu'
make[1]: *** [Makefile:258: csu/subdir_lib] Error 2
make[1]: Leaving directory '/root/source/glibc-2.28'
make: *** [Makefile:9: all] Error 2
谁能给我一些帮助或提示?欣赏
我尝试使用 make clean 命令重新编译,或者完全删除 glibc-2.28 文件夹以重试并避免在不使用 -j 8 参数的情况下进行多核编译,但问题仍然存在
好吧。我修复它。解决方案是:重新安装 gcc 8.2 后它可以工作。 顺便说一句,我还有其他错误:
x86_64-pc-linux-gnu/bin/ld: cannot find -lnss_test2
collect2: error: ld returned 1 exit status
Execution of gcc failed!
但是我们可以忽略这个错误,见:https://sourceware.org/bugzilla/show_bug.cgi?id=21911