【问题标题】:glibc error while building linux from scratch从头开始构建 linux 时出现 glibc 错误
【发布时间】:2012-08-04 19:57:15
【问题描述】:

当我为 LFS 7.1 “制作” glibc-2.14.1 时出现以下错误。我正在使用 ubuntu 作为主机操作系统。

gcc ../sysdeps/unix/sysv/linux/syslog.c -c -std=gnu99 -fgnu89-inline -O2 -Wall -Winline 
-Wwrite-strings -fmerge-all-constants -g -Wstrict-prototypes -mpreferred-stack-
boundary=2  -Wa,-mtune=i686 -fexceptions   -I../include -I/mnt/lfs/sources/glibc-
build/misc -I/mnt/lfs/sources/glibc-build -I../sysdeps/i386/elf -
I../nptl/sysdeps/unix/sysv/linux/i386/i686 -I../sysdeps/unix/sysv/linux/i386/i686 -
I../nptl/sysdeps/unix/sysv/linux/i386 -I../sysdeps/unix/sysv/linux/i386 -
I../nptl/sysdeps/unix/sysv/linux -I../nptl/sysdeps/pthread -I../sysdeps/pthread -
I../sysdeps/unix/sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/common -
I../sysdeps/unix/mman -I../sysdeps/unix/inet -I../sysdeps/unix/sysv/i386 -
I../nptl/sysdeps/unix/sysv -I../sysdeps/unix/sysv -I../sysdeps/unix/i386 -
I../nptl/sysdeps/unix -I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/i386/i686/fpu -
I../sysdeps/i386/i686/multiarch -I../nptl/sysdeps/i386/i686 -I../sysdeps/i386/i686 -
I../sysdeps/i386/i486 -I../nptl/sysdeps/i386/i486 -I../sysdeps/i386/fpu -
I../nptl/sysdeps/i386 -I../sysdeps/i386 -I../sysdeps/wordsize-32 -
I../sysdeps/ieee754/ldbl-96 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -
I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic -I../nptl  -I.. -
I../libio -I. -nostdinc -isystem /usr/lib/gcc/i686-linux-gnu/4.6/include -isystem 
/usr/lib/gcc/i686-linux-gnu/4.6/include-fixed -isystem /tools/include -D_LIBC_REENTRANT 
-include ../include/libc-symbols.h       -o /mnt/lfs/sources/glibc-build/misc/syslog.o 
-MD -MP -MF /mnt/lfs/sources/glibc-build/misc/syslog.o.dt -MT /mnt/lfs/sources/glibc-
build/misc/syslog.o 
In file included from ../sysdeps/unix/sysv/linux/syslog.c:10:0:
../misc/syslog.c: In function '__vsyslog_chk':
../misc/syslog.c:144:9: warning: variable 'prioff' set but not used [-Wunused-but-set-  
variable]
../misc/syslog.c:123:1: sorry, unimplemented: inlining failed in call to 'syslog':   
 function body not available
../misc/syslog.c:155:9: sorry, unimplemented: called from here
make[2]: *** [/mnt/lfs/sources/glibc-build/misc/syslog.o] Error 1
make[2]: Leaving directory `/mnt/lfs/sources/glibc-2.14.1/misc'
make[1]: *** [misc/subdir_lib] Error 2
make[1]: Leaving directory `/mnt/lfs/sources/glibc-2.14.1'
make: *** [all] Error 2

谁能告诉我该怎么做?

【问题讨论】:

    标签: linux makefile glibc


    【解决方案1】:

    对于 glibc 2.15,我必须像 ks1322 一样:

    $ ../glibc2.15/configure CFLAGS="-O2 -U_FORTIFY_SOURCE -fno-stack-protector" $ make

    -O2 是恢复默认优化所必需的,以避免许多故障。

    需要-U_FORTIFY_SOURCE 以避免gcc ../sysdeps/unix/sysv/linux/syslog.c 失败(In function ‘__vsyslog_chk’: [...] inlining failed in call to ‘syslog’

    -fno-stack-protector 是必需的,以避免 gcc [...] elf/dl-allobjs.os libc_pic.a ((init-first.os):(.data+0x0): multiple definition of '__libc_multiple_libcs') 失败。

    有了这些CFLAGS,我只会收到一个警告 (errlist.c count 133 inflated to GLIBC_2.12 count 134 (old errno.h?))。

    附: 使用gold 链接器(ld.gold,来自binutils-gold 包)也很重要,因为libcconfig 会拒绝它。这很容易通过将/usr/bin/ld 符号链接从ld.gold 更改为ld.bfd 来完成。

    【讨论】:

      【解决方案2】:

      make 失败后,以下对我有用:

      make clean
      make -j2 CFLAGS="-U_FORTIFY_SOURCE -O2 -fno-stack-protector"
      

      详情请参阅此博客http://www.yonch.com/tech/78-compiling-glibc

      【讨论】:

        【解决方案3】:

        glibc build issues, inlining failed

        需要在 gcc 调用中添加 -U_FORTIFY_SOURCE。

        【讨论】:

        • 谢谢...+1 的回答...但是您能告诉我如何在使用 make 时添加此选项吗?
        • CFLAGS=-U_FORTIFY_SOURCE 制作
        【解决方案4】:

        @avinash - 尝试以下...

        1) 重新运行configure ... CFLAGS="-O2 -U_FORTIFY_SOURCE" ./configure
        2) 重新运行 make ... CFLAGS="-O2 -U_FORTIFY_SOURCE" make

        【讨论】:

          猜你喜欢
          • 2014-09-30
          • 2011-09-17
          • 2019-03-17
          • 1970-01-01
          • 1970-01-01
          • 2012-04-08
          • 1970-01-01
          • 1970-01-01
          • 2021-12-17
          相关资源
          最近更新 更多