gpt4 book ai didi

c - 针对 libopcodes 编译时出错

转载 作者:太空宇宙 更新时间:2023-11-04 02:38:06 25 4
gpt4 key购买 nike

我正在关注 here 中的一些代码如下:

OP 说您可以使用 -lbfd -lopcodes 进行链接。

但是,对于 OpenSuSE,我发现对于 libbfd,我需要 -lbfd -liberty -lz -ldl

尝试编译时,这是我的结果:

makegcc ./main.c -lbfd -liberty -lz -ldl -lopcodes -g -o bfd_se/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../lib64/libopcodes.a(arm-dis.o): In function `print_insn_neon':/home/abuild/rpmbuild/BUILD/binutils-2.24/build-dir/opcodes/../../opcodes/arm-dis.c:2927: undefined reference to `floatformat_ieee_single_little'/home/abuild/rpmbuild/BUILD/binutils-2.24/build-dir/opcodes/../../opcodes/arm-dis.c:2927: undefined reference to `floatformat_to_double'/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../lib64/libopcodes.a(m68k-dis.o): In function `print_insn_arg':/home/abuild/rpmbuild/BUILD/binutils-2.24/build-dir/opcodes/../../opcodes/m68k-dis.c:1103: undefined reference to `floatformat_m68881_ext'/home/abuild/rpmbuild/BUILD/binutils-2.24/build-dir/opcodes/../../opcodes/m68k-dis.c:1103: undefined reference to `floatformat_to_double'/home/abuild/rpmbuild/BUILD/binutils-2.24/build-dir/opcodes/../../opcodes/m68k-dis.c:1099: undefined reference to `floatformat_ieee_double_big'/home/abuild/rpmbuild/BUILD/binutils-2.24/build-dir/opcodes/../../opcodes/m68k-dis.c:1099: undefined reference to `floatformat_to_double'/home/abuild/rpmbuild/BUILD/binutils-2.24/build-dir/opcodes/../../opcodes/m68k-dis.c:1095: undefined reference to `floatformat_ieee_single_big'/home/abuild/rpmbuild/BUILD/binutils-2.24/build-dir/opcodes/../../opcodes/m68k-dis.c:1095: undefined reference to `floatformat_to_double'collect2: error: ld returned 1 exit statusMakefile:4: recipe for target 'bfd_se' failedmake: *** [bfd_se] Error 1

我需要添加哪些其他标志才能编译该程序?我看到错误与不同的体系结构有关,但我并没有尝试交叉编译。

谢谢!

有用信息:uname -a

Linux node 4.0.5-THS_on #1 SMP PREEMPT Thu Jun 18 16:37:06 CDT 2015 x86_64 x86_64 x86_64 GNU/Linux

gcc --version

gcc (SUSE Linux) 4.8.3 20140627 [gcc-4_8-branch revision 212064]Copyright (C) 2013 Free Software Foundation, Inc.This is free software; see the source for copying conditions.  There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

objdump --version(它使用 libbfd 和 libopcodes)

GNU objdump (GNU Binutils; openSUSE 13.2) 2.24.0.20140403-6.1Copyright 2013 Free Software Foundation, Inc.This program is free software; you may redistribute it under the terms ofthe GNU General Public License version 3 or (at your option) any later version.This program has absolutely no warranty.

最佳答案

大多数时候 libbfdlibopcodes 不会作为标准发行版中的共享库出现(因为它们不打算链接到)。您必须链接到静态库(libbfd.alibopcodes.a)或重新编译您的分发包并在其中包含共享库(.so 文件)。

所以,为了说清楚,请尝试:

gcc ./main.c -liberty -lz -ldl -g -o bfd_se /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../lib64/libopcodes.a /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../lib64/libbfd.a 

关于c - 针对 libopcodes 编译时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34952123/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com