binutils make 交叉编译出错
我正在尝试编译 binutils 以设置 GNU 工具链,以便在 Linux x86 架构上为 ARM 进行交叉编译。
为此,我从以下位置下载了 GNU 工具链: http://lejosrt.org/tuto/install-gnu-arm-toolchain -under-linux
这需要运行一个脚本来安装和编译所有内容。 但是,在运行脚本时,出现以下错误:
make[2]: Entering directory /home/GNU_Toolchain/src/binutils-2.20.51.0.1/libiberty' rm -f ./libiberty.a pic/./libiberty.a ar rc ./libiberty.a \ ./regex.o ./cplus-dem.o ./cp-demangle.o ./md5.o ./sha1.o ./alloca.o ./argv.o ./choose-temp.o ./concat。 o ./cp-demint.o ./crc32.o ./dyn-string.o ./fdmatch.o ./fibheap.o ./filename_cmp.o ./floatformat.o ./fnmatch.o ./fopen_unlocked.o ./getopt.o ./getopt1.o ./getpwd.o ./getruntime.o ./hashtab.o ./hex.o ./lbasename.o ./lrealpath.o ./make-relative-prefix.o ./make-temp-file.o ./objalloc.o ./obstack.o ./partition.o ./pexecute.o ./physmem.o ./pex-common.o ./pex-one.o ./ pex-unix.o ./safe-ctype.o ./sort.o ./spaces.o ./splay-tree.o ./strerror.o ./strsignal.o ./unlink-if-ordinary.o ./xatexit.o ./xexit.o ./xmalloc.o ./xmemdup.o ./xstrdup.o ./xstrerror.o ./xstrndup.o< br> *** 检测到缓冲区溢出 ***: ar 终止 =======回溯:========= /lib/i386-linux-gnu/libc.so.6(__fortify_fail+0x50)[0x40117df0] /lib/i386-linux-gnu/libc.so.6(+0xe4cca)[0x40116cca] /lib/i386-linux-gnu/libc.so.6(+0xe43c8)[0x401163c8] /lib/i386-linux-gnu/libc.so.6(_IO_default_xsputn+0x95)[0x4009b7e5] /lib/i386-linux-gnu/libc.so.6(_IO_padn+0xc8)[0x4008f598] /lib/i386-linux-gnu/libc.so.6(_IO_vfprintf+0x1cd5)[0x40070e35] /lib/i386-linux-gnu/libc.so.6(__vsprintf_chk+0xad)[0x4011647d] /lib/i386-linux-gnu/libc.so.6(__sprintf_chk+0x2d)[0x401163bd] ar[0x804ec04] ar[0x8050d38] ar[0x80585c2] ar[0x804b452] ar[0x804c3fd] /lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x40048e37] ar[0x80494c1] =======内存映射:======== 08048000-080b5000 r-xp 00000000 08:01 3940915 /usr/local/bin/ar 080b5000-080b6000 r--p 0006c000 08:01 3940915 /usr/local/bin/ar 080b6000-080b7000 rw-p 0006d000 08:01 3940915 /usr/local/bin/ar 080b7000-080bb000 读写 00000000 00:00 0 08efe000-08f9d000 rw-p 00000000 00:00 0 [堆] 40000000-4001c000 r-xp 00000000 08:01 3670837 /lib/i386-linux-gnu/ld-2.13.so 4001c000-4001d000 r--p 0001b000 08:01 3670837 /lib/i386-linux-gnu/ld-2.13.so 4001d000-4001e000 读写-p 0001c000 08:01 3670837 /lib/i386-linux-gnu/ld-2.13.so 4001e000-4001f000 r-xp 00000000 00:00 0 [vdso] 4001f000-40021000 读写 00000000 00:00 0 40021000-40022000 r--p 0065c000 08:01 3544340 /usr/lib/locale/locale-archive 40032000-4018c000 r-xp 00000000 08:01 3670850 /lib/i386-linux-gnu/libc-2.13.so 4018c000-4018d000 ---p 0015a000 08:01 3670850 /lib/i386-linux-gnu/libc-2.13.so 4018d000-4018f000 r--p 0015a000 08:01 3670850 /lib/i386-linux-gnu/libc-2.13.so 4018f000-40190000 rw-p 0015c000 08:01 3670850 /lib/i386-linux-gnu/libc-2.13.so 40190000-40195000 读写 00000000 00:00 0 40195000-40395000 r--p 00000000 08:01 3544340 /usr/lib/locale/locale-archive 403a6000-403c0000 r-xp 00000000 08:01 3670878 /lib/i386-linux-gnu/libgcc_s.so.1 403c0000-403c1000 r--p 00019000 08:01 3670878 /lib/i386-linux-gnu/libgcc_s.so.1 403c1000-403c2000 rw-p 0001a000 08:01 3670878 /lib/i386-linux-gnu/libgcc_s.so.1 bff19000-bff3b000 rw-p 00000000 00:00 0 [堆栈] make[2]: *** [libiberty.a] 已中止 make[2]: *** 删除文件
libiberty.a' make[2]:离开目录 /home/GNU_Toolchain/src/binutils-2.20.51.0.1/libiberty' make[1]: *** [全自由] 错误 2 make[1]: 离开目录
/home/GNU_Toolchain/src/binutils-2.20.51.0.1' make: * [all] 错误 2
我尝试升级 binutils 包但没有成功。
有什么想法吗? 提前致谢。
I am trying to compile binutils to set up GNU toolchain for cross compiling for ARM on linux x86 architecture.
For this, I downloaded the GNU toolchain from :
http://lejosrt.org/tuto/install-gnu-arm-toolchain-under-linux
This requires a script to be run to install and compile everything.
However, on running the script, following error occurs:
make[2]: Entering directory /home/GNU_Toolchain/src/binutils-2.20.51.0.1/libiberty'
libiberty.a'
rm -f ./libiberty.a pic/./libiberty.a
ar rc ./libiberty.a \
./regex.o ./cplus-dem.o ./cp-demangle.o ./md5.o ./sha1.o ./alloca.o ./argv.o ./choose-temp.o ./concat.o ./cp-demint.o ./crc32.o ./dyn-string.o ./fdmatch.o ./fibheap.o ./filename_cmp.o ./floatformat.o ./fnmatch.o ./fopen_unlocked.o ./getopt.o ./getopt1.o ./getpwd.o ./getruntime.o ./hashtab.o ./hex.o ./lbasename.o ./lrealpath.o ./make-relative-prefix.o ./make-temp-file.o ./objalloc.o ./obstack.o ./partition.o ./pexecute.o ./physmem.o ./pex-common.o ./pex-one.o ./pex-unix.o ./safe-ctype.o ./sort.o ./spaces.o ./splay-tree.o ./strerror.o ./strsignal.o ./unlink-if-ordinary.o ./xatexit.o ./xexit.o ./xmalloc.o ./xmemdup.o ./xstrdup.o ./xstrerror.o ./xstrndup.o
*** buffer overflow detected ***: ar terminated
======= Backtrace: =========
/lib/i386-linux-gnu/libc.so.6(__fortify_fail+0x50)[0x40117df0]
/lib/i386-linux-gnu/libc.so.6(+0xe4cca)[0x40116cca]
/lib/i386-linux-gnu/libc.so.6(+0xe43c8)[0x401163c8]
/lib/i386-linux-gnu/libc.so.6(_IO_default_xsputn+0x95)[0x4009b7e5]
/lib/i386-linux-gnu/libc.so.6(_IO_padn+0xc8)[0x4008f598]
/lib/i386-linux-gnu/libc.so.6(_IO_vfprintf+0x1cd5)[0x40070e35]
/lib/i386-linux-gnu/libc.so.6(__vsprintf_chk+0xad)[0x4011647d]
/lib/i386-linux-gnu/libc.so.6(__sprintf_chk+0x2d)[0x401163bd]
ar[0x804ec04]
ar[0x8050d38]
ar[0x80585c2]
ar[0x804b452]
ar[0x804c3fd]
/lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x40048e37]
ar[0x80494c1]
======= Memory map: ========
08048000-080b5000 r-xp 00000000 08:01 3940915 /usr/local/bin/ar
080b5000-080b6000 r--p 0006c000 08:01 3940915 /usr/local/bin/ar
080b6000-080b7000 rw-p 0006d000 08:01 3940915 /usr/local/bin/ar
080b7000-080bb000 rw-p 00000000 00:00 0
08efe000-08f9d000 rw-p 00000000 00:00 0 [heap]
40000000-4001c000 r-xp 00000000 08:01 3670837 /lib/i386-linux-gnu/ld-2.13.so
4001c000-4001d000 r--p 0001b000 08:01 3670837 /lib/i386-linux-gnu/ld-2.13.so
4001d000-4001e000 rw-p 0001c000 08:01 3670837 /lib/i386-linux-gnu/ld-2.13.so
4001e000-4001f000 r-xp 00000000 00:00 0 [vdso]
4001f000-40021000 rw-p 00000000 00:00 0
40021000-40022000 r--p 0065c000 08:01 3544340 /usr/lib/locale/locale-archive
40032000-4018c000 r-xp 00000000 08:01 3670850 /lib/i386-linux-gnu/libc-2.13.so
4018c000-4018d000 ---p 0015a000 08:01 3670850 /lib/i386-linux-gnu/libc-2.13.so
4018d000-4018f000 r--p 0015a000 08:01 3670850 /lib/i386-linux-gnu/libc-2.13.so
4018f000-40190000 rw-p 0015c000 08:01 3670850 /lib/i386-linux-gnu/libc-2.13.so
40190000-40195000 rw-p 00000000 00:00 0
40195000-40395000 r--p 00000000 08:01 3544340 /usr/lib/locale/locale-archive
403a6000-403c0000 r-xp 00000000 08:01 3670878 /lib/i386-linux-gnu/libgcc_s.so.1
403c0000-403c1000 r--p 00019000 08:01 3670878 /lib/i386-linux-gnu/libgcc_s.so.1
403c1000-403c2000 rw-p 0001a000 08:01 3670878 /lib/i386-linux-gnu/libgcc_s.so.1
bff19000-bff3b000 rw-p 00000000 00:00 0 [stack]
make[2]: *** [libiberty.a] Aborted
make[2]: *** Deleting file
make[2]: Leaving directory /home/GNU_Toolchain/src/binutils-2.20.51.0.1/libiberty'
/home/GNU_Toolchain/src/binutils-2.20.51.0.1'
make[1]: *** [all-libiberty] Error 2
make[1]: Leaving directory
make: * [all] Error 2
I tried upgrading binutils package but in vain.
Any ideas?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您只想构建它并忽略潜在问题,请将 -D_FORTIFY_SOURCE=1 与您的 CFLAGS 一起放入。由于您使用的是
make
,它看起来像:根据您的项目,您甚至可以将其作为标志提供给
configure
脚本。当您构建时,您会收到一堆有关重新定义此宏的警告,但这是预期的。
那么这个标志有什么作用呢?我不是专家,但它基本上是最新版本的 gcc/glibc 中的一个新功能,尝试检测缓冲区溢出。默认级别是“2”(据我所知),这实际上施加了一些超出标准规定的额外限制。 “1”级不太严格。
如果您很迂腐,您可能想确切地调查为什么您的编译器检测到缓冲区溢出。例如,可能是对
snprintf
的调用,其中有人忘记了NUL
终止行为。(尽管:在遇到麻烦之前,很可能它已经被上游项目中的某人修补了,并且该修复尚未渗透到您从中获取此信息的任何项目,所以我首先向项目维护人员询问。)
有关更多信息,请参阅此 RedHat binutils 邮件列表帖子。
If you want to just build it and ignore potential problems, put
-D_FORTIFY_SOURCE=1
in with yourCFLAGS
. Since you're usingmake
, it would look something like:Depending on your project, you could even supply this as a flag to the
configure
script.When you build, you'll get a bunch of warnings about redefining this macro, but that's expected.
So what does this flag do? I'm no expert, but it's basically a new feature in recent versions of gcc/glibc that attempts to detect buffer overflows. The default level is "2" (AFAIK), which actually imposes some extra limits above and beyond what the standards dictate. Level "1" is a little less strict.
If you're pedantic, you might like to investigate exactly why your compiler is detecting a buffer overflow. It might be, for example, a call to
snprintf
where someone's forgotten about theNUL
termination behaviour.(Although: before you go to the trouble, it's quite likely that it's been patched by someone in the upstream project and the fix hasn't trickled through to whatever project you're obtaining this from, so I'd ask the project maintainers about it first.)
For more information, see this RedHat binutils mailing list post.