如何启用RELRO支持?

我们一直在尝试在12.04 64位系统上构建一个LFS系统。在配置glibc的阶段,我收到了以下错误信息:

configure: error: 需要支持-z relro的链接器

请问如何启用RELRO支持?
/media/lfs/sources/glibc-build$ ../glibc-2.15/configure                             \
>       --prefix=/tools                                 \
>       --host=$LFS_TGT                                 \
>       --build=$(../glibc-2.15/scripts/config.guess) \
>       --disable-profile                               \
>       --enable-add-ons                                \
>       --enable-kernel=2.6.25                          \
>       --with-headers=/tools/include                   \
>       libc_cv_forced_unwind=yes                       \
>       libc_cv_ctors_header=yes                        \
>       libc_cv_c_cleanup=yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-lfs-linux-gnu
checking for x86_64-lfs-linux-gnu-gcc... x86_64-lfs-linux-gnu-gcc
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether x86_64-lfs-linux-gnu-gcc accepts -g... yes
checking for x86_64-lfs-linux-gnu-gcc option to accept ISO C89... unsupported
checking for gcc... gcc
checking how to run the C preprocessor... x86_64-lfs-linux-gnu-gcc -E
checking for x86_64-lfs-linux-gnu-g++... no
checking for x86_64-lfs-linux-gnu-c++... no
checking for x86_64-lfs-linux-gnu-gpp... no
checking for x86_64-lfs-linux-gnu-aCC... no
checking for x86_64-lfs-linux-gnu-CC... no
checking for x86_64-lfs-linux-gnu-cxx... no
checking for x86_64-lfs-linux-gnu-cc++... no
checking for x86_64-lfs-linux-gnu-cl.exe... no
checking for x86_64-lfs-linux-gnu-FCC... no
checking for x86_64-lfs-linux-gnu-KCC... no
checking for x86_64-lfs-linux-gnu-RCC... no
checking for x86_64-lfs-linux-gnu-xlC_r... no
checking for x86_64-lfs-linux-gnu-xlC... no
checking for g++... g++
configure: WARNING: using cross tools not prefixed with host triplet
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
configure: running configure fragment for add-on libidn
configure: running configure fragment for add-on nptl
checking for assembler gnu_indirect_function symbol type support... yes
checking whether .text pseudo-op must be used... yes
checking for assembler global-symbol directive... .globl
checking for assembler .type directive prefix... @
checking sysdep dirs... sysdeps/x86_64/elf nptl/sysdeps/unix/sysv/linux/x86_64 sysdeps/unix/sysv/linux/x86_64 sysdeps/unix/sysv/linux/wordsize-64 nptl/sysdeps/unix/sysv/linux nptl/sysdeps/pthread sysdeps/pthread sysdeps/unix/sysv/linux sysdeps/gnu sysdeps/unix/common sysdeps/unix/mman sysdeps/unix/inet nptl/sysdeps/unix/sysv sysdeps/unix/sysv sysdeps/unix/x86_64 nptl/sysdeps/unix sysdeps/unix sysdeps/posix sysdeps/x86_64/fpu/multiarch sysdeps/x86_64/fpu sysdeps/x86_64/multiarch nptl/sysdeps/x86_64 sysdeps/x86_64 sysdeps/wordsize-64 sysdeps/ieee754/ldbl-96 sysdeps/ieee754/dbl-64/wordsize-64 sysdeps/ieee754/dbl-64 sysdeps/ieee754/flt-32 sysdeps/ieee754 sysdeps/generic/elf sysdeps/generic
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking whether /media/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/4.7.0/../../../../x86_64-lfs-linux-gnu/bin/as is GNU as... yes
checking whether /media/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/4.7.0/../../../../x86_64-lfs-linux-gnu/bin/ld is GNU ld... yes
checking for /media/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/4.7.0/../../../../x86_64-lfs-linux-gnu/bin/as... /media/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/4.7.0/../../../../x86_64-lfs-linux-gnu/bin/as
checking version of /media/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/4.7.0/../../../../x86_64-lfs-linux-gnu/bin/as... 2.22, ok
checking for /media/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/4.7.0/../../../../x86_64-lfs-linux-gnu/bin/ld... /media/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/4.7.0/../../../../x86_64-lfs-linux-gnu/bin/ld
checking version of /media/lfs/tools/bin/../lib/gcc/x86_64-lfs-linux-gnu/4.7.0/../../../../x86_64-lfs-linux-gnu/bin/ld... 2.22, ok
checking for pwd... /bin/pwd
checking for x86_64-lfs-linux-gnu-gcc... (cached) x86_64-lfs-linux-gnu-gcc
checking version of x86_64-lfs-linux-gnu-gcc... 4.7.0, ok
checking for gnumake... no
checking for gmake... no
checking for make... make
checking version of make... 3.81, ok
checking for gnumsgfmt... no
checking for gmsgfmt... no
checking for msgfmt... msgfmt
checking version of msgfmt... 0.18.1, ok
checking for makeinfo... no
checking for sed... sed
checking version of sed... 4.2.1, ok
checking for x86_64-lfs-linux-gnu-readelf... x86_64-lfs-linux-gnu-readelf
checking for autoconf... autoconf
checking whether autoconf works... yes
configure: WARNING:
*** These auxiliary programs are missing or incompatible versions: makeinfo
*** some features will be disabled.
*** Check the INSTALL file for required versions.
checking LD_LIBRARY_PATH variable... ok
checking whether GCC supports -static-libgcc... -static-libgcc
checking for bash... /bin/bash
checking for gawk... no
checking for mawk... mawk
checking for perl... /usr/bin/perl
checking for install-info... /usr/bin/install-info
checking for bison... no
checking for signed size_t type... no
checking for libc-friendly stddef.h... yes
checking whether we need to use -P to assemble .S files... no
checking for .set assembler directive... yes
checking for assembler gnu_unique_object symbol type... yes
checking for .symver assembler directive... yes
checking for ld --version-script... yes
checking for .previous assembler directive... yes
checking for .protected and .hidden assembler directive... yes
checking whether __attribute__((visibility())) is supported... yes
checking for broken __attribute__((visibility()))... no
checking for broken __attribute__((alias()))... no
checking whether to put _rtld_local into .sdata section... no
checking for .preinit_array/.init_array/.fini_array support... yes
checking whether to use .ctors/.dtors header and trailer... (cached) yes
checking for libunwind-support in compiler... no
checking for -z nodelete option... yes
checking for -z nodlopen option... yes
checking for -z initfirst option... yes
checking for -z relro option... no
configure: error: linker with -z relro support required

你能在http://paste.ubuntu.com上发布`configure`的完整输出,并**编辑你的问题**以包含一个链接吗?如果你能在问题发生的步骤中包含一个链接到你认为最相关的LFS文档,那也可能会有所帮助。(在你编辑了帖子以添加这些信息后,我建议将此评论标记为过时。) - Eliah Kagan
1个回答

我在安装过程中遇到了同样的问题(在Debian上),我通过安装gawk并使用它而不是mawk来解决了这个问题。也许对你也会起作用。

1是的,"sudo apt-get install gawk" 对我也起作用了。谢谢! - Shannon_VanWagner