melih zenciroglu
melih zenciroglu

Reputation: 43

C# - perlembed - compile error in linux

i want to ask you a question about perlembed. the last entry about the below issue: PerlEmbed - C# - Mono - Linux

I asked jonathanpeppers but he said he is not working on perl and c anymore. so i am asking to the group.

I tried to run perlembed.c on a linux machine but i got the following error. can you help me about it?

[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

Upvotes: 0

Views: 151

Answers (1)

alk
alk

Reputation: 70979

Just do as proposed in the error message. Use the compiler option -fPIC:

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

Edit:

See here for the documentation of gcc's options.

Upvotes: 2

Related Questions