【问题标题】:C# - perlembed - compile error in linuxC# - perlembed - linux中的编译错误
【发布时间】:2012-12-10 22:20:09
【问题描述】:

我想问你一个关于 perlembed 的问题。关于以下问题的最后一个条目: PerlEmbed - C# - Mono - Linux

我问过 jonathanpeppers,但他说他不再研究 perl 和 c。所以我向小组提问。

我尝试在 linux 机器上运行 perlembed.c,但出现以下错误。你能帮帮我吗?

[root@BSG01 melih]# gcc -shared -Wl,-soname,perlembed.so -o perlembed.so perlembed.c `perl -MExtUtils::Embed -e ccopts -e ldopts`
/usr/bin/ld: /tmp/ccRP7CYZ.o: relocation R_X86_64_32S against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/tmp/ccRP7CYZ.o: could not read symbols: Bad value
collect2: ld returned 1 exit status

【问题讨论】:

    标签: c# c linux perl


    【解决方案1】:

    按照错误消息中的建议进行操作。使用编译器选项-fPIC

    gcc -shared -Wl,-soname,perlembed.so -o perlembed.so -fPIC perlembed.c `perl -MExtUtils::Embed -e ccopts -e ldopts`
    

    编辑:

    here for the documentation of gcc's options

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多