代码之家  ›  专栏  ›  技术社区  ›  Jake Wilson

使用ANT时出现Crypto++链接器错误

  •  1
  • Jake Wilson  · 技术社区  · 14 年前

    我正试图对前一位员工为我们编写的一些定制软件的构建过程进行反向工程。我已经看到了让所有东西都可以编译的方法,但是我在链接过程中遇到了一个错误,它指出了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
    

    Os是Fedora 11

    1 回复  |  直到 14 年前
        1
  •  1
  •   Karl Bielefeldt    14 年前

    链接到共享库中的每个对象文件都必须是位置独立的,这意味着加载程序可以将其移动到内存中任何需要的位置,并且它仍然可以工作。您的加密库不是以这种方式编译的,因此建议使用 -fPIC

    推荐文章