我正在尝试使用Yocto Project中的bitbake环境构建glibc库。我能够成功构建它,但是当我更改local.conf文件中的C编译器标志时,它给出了缺少的属性错误。
build / conf / local.conf文件。
在这里我添加一行:
TARGET_CFLAGS += "-fprofile-arcs -ftest-coverage"
然后抛出错误:缺少属性((构造函数))支持?
我已将这一行添加到local.conf文件中。
TARGET_CFLAGS + =“ -fprofile-arcs -ftest-coverage”
请找到config.log文件的链接: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.
答案 0 :(得分:1)
由于通过添加以下CFLAGS启用了代码覆盖支持,因此 -fprofile-arcs -ftest-coverage -这些CFLAGS必须已经传播到编译的conftest二进制文件的编译中通过autoconf。构建此二进制文件是为了测试是否支持某个特定功能(如其所说的“是否使用.ctors / .dtors标头和尾标”)(实际上,在配置过程中会发生一些类似的构建,以测试特定功能) 。我无法证明这一点,因为详细的错误打印应该位于您尚未共享的特定日志文件中:
| 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),可以 跳过此特定配置测试。-添加<对local.conf的strong> EXTRA_OECONF (例如EXTRA_OECONF =“ libc_cv_ctors_header = yes”),但是这些标志实际上会影响所有此类测试,因此我们不希望猜测是/否值等等。
因此,最好让链接程序了解覆盖范围支持-即为 TARGET_LDFLAGS 提供相同的标志:
TARGET_LDFLAGS += "-fprofile-arcs -ftest-coverage"