1

I have got an issue while I was building my project under GNU/Linux Ubuntu 16.04 using ninja-build. When linking with OpenDDS 3.9 and more precisely with libACE.a I got this error :

/usr/bin/ld: ../../thirdparty/OpenDDS/ACE_wrappers/lib/libACE.a(Base_Thread_Adapter.o): relocation R_X86_64_32 against `_ZTV23ACE_Base_Thread_Adapter' can not be used when making a shared object; recompile with -fPIC
../../thirdparty/OpenDDS/ACE_wrappers/lib/libACE.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

I have builded OpenDDS (and ACE) as a static libraries. I have used the following command lines to configure and build OpenDDS :

./configure --no-debug --static --verbose
sudo bash ./setenv.sh
make

It tells to recompile with the -fPIC argument, I have not succeeded to find a way to re-build OpenDDS and ACE using this option, how I could do it ?

Thanks !

MSch8791
  • 41
  • 6
  • Do you have --enable-shared in configure ? If yes, build a shared OpenDDS library and use it instead. – pSoLT Jan 03 '17 at 12:17
  • 1
    I would like to compile OpenDDS statically – MSch8791 Jan 03 '17 at 12:40
  • If you get this error I assume you try to build a shared object. The static library that is not position-independent simply cannot be used to generate a shared object. – pSoLT Jan 03 '17 at 12:50
  • Yes I am building a shared library that use OpenDDS and I would like to link with the static OpenDDS libraries. I am not sure to understand why it is not possible. – MSch8791 Jan 03 '17 at 13:58
  • @MSch8791 a shared library needs to be able to be relocated to an arbitrary base-address (otherwise one process could load two shared-libraries that have overlapping code-addresses ), you link in code into your shared object that is not compiled in a manner to allow easy relocation. – PeterT Jan 03 '17 at 14:10
  • I have understood, thanks for your explanation. I was doing it on Windows without any problem, maybe some tricks of Visual Studio... – MSch8791 Jan 03 '17 at 14:27
  • @MSch8791 Were you able to compile that static *.a library? The only advise I could find is to start from a clean repo, so I am trying that right now. – Matthaeus Gaius Caesar Aug 18 '23 at 15:02

0 Answers0