加密货币++使用 ANT 时出现链接器错误
我正在尝试对前任员工为我们编写的一些自定义软件的构建过程进行逆向工程。我已经看到一切都可以正常编译,但我在链接过程中收到一个错误,表明 crypto++ 存在问题。有什么线索吗?
compile.util:
compile:
[echo] Compiling: util
[cc] Starting dependency analysis for 55 files.
[cc] 55 files are up to date.
[cc] 0 files to be recompiled from dependency analysis.
[cc] 0 total files to be compiled.
link.util:
link:
[echo] Linking shared library: libutil
[cc] 0 total files to be compiled.
[cc] Starting link
[cc] /usr/bin/ld: /home/john/softwarename/thirdparty/crypto/5.6.1_64/libcryptopp.a(cryptlib.o): relocation R_X86_64_32 against `CryptoPP::DEFAULT_CHANNEL' can not be used when making a shared object; recompile with -fPIC
[cc] /home/john/softwarename/thirdparty/crypto/5.6.1_64/libcryptopp.a: could not read symbols: Bad value
[cc] collect2: ld returned 1 exit status
BUILD FAILED
/home/john/softwarename/build/build.xml:167: Following error occured while executing this line
/home/john/softwarename/build/link.xml:27: gcc failed with return code 1
操作系统是Fedora 11
I am trying to reverse engineer a previous employee's build process for some custom software he wrote for us. I've seen to get everything to compile okay, but I get an error in the linking process that points to a problem with crypto++. Any clues?
compile.util:
compile:
[echo] Compiling: util
[cc] Starting dependency analysis for 55 files.
[cc] 55 files are up to date.
[cc] 0 files to be recompiled from dependency analysis.
[cc] 0 total files to be compiled.
link.util:
link:
[echo] Linking shared library: libutil
[cc] 0 total files to be compiled.
[cc] Starting link
[cc] /usr/bin/ld: /home/john/softwarename/thirdparty/crypto/5.6.1_64/libcryptopp.a(cryptlib.o): relocation R_X86_64_32 against `CryptoPP::DEFAULT_CHANNEL' can not be used when making a shared object; recompile with -fPIC
[cc] /home/john/softwarename/thirdparty/crypto/5.6.1_64/libcryptopp.a: could not read symbols: Bad value
[cc] collect2: ld returned 1 exit status
BUILD FAILED
/home/john/softwarename/build/build.xml:167: Following error occured while executing this line
/home/john/softwarename/build/link.xml:27: gcc failed with return code 1
Os is Fedora 11
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
链接到共享库的每个目标文件都必须是位置无关的,这意味着加载程序可以将其移动到内存中的任何位置,并且它仍然可以工作。您的加密库不是以这种方式编译的,因此建议您在编译标志中添加
-fPIC
来重新编译它。或者,您可以将 libutil 设为静态库而不是共享库。如果没有有关构建文件的更多详细信息,我无法提供有关如何执行此操作或选择哪个文件的更多详细信息。Every object file you link into a shared library must be position independent, meaning the loader can move it wherever it wants in memory and it will still work. Your crypto library was not compiled that way, hence the admonition to recompile it with
-fPIC
added to your compile flags. Alternately, you can make libutil a static library instead of a shared one. Without more details on your build files, I can't provide more details on how to do that or which one to choose.