This probably stems from a difference in the system linker scripts, but compiling packages against libgtest.a or libgmock.a can fail if they are built without -fPIC.
Should address build failures in consumers like this:
ld: gmock/libgmock.a(gtest-all.cc.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
ld: gmock/libgmock.a(gmock-all.cc.o): relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC
ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
As a 'weird' bug with a 'weird' solution that could have unintended side effects, I triggered a pretty wide build to test this change:
Linux
Linux-aarch64
macOS
Windows
The motivation for this change is to unblock building rviz_default_plugins for RHEL 7.
This probably stems from a difference in the system linker scripts, but compiling packages against libgtest.a or libgmock.a can fail if they are built without -fPIC.
Should address build failures in consumers like this:
As a 'weird' bug with a 'weird' solution that could have unintended side effects, I triggered a pretty wide build to test this change:
The motivation for this change is to unblock building rviz_default_plugins for RHEL 7.
Docs on this property: https://cmake.org/cmake/help/latest/prop_tgt/POSITION_INDEPENDENT_CODE.html