我正在尝试在Clear Linux上安装glibc,并且在调试时遇到困难(甚至难以调试许多makefile中的哪一个(。 我之前的尝试在这两个线程中: 如何使用配置的"前缀"选项构建到指定的目录中? 构建 glibc 时出错:生成/混淆文件有什么问题?
所以现在我的问题是,当我运行make时,构建停止:
-I../sysdeps/nptl -I../sysdeps/pthread -I../sysdeps/gnu -I../sysdeps/unix/inet -I../sysdeps/unix/sysv -I../sysdeps/unix/x86_64 -I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/x86_64/64 -I../sysdeps/x86_64/fpu/multiarch -I../sysdeps/x86_64/fpu -I../sysdeps/x86/fpu/include -I../sysdeps/x86/fpu -I../sysdeps/x86_64/multiarch -I../sysdeps/x86_64 -I../sysdeps/x86 -I../sysdeps/ieee754/float128 -I../sysdeps/ieee754/ldbl-96/include -I../sysdeps/ieee754/ldbl-96 -I../sysdeps/ieee754/dbl-64/wordsize-64 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/wordsize-64 -I../sysdeps/ieee754 -I../sysdeps/generic -I.. -I../libio -I. -D_LIBC_REENTRANT -include /home/james/Downloads/glibc-build/libc-modules.h -DMODULE_NAME=libc -include ../include/libc-symbols.h -DTOP_NAMESPACE=glibc -I../soft-fp -o /home/james/Downloads/glibc-build/math/s_modfl.o -MD -MP -MF /home/james/Downloads/glibc-build/math/s_modfl.o.dt -MT /home/james/Downloads/glibc-build/math/s_modfl.o
cc1: error: -fassociative-math disabled; other options take precedence [-Werror]
cc1: all warnings being treated as errors
make[2]: *** [/home/james/Downloads/glibc-build/sysd-rules:791: /home/james/Downloads/glibc-build/math/s_modfl.o] Error 1
make[2]: Leaving directory '/home/james/Downloads/glibc/math'
make[1]: *** [Makefile:215: math/subdir_lib] Error 2
make[1]: Leaving directory '/home/james/Downloads/glibc'
make: *** [Makefile:9: all] Error 2
我怀疑这个线程中可能有线索,但它有点超出我的头脑。 与海湾合作委员会的关联数学
我还猜测,makefile 中后来的错误是关联数学出错的结果。
编辑按照要求,我跑了
james@clr ~/Downloads/glibc-build $ make -j
这是输出的结束
-I../sysdeps/ieee754/ldbl-96/include -I../sysdeps/ieee754/ldbl-96 -I../sysdeps/ieee754/dbl-64/wordsize-64 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/wordsize-64 -I../sysdeps/ieee754 -I../sysdeps/generic -I.. -I../libio -I. -D_LIBC_REENTRANT -include /home/james/Downloads/glibc-build/libc-modules.h -DMODULE_NAME=libc -include ../include/libc-symbols.h -DPIC -DSHARED -DTOP_NAMESPACE=glibc -I../soft-fp -DASSEMBLER -g -Werror=undef -Wa,--noexecstack -o /home/james/Downloads/glibc-build/math/s_signbit.os -MD -MP -MF /home/james/Downloads/glibc-build/math/s_signbit.os.dt -MT /home/james/Downloads/glibc-build/math/s_signbit.os
cc1: all warnings being treated as errors
make[2]: *** [/home/james/Downloads/glibc-build/sysd-rules:791: /home/james/Downloads/glibc-build/math/s_modfl.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [/home/james/Downloads/glibc-build/sysd-rules:825: /home/james/Downloads/glibc-build/math/s_modf.o] Error 1
cc1: all warnings being treated as errors
make[2]: *** [/home/james/Downloads/glibc-build/sysd-rules:893: /home/james/Downloads/glibc-build/math/s_modff.o] Error 1
cc1: all warnings being treated as errors
make[2]: *** [/home/james/Downloads/glibc-build/sysd-rules:757: /home/james/Downloads/glibc-build/math/s_modff128.o] Error 1
cc1: all warnings being treated as errors
make[2]: *** [/home/james/Downloads/glibc-build/sysd-rules:807: /home/james/Downloads/glibc-build/math/s_modfl.os] Error 1
cc1: all warnings being treated as errors
make[2]: *** [/home/james/Downloads/glibc-build/sysd-rules:841: /home/james/Downloads/glibc-build/math/s_modf.os] Error 1
make[2]: Leaving directory '/home/james/Downloads/glibc/math'
make[1]: *** [Makefile:215: math/subdir_lib] Error 2
make[1]: Leaving directory '/home/james/Downloads/glibc'
make: *** [Makefile:9: all] Error 2
编辑2:更多信息以回应Basile的评论: 我需要glibc来运行Phoronix测试套件的一些模块,将来我可能需要它来为R构建库。据我所知,它不包含在 Clear Linux 中(至少 PTS 认为我没有安装它(,而且我在可用捆绑包列表中没有看到它。 版本:
james@clr ~/Downloads $ uname -r
4.17.1-582.native
james@clr ~/Downloads $ gcc --version
gcc (Clear Linux OS for Intel Architecture) 8.1.1 20180514
Copyright (C) 2018 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.
Configure commands
james@clr ~/Downloads $ git clone git://sourceware.org/git/glibc.git
james@clr ~/Downloads $ cd glibc
james@clr ~/Downloads/glibc $ git checkout --track -b local_glibc-2.27 origin/release/2.27/master
Branch 'local_glibc-2.27' set up to track remote branch 'release/2.27/master' from 'origin'.
Switched to a new branch 'local_glibc-2.27'
james@clr ~/Downloads/glibc $ mkdir /home/james/Downloads/glibc-build/
james@clr ~/Downloads/glibc $ cd /home/james/Downloads/glibc-build/
james@clr ~/Downloads/glibc-build $ ~/Downloads/glibc/configure --prefix=/home/james/Downloads/glibc-build
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for gcc... gcc
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for readelf... readelf
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether g++ can link programs... yes
checking for sysdeps preconfigure fragments... aarch64 alpha arm hppa i386 m68k microblaze mips nios2 powerpc riscv s390 sh sparc tile x86_64 checking whether gcc compiles in -mx32 mode by default... no
checking for use of fpu sysdeps directories... yes
checking for -fstack-protector... yes
checking for -fstack-protector-strong... yes
checking for -fstack-protector-all... yes
checking for assembler and linker STT_GNU_IFUNC support... yes
checking for gcc attribute ifunc support... yes
checking if compiler warns about alias for function with incompatible types... yes
checking sysdep dirs... sysdeps/unix/sysv/linux/x86_64/64 sysdeps/unix/sysv/linux/x86_64 sysdeps/unix/sysv/linux/x86 sysdeps/x86/nptl sysdeps/unix/sysv/linux/wordsize-64 sysdeps/x86_64/nptl sysdeps/unix/sysv/linux sysdeps/nptl sysdeps/pthread sysdeps/gnu sysdeps/unix/inet sysdeps/unix/sysv sysdeps/unix/x86_64 sysdeps/unix sysdeps/posix sysdeps/x86_64/64 sysdeps/x86_64/fpu/multiarch sysdeps/x86_64/fpu sysdeps/x86/fpu sysdeps/x86_64/multiarch sysdeps/x86_64 sysdeps/x86 sysdeps/ieee754/float128 sysdeps/ieee754/ldbl-96 sysdeps/ieee754/dbl-64/wordsize-64 sysdeps/ieee754/dbl-64 sysdeps/ieee754/flt-32 sysdeps/wordsize-64 sysdeps/ieee754 sysdeps/generic
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking whether as is GNU as... yes
checking whether ld is GNU ld... yes
checking for as... as
checking version of as... 2.30, ok
checking for ld... ld
checking version of ld... 2.30, ok
checking for gnumake... no
checking for gmake... no
checking for make... make
checking version of make... 4.2.1, ok
checking for gnumsgfmt... no
checking for gmsgfmt... no
checking for msgfmt... msgfmt
checking version of msgfmt... 0.19.8.1, ok
checking for makeinfo... makeinfo
checking version of makeinfo... 6.5, ok
checking for sed... sed
checking version of sed... 4.5, ok
checking for gawk... gawk
checking version of gawk... 4.2.1, ok
checking for bison... bison
checking version of bison... 3.0.5, ok
checking if gcc is sufficient to build libc... yes
checking for nm... gcc-nm
checking for python3... python3
checking LD_LIBRARY_PATH variable... ok
checking for bash... /usr/bin/bash
checking for perl... /usr/bin/perl
checking for install-info... /usr/bin/install-info
checking for .set assembler directive... yes
checking linker support for protected data symbol... yes
checking linker support for INSERT in linker script... yes
checking for broken __attribute__((alias()))... no
checking whether to put _rtld_local into .sdata section... no
checking whether to use .ctors/.dtors header and trailer... no
checking for libunwind-support in compiler... no
checking whether --noexecstack is desirable for .S files... yes
checking for -z combreloc... yes
checking for linker that supports -z execstack... yes
checking for linker that supports --no-dynamic-linker... yes
checking for -static-pie... yes
checking for -fpie... yes
checking for --hash-style option... yes
checking for sufficient default -shared layout... no
checking for GLOB_DAT reloc... yes
checking linker output format... elf64-x86-64
checking for -fno-toplevel-reorder -fno-section-anchors... yes
checking for -mtls-dialect=gnu2... yes
checking whether cc puts quotes around section names... no
checking for __builtin_memset... no
checking for redirection of built-in functions... yes
checking for compiler option to disable generation of FMA instructions... -ffp-contract=off
checking if gcc accepts -fno-tree-loop-distribute-patterns with __attribute__ ((__optimize__))... yes
checking for libgd... yes
checking for is_selinux_enabled in -lselinux... no
checking for _FORTIFY_SOURCE predefine... yes
checking whether the linker provides working __ehdr_start... yes
checking for __builtin_trap with no external dependencies... yes
checking whether the C++ compiler supports thread_local... yes
running configure fragment for sysdeps/unix/sysv/linux/x86_64/64
running configure fragment for sysdeps/unix/sysv/linux/x86_64
running configure fragment for sysdeps/unix/sysv/linux
checking installed Linux kernel header files... 3.2.0 or later
checking for kernel header at least 3.2.0... ok
checking for symlinks in /home/james/Downloads/glibc-build/include... ok
running configure fragment for sysdeps/gnu
running configure fragment for sysdeps/unix/inet
running configure fragment for sysdeps/x86_64
checking for AVX512DQ support in assembler... yes
checking for AVX512 support... yes
checking for Intel MPX support... yes
checking whether -fPIC is default... no
checking whether -fPIE is default... no
configure: creating ./config.status
config.status: creating config.make
config.status: creating Makefile
config.status: creating config.h
config.status: executing default commands
编辑 3:make 的完整输出太长而无法包含,所以我把它放在 pastebin 上: https://pastebin.com/H3yGC5aj
您提出的编译器命令行包含以下标志:
-fassociative-math -fasynchronous-unwind-tables -feliminate-unused-debug-types -fexceptions -ffat-lto-objects -fmerge-all-constants -fno-semantic-interposition -fno-signed-zeros -fno-stack-protector -fno-trapping-math -frounding-math -fstack-protector -ftree-loop-distribute-patterns
但是,-fassociative-math
是不安全的数学优化之一,glibc 不能用它们构建,因为通过这样的优化,数学库会产生错误的结果——正如你发现的,数学库的某些部分所需的编译器标志甚至与它们不兼容。
您没有将这些标志显式传递给configure
或make
,因此它们很可能来自CFLAGS
环境变量。 您需要在调用configure
和make
之前取消设置。