On 05/07/16 21:56, Richter, Arne wrote:
Hi all,

I'm currently trying to build a test-pipeline using Python to describe
my test cases. Now I want to add GHDL tests into my pipeline by
compiling them with a C wrapper into a shared library.
So far so good. With the prebuilt OSX version everything works (except
the procedure's). But if I now try to fresh build version under linux,
the same makefile fails.

I repeatedly get the error:

/usr/bin/ld: e~tb_rand.o: relocation R_X86_64_32 against `.bss' can not
be used when making a shared object; recompile with -fPIC

e~tb_rand.o: error adding symbols: Bad value

Got anyone a clue for me? I'm currently not even sure if automatically
build libraries might cause the problem.

The problem is that to create a shared library on x86-64 linux files
must be compiled with -fPIC.

By default, this is not the case when using ghdl -a or ghdl -e.
You could add the -fPIC switch at that point (I haven't tested that), but then you will hit the next issue: the program is also linked with libgrt.a, which is not compiled with -fPIC too.

So you have to rebuild libgrt.a with the -fPIC option. Maybe ghdl should be enhanced to also have a libgrt.so.

It might be simpler to slightly redesign your test-pipeline architecture not to rely on that mechanism.

Regards,
Tristan.


_______________________________________________
Ghdl-discuss mailing list
Ghdl-discuss@gna.org
https://mail.gna.org/listinfo/ghdl-discuss

Reply via email to