2012-12-10 46 views
0

我想問你一個關於perlembed的問題。關於下面的問題的最後一個條目: PerlEmbed - C# - Mono - LinuxC# - perlembed - linux中編譯錯誤

我問jonathanpeppers,但他說他不在perl和c上工作了。所以我要問這個小組。

我試圖在Linux機器上運行perlembed.c,但我得到了以下錯誤。你能幫我解答嗎?

[[email protected] 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 

回答

2

請按照錯誤消息中的建議進行操作。使用編譯器選項-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

+0

謝謝,我不明白我應該在哪裏使用fPIC。 –

+0

請參閱我的編輯。 @melihzenciroglu – alk

+0

非常感謝你,我明白了。 –