I need to run tests on some XLA passes and used bazel test
--config=opt --config=cuda //tensorflow/compiler/xla/service
to do the same (from here). The build failed with the following message, hinting at the missing googletest dependency.
/usr/lib/x86_64-linux-gnu/Scrt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
The dependences libgtest.a
and libgtest_main.a
were built from the googletest source and passed to the linker using --linkopt=/path/to/file
.
googletest/googletest/libgtest_main.a(gtest_main.cc.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
Adding -DCMAKE_CXX_FLAGS=-fPIC
didn't help. How can I change the cmake config to build with -fPIC ?
tensorflow (v1.8) is configured to be built by a locally built version gcc (5.4), since the system's version (5.5) fails to build tensorflow. Would that be the cause of the problem ?