1

When I try to build Artery on Ubuntu 16.04. the following happens after invoking $ cmake --build /home/hardt/Veins/artery-master/build

[ 23%] Linking CXX shared library libartery.so
/usr/bin/ld: /usr/local/lib/libvanetza_btp.a(data_request.cpp.o): relocation R_X86_64_32 against `.bss' can not be used when making a shared  
object; recompile with -fPIC
/usr/local/lib/libvanetza_btp.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
src/artery/CMakeFiles/artery.dir/build.make:954: recipe for target'src/artery/libartery.so' failed
make[2]: *** [src/artery/libartery.so] Error 1
CMakeFiles/Makefile2:229: recipe for target 'src/artery/CMakeFiles/artery.dir/all' failed
make[1]: *** [src/artery/CMakeFiles/artery.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

As I am not all that familiar with building source on Unix systems I am not quite sure how to deal with this error. I am using cmake version 3.9.3, boost 1.65.1 and crypto++ 5.6.4 the geographiclib built without error as well.

M. Hardt
  • 67
  • 7
  • Are you building on a virtual machine? 64 or 32 bit? – Christoph Sommer Oct 06 '17 at 07:27
  • No Virtual Machine, 64 bit OS (16.04. LTS) – M. Hardt Oct 06 '17 at 10:28
  • 1
    It seems that you have built Vanetza as a static library, but it should be a shared lib. Can you look in the cmake variable `BUILD_SHARED_LIBS`in the Vanetza build directory? `BUILD_SHARED_LIBS` should be `ON`. You can see this variable by moving into your `extern/vanetza/build` directory and typing `ccmake .`. – Ventu Oct 07 '17 at 06:40
  • Thank you for this tip. BUILD_SHARED_LIBS is ON. however i had to install the cmake-curses-gui first via apt, which only got me version 3.5.1. will this interfere with the more up to date version of cmake already installed? I will probably not be able to test out any further solutions until after the next week. Just so you know in case I stop answering. – M. Hardt Oct 07 '17 at 11:34
  • whoops. edit fail... – M. Hardt Oct 07 '17 at 11:39
  • @Ventu:Back from the shipyard. While `BUILD_SHARED_LIBS` is `ON` Vanetza is still built as a static library. Any Ideas on how to force cmake to build it as a shared lib? – M. Hardt Oct 18 '17 at 12:00
  • @M.Hardt can you take a look at the VANETZA_DIR variable in your cmake configuration of Artery? You can check this variable if you `cd` in your Artery build directory and then type `cmake .`. Then press `t` to to toggle the advanced mode and use the arrow keys to navigate to the VANETA_DIR variable. Please tell me, what the variable contains. – Ventu Oct 19 '17 at 08:26
  • @Ventu: `VANETZA_DIR` contains `/usr/local/lib/cmake/Vanetza` – M. Hardt Oct 19 '17 at 10:24
  • @M.Hardt ah yes, this seems to be the problem. This variable should contain the path `path/to/your/artery/extern/vanetza/build`. Please, can you change it and recompile artery? – Ventu Oct 19 '17 at 11:26
  • @Ventu: Changing the variable solved the problem. Thanks very much! – M. Hardt Oct 19 '17 at 16:30

1 Answers1

1

As one can read in the comments, the problem is solved.
The path to the vanetza directory VANETZA_DIR in the cmake configuration was wrong. Correcting this via ccmake solved the problem.

M. Hardt
  • 67
  • 7