configure: error: missing __attribute__ ((constructor)) support?
configure: error: missing __attribute__ ((constructor)) support?
我正在尝试使用 Yocto 项目中的 bitbake 环境构建 glibc 库。我能够成功构建它,但是当我更改 local.conf 文件中的 C 编译器标志时,它给出了缺少属性错误。
build/conf/local.conf 文件.
这里我加一行:
TARGET_CFLAGS += "-fprofile-arcs -ftest-coverage"
然后它抛出错误:缺少 attribute((constructor)) 支持?
我已将此行添加到 local.conf 文件中。
TARGET_CFLAGS += "-fprofile-arcs -ftest-coverage"
请为 config.log 文件找到 link:https://drive.google.com/open?id=14tiQJ8JIFE_tDWt3H9tS8zBBQROcZDNa
Sstate summary: Wanted 7 Found 1 Missed 6 Current 51 (14% match, 89% complete)
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
ERROR: glibc-2.28-r0 do_configure: configure failed
ERROR: glibc-2.28-r0 do_configure: Function failed: do_configure (log file is located at /scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/temp/log.do_configure.19973)
ERROR: Logfile of failure stored in: /scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/temp/log.do_configure.19973
Log data follows:
| DEBUG: SITE files ['endian-little', 'bit-32', 'ix86-common', 'common-linux', 'common-glibc', 'i586-linux', 'common']
| DEBUG: Executing shell function autotools_preconfigure
| Previously configured separate build directory detected, cleaning /scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/build-i586-poky-linux
| DEBUG: Shell function autotools_preconfigure finished
| DEBUG: Executing python function autotools_aclocals
| DEBUG: SITE files ['endian-little', 'bit-32', 'ix86-common', 'common-linux', 'common-glibc', 'i586-linux', 'common']
| DEBUG: Python function autotools_aclocals finished
| DEBUG: Executing shell function do_configure
| NOTE: Running ../git/configure --build=x86_64-linux --host=i586-poky-linux --target=i586-poky-linux --prefix=/usr --exec_prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/libexec --datadir=/usr/share --sysconfdir=/etc --sharedstatedir=/com --localstatedir=/var --libdir=/usr/lib --includedir=/usr/include --oldincludedir=/usr/include --infodir=/usr/share/info --mandir=/usr/share/man --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot=/scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/recipe-sysroot --enable-kernel=3.2.0 --disable-profile --disable-debug --without-gd --enable-clocale=gnu --with-headers=/scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/recipe-sysroot/usr/include --without-selinux --enable-tunables --enable-bind-now --enable-stack-protector=strong --enable-stackguard-randomization --disable-crypt --with-default-link --enable-nscd --disable-static
| checking build system type... x86_64-pc-linux-gnu
| checking host system type... i586-poky-linux-gnu
| checking for i586-poky-linux-gcc... i586-poky-linux-gcc -m32 -march=i586 --sysroot=/scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/recipe-sysroot
| checking for suffix of object files... o
| checking whether we are using the GNU C compiler... yes
| checking whether i586-poky-linux-gcc -m32 -march=i586 --sysroot=/scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/recipe-sysroot accepts -g... yes
| checking for gcc... gcc
| checking for i586-poky-linux-readelf... i586-poky-linux-readelf
| checking whether we are using the GNU C++ compiler... yes
| checking whether i586-poky-linux-g++ -m32 -march=i586 --sysroot=/scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/recipe-sysroot accepts -g... yes
| checking whether i586-poky-linux-g++ -m32 -march=i586 --sysroot=/scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/recipe-sysroot can link programs... no
| checking for sysdeps preconfigure fragments... aarch64 alpha arm hppa i386 m68k microblaze mips nios2 powerpc riscv s390 sh sparc x86_64
| checking for use of fpu sysdeps directories... yes
| checking for -fstack-protector... (cached) no
| checking for -fstack-protector-strong... (cached) no
| checking for -fstack-protector-all... (cached) no
| 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/i386 sysdeps/unix/sysv/linux/x86 sysdeps/x86/nptl sysdeps/i386/nptl sysdeps/unix/sysv/linux sysdeps/nptl sysdeps/pthread sysdeps/gnu sysdeps/unix/inet sysdeps/unix/sysv sysdeps/unix/i386 sysdeps/unix sysdeps/posix sysdeps/i386/i586 sysdeps/i386/fpu sysdeps/x86/fpu sysdeps/i386 sysdeps/x86 sysdeps/wordsize-32 sysdeps/ieee754/float128 sysdeps/ieee754/ldbl-96 sysdeps/ieee754/dbl-64 sysdeps/ieee754/flt-32 sysdeps/ieee754 sysdeps/generic
| checking for a BSD-compatible install... /scratch/work/day8/poky/build/tmp/hosttools/install -c
| checking whether ln -s works... yes
| checking whether /scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/recipe-sysroot-native/usr/bin/i586-poky-linux/../../libexec/i586-poky-linux/gcc/i586-poky-linux/8.2.0/as is GNU as... yes
| checking whether /scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/recipe-sysroot-native/usr/bin/i586-poky-linux/../../libexec/i586-poky-linux/gcc/i586-poky-linux/8.2.0/ld is GNU ld... yes
| checking for /scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/recipe-sysroot-native/usr/bin/i586-poky-linux/../../libexec/i586-poky-linux/gcc/i586-poky-linux/8.2.0/as... /scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/recipe-sysroot-native/usr/bin/i586-poky-linux/../../libexec/i586-poky-linux/gcc/i586-poky-linux/8.2.0/as
| checking version of /scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/recipe-sysroot-native/usr/bin/i586-poky-linux/../../libexec/i586-poky-linux/gcc/i586-poky-linux/8.2.0/as... 2.31.1.20181224, ok
| checking for /scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/recipe-sysroot-native/usr/bin/i586-poky-linux/../../libexec/i586-poky-linux/gcc/i586-poky-linux/8.2.0/ld... /scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/recipe-sysroot-native/usr/bin/i586-poky-linux/../../libexec/i586-poky-linux/gcc/i586-poky-linux/8.2.0/ld
| checking version of /scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/recipe-sysroot-native/usr/bin/i586-poky-linux/../../libexec/i586-poky-linux/gcc/i586-poky-linux/8.2.0/ld... 2.31.1.20181224, ok
| checking for gnumake... make
| checking version of make... 4.2.1, ok
| checking for gnumsgfmt... no
| checking for gmsgfmt... no
| checking for msgfmt... no
| checking for makeinfo... makeinfo
| checking version of makeinfo... 6.1, ok
| checking for sed... sed
| checking version of sed... 4.2.2, ok
| checking for gawk... gawk
| checking version of gawk... 4.1.3, ok
| checking for bison... bison
| checking version of bison... 3.0.4, ok
| checking if i586-poky-linux-gcc -m32 -march=i586 --sysroot=/scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/recipe-sysroot is sufficient to build libc... yes
| checking for i586-poky-linux-nm... i586-poky-linux-nm
| checking for python3... python3
| configure: WARNING:
| *** These auxiliary programs are missing or incompatible versions: msgfmt
| *** some features or tests will be disabled.
| *** Check the INSTALL file for required versions.
| checking LD_LIBRARY_PATH variable... ok
| checking for bash... (cached) /bin/bash
| checking for perl... /scratch/work/day8/poky/build/tmp/hosttools/perl
| checking for install-info... /usr/bin/install-info
| checking for .set assembler directive... no
| checking linker support for protected data symbol... yes
| checking linker support for INSERT in linker script... no
| 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... configure: error: missing __attribute__ ((constructor)) support??
| NOTE: The following config.log files may provide further information.
| NOTE: /scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/build-i586-poky-linux/config.log
| ERROR: configure failed
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_configure (log file is located at /scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/temp/log.do_configure.19973)
ERROR: Task (/scratch/work/day8/poky/meta/recipes-core/glibc/glibc_2.28.bb:do_configure) failed with exit code '1'
NOTE: Tasks Summary: Attempted 388 tasks of which 387 didn't need to be rerun and 1 failed.
Summary: 1 task failed:
/scratch/work/day8/poky/meta/recipes-core/glibc/glibc_2.28.bb:do_configure
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.
由于您通过添加这些 CFLAGS -fprofile-arcs -ftest-coverage 启用了代码覆盖支持 - 这些 CFLAGS 必须已经传播编译由 autoconf 构建的 conftest 二进制文件。这个二进制文件是为了测试是否支持一个特定的特性(如它所说的"whether to use .ctors/.dtors header and trailer")而构建的(实际上,在配置过程中有几个类似的构建来测试特定的特性)。我无法证明这一点,因为详细的错误打印应该在您尚未共享的特定日志文件中:
| NOTE: The following config.log files may provide further information.
| NOTE: /scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/build-i586-poky-linux/config.log
但是,我敢打赌,它应该包含如下内容:
conftest.c:(.text+0xae): undefined reference to `__gcov_init'
...
collect2: ld returned 1 exit status
这是因为代码使用了一些函数调用,而链接器无法找到它的实现(即使在这些完全没有意义的 conftest 二进制文件中)。
可以通过指定相应的配置选项跳过此特定配置测试 - libc_cv_ctors_header(在这种情况下,名称取自 glib 的 configure.ac) - 添加 EXTRA_OECONF 到 local.conf(例如 EXTRA_OECONF = "libc_cv_ctors_header=yes"),但是这些标志实际上会影响所有此类测试,我们不应该猜测 yes/no 值等。
因此,最好让链接器知道覆盖支持——即为 TARGET_LDFLAGS:
提供相同的标志
TARGET_LDFLAGS += "-fprofile-arcs -ftest-coverage"
我正在尝试使用 Yocto 项目中的 bitbake 环境构建 glibc 库。我能够成功构建它,但是当我更改 local.conf 文件中的 C 编译器标志时,它给出了缺少属性错误。
build/conf/local.conf 文件.
这里我加一行:
TARGET_CFLAGS += "-fprofile-arcs -ftest-coverage"
然后它抛出错误:缺少 attribute((constructor)) 支持?
我已将此行添加到 local.conf 文件中。
TARGET_CFLAGS += "-fprofile-arcs -ftest-coverage"
请为 config.log 文件找到 link:https://drive.google.com/open?id=14tiQJ8JIFE_tDWt3H9tS8zBBQROcZDNa
Sstate summary: Wanted 7 Found 1 Missed 6 Current 51 (14% match, 89% complete)
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
ERROR: glibc-2.28-r0 do_configure: configure failed
ERROR: glibc-2.28-r0 do_configure: Function failed: do_configure (log file is located at /scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/temp/log.do_configure.19973)
ERROR: Logfile of failure stored in: /scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/temp/log.do_configure.19973
Log data follows:
| DEBUG: SITE files ['endian-little', 'bit-32', 'ix86-common', 'common-linux', 'common-glibc', 'i586-linux', 'common']
| DEBUG: Executing shell function autotools_preconfigure
| Previously configured separate build directory detected, cleaning /scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/build-i586-poky-linux
| DEBUG: Shell function autotools_preconfigure finished
| DEBUG: Executing python function autotools_aclocals
| DEBUG: SITE files ['endian-little', 'bit-32', 'ix86-common', 'common-linux', 'common-glibc', 'i586-linux', 'common']
| DEBUG: Python function autotools_aclocals finished
| DEBUG: Executing shell function do_configure
| NOTE: Running ../git/configure --build=x86_64-linux --host=i586-poky-linux --target=i586-poky-linux --prefix=/usr --exec_prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/libexec --datadir=/usr/share --sysconfdir=/etc --sharedstatedir=/com --localstatedir=/var --libdir=/usr/lib --includedir=/usr/include --oldincludedir=/usr/include --infodir=/usr/share/info --mandir=/usr/share/man --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot=/scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/recipe-sysroot --enable-kernel=3.2.0 --disable-profile --disable-debug --without-gd --enable-clocale=gnu --with-headers=/scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/recipe-sysroot/usr/include --without-selinux --enable-tunables --enable-bind-now --enable-stack-protector=strong --enable-stackguard-randomization --disable-crypt --with-default-link --enable-nscd --disable-static
| checking build system type... x86_64-pc-linux-gnu
| checking host system type... i586-poky-linux-gnu
| checking for i586-poky-linux-gcc... i586-poky-linux-gcc -m32 -march=i586 --sysroot=/scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/recipe-sysroot
| checking for suffix of object files... o
| checking whether we are using the GNU C compiler... yes
| checking whether i586-poky-linux-gcc -m32 -march=i586 --sysroot=/scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/recipe-sysroot accepts -g... yes
| checking for gcc... gcc
| checking for i586-poky-linux-readelf... i586-poky-linux-readelf
| checking whether we are using the GNU C++ compiler... yes
| checking whether i586-poky-linux-g++ -m32 -march=i586 --sysroot=/scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/recipe-sysroot accepts -g... yes
| checking whether i586-poky-linux-g++ -m32 -march=i586 --sysroot=/scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/recipe-sysroot can link programs... no
| checking for sysdeps preconfigure fragments... aarch64 alpha arm hppa i386 m68k microblaze mips nios2 powerpc riscv s390 sh sparc x86_64
| checking for use of fpu sysdeps directories... yes
| checking for -fstack-protector... (cached) no
| checking for -fstack-protector-strong... (cached) no
| checking for -fstack-protector-all... (cached) no
| 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/i386 sysdeps/unix/sysv/linux/x86 sysdeps/x86/nptl sysdeps/i386/nptl sysdeps/unix/sysv/linux sysdeps/nptl sysdeps/pthread sysdeps/gnu sysdeps/unix/inet sysdeps/unix/sysv sysdeps/unix/i386 sysdeps/unix sysdeps/posix sysdeps/i386/i586 sysdeps/i386/fpu sysdeps/x86/fpu sysdeps/i386 sysdeps/x86 sysdeps/wordsize-32 sysdeps/ieee754/float128 sysdeps/ieee754/ldbl-96 sysdeps/ieee754/dbl-64 sysdeps/ieee754/flt-32 sysdeps/ieee754 sysdeps/generic
| checking for a BSD-compatible install... /scratch/work/day8/poky/build/tmp/hosttools/install -c
| checking whether ln -s works... yes
| checking whether /scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/recipe-sysroot-native/usr/bin/i586-poky-linux/../../libexec/i586-poky-linux/gcc/i586-poky-linux/8.2.0/as is GNU as... yes
| checking whether /scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/recipe-sysroot-native/usr/bin/i586-poky-linux/../../libexec/i586-poky-linux/gcc/i586-poky-linux/8.2.0/ld is GNU ld... yes
| checking for /scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/recipe-sysroot-native/usr/bin/i586-poky-linux/../../libexec/i586-poky-linux/gcc/i586-poky-linux/8.2.0/as... /scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/recipe-sysroot-native/usr/bin/i586-poky-linux/../../libexec/i586-poky-linux/gcc/i586-poky-linux/8.2.0/as
| checking version of /scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/recipe-sysroot-native/usr/bin/i586-poky-linux/../../libexec/i586-poky-linux/gcc/i586-poky-linux/8.2.0/as... 2.31.1.20181224, ok
| checking for /scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/recipe-sysroot-native/usr/bin/i586-poky-linux/../../libexec/i586-poky-linux/gcc/i586-poky-linux/8.2.0/ld... /scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/recipe-sysroot-native/usr/bin/i586-poky-linux/../../libexec/i586-poky-linux/gcc/i586-poky-linux/8.2.0/ld
| checking version of /scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/recipe-sysroot-native/usr/bin/i586-poky-linux/../../libexec/i586-poky-linux/gcc/i586-poky-linux/8.2.0/ld... 2.31.1.20181224, ok
| checking for gnumake... make
| checking version of make... 4.2.1, ok
| checking for gnumsgfmt... no
| checking for gmsgfmt... no
| checking for msgfmt... no
| checking for makeinfo... makeinfo
| checking version of makeinfo... 6.1, ok
| checking for sed... sed
| checking version of sed... 4.2.2, ok
| checking for gawk... gawk
| checking version of gawk... 4.1.3, ok
| checking for bison... bison
| checking version of bison... 3.0.4, ok
| checking if i586-poky-linux-gcc -m32 -march=i586 --sysroot=/scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/recipe-sysroot is sufficient to build libc... yes
| checking for i586-poky-linux-nm... i586-poky-linux-nm
| checking for python3... python3
| configure: WARNING:
| *** These auxiliary programs are missing or incompatible versions: msgfmt
| *** some features or tests will be disabled.
| *** Check the INSTALL file for required versions.
| checking LD_LIBRARY_PATH variable... ok
| checking for bash... (cached) /bin/bash
| checking for perl... /scratch/work/day8/poky/build/tmp/hosttools/perl
| checking for install-info... /usr/bin/install-info
| checking for .set assembler directive... no
| checking linker support for protected data symbol... yes
| checking linker support for INSERT in linker script... no
| 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... configure: error: missing __attribute__ ((constructor)) support??
| NOTE: The following config.log files may provide further information.
| NOTE: /scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/build-i586-poky-linux/config.log
| ERROR: configure failed
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_configure (log file is located at /scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/temp/log.do_configure.19973)
ERROR: Task (/scratch/work/day8/poky/meta/recipes-core/glibc/glibc_2.28.bb:do_configure) failed with exit code '1'
NOTE: Tasks Summary: Attempted 388 tasks of which 387 didn't need to be rerun and 1 failed.
Summary: 1 task failed:
/scratch/work/day8/poky/meta/recipes-core/glibc/glibc_2.28.bb:do_configure
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.
由于您通过添加这些 CFLAGS -fprofile-arcs -ftest-coverage 启用了代码覆盖支持 - 这些 CFLAGS 必须已经传播编译由 autoconf 构建的 conftest 二进制文件。这个二进制文件是为了测试是否支持一个特定的特性(如它所说的"whether to use .ctors/.dtors header and trailer")而构建的(实际上,在配置过程中有几个类似的构建来测试特定的特性)。我无法证明这一点,因为详细的错误打印应该在您尚未共享的特定日志文件中:
| NOTE: The following config.log files may provide further information.
| NOTE: /scratch/work/day8/poky/build/tmp/work/i586-poky-linux/glibc/2.28-r0/build-i586-poky-linux/config.log
但是,我敢打赌,它应该包含如下内容:
conftest.c:(.text+0xae): undefined reference to `__gcov_init'
...
collect2: ld returned 1 exit status
这是因为代码使用了一些函数调用,而链接器无法找到它的实现(即使在这些完全没有意义的 conftest 二进制文件中)。
可以通过指定相应的配置选项跳过此特定配置测试 - libc_cv_ctors_header(在这种情况下,名称取自 glib 的 configure.ac) - 添加 EXTRA_OECONF 到 local.conf(例如 EXTRA_OECONF = "libc_cv_ctors_header=yes"),但是这些标志实际上会影响所有此类测试,我们不应该猜测 yes/no 值等。
因此,最好让链接器知道覆盖支持——即为 TARGET_LDFLAGS:
提供相同的标志TARGET_LDFLAGS += "-fprofile-arcs -ftest-coverage"