2010-10-14 99 views
1

我正在尝试对他为我们编写的一些定制软件进行反向工程,以前的员工的构建过程。我已经看到所有的东西都可以编译好,但是我在链接过程中遇到了一个错误,指出加密++的问题。任何线索?使用ANT加密++链接器错误

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

回答

1

你链接到一个共享库中的每个对象文件必须是位置无关,这意味着无论装载机它希望在内存中,它仍然可以工作可以移动。你的加密库没有这种编译方式,因此编译标志时会加入-fPIC。或者,您可以使libutil成为静态库而不是共享库。没有关于构建文件的更多细节,我无法提供更多关于如何做或选择哪个的详细信息。

+0

经过进一步调查,我认为我的ANT构建文件期望在我的加密目录中有一个'libcryptopp.so'。但是在下载crypto ++源文件并运行make之后,它会创建一堆.o文件和一个libcryptopp.a文件。我如何获得我需要的libcryptopp.so文件?我是GCC和ANT的新手,很抱歉,如果这听起来像一个noob编译问题。 – 2010-10-14 19:41:57

+0

在crypto目录下的makefile中,在'CXXFLAGS'的末尾添加'-fPIC',然后执行'make clean'并重试。 – 2010-10-14 20:07:10