Add 'POSITION_INDEPENDENT_CODE ON' (also known as '-fPIE'). (#99)
First thx for these very useful lib! I encountered some issues when linking with `libcpptrace`. Typically, here is the error I got: ``` /usr/bin/ld: lib/cpptrace/lib/libcpptrace.a(cpptrace.cpp.o): relocation R_X86_64_32S against symbol `_ZTVNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEEE@@GLIBCXX_3.4.21' can not be used when making a PIE object; recompile with -fPIE ``` I just added the `POSITION_INDEPENDENT_CODE ON` flag on the targets, and now it works like a charm :-).
This commit is contained in:
parent
3054b3bebd
commit
d8e23c1e93
@ -267,6 +267,7 @@ set_target_properties(
|
|||||||
SOVERSION "${PROJECT_VERSION_MAJOR}"
|
SOVERSION "${PROJECT_VERSION_MAJOR}"
|
||||||
EXPORT_NAME "cpptrace"
|
EXPORT_NAME "cpptrace"
|
||||||
OUTPUT_NAME "cpptrace"
|
OUTPUT_NAME "cpptrace"
|
||||||
|
POSITION_INDEPENDENT_CODE ${CPPTRACE_POSITION_INDEPENDENT_CODE}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Header files generated by CMake
|
# Header files generated by CMake
|
||||||
|
|||||||
@ -898,6 +898,7 @@ Other useful configurations:
|
|||||||
the fault of your project. Defaults to On.
|
the fault of your project. Defaults to On.
|
||||||
- `CPPTRACE_INSTALL_CMAKEDIR`: Override for the installation path for the cmake configs.
|
- `CPPTRACE_INSTALL_CMAKEDIR`: Override for the installation path for the cmake configs.
|
||||||
- `CPPTRACE_USE_EXTERNAL_LIBDWARF=On/Off`: Get libdwarf from `find_package` rather than `FetchContent`.
|
- `CPPTRACE_USE_EXTERNAL_LIBDWARF=On/Off`: Get libdwarf from `find_package` rather than `FetchContent`.
|
||||||
|
- `CPPTRACE_POSITION_INDEPENDENT_CODE=On/Off`: Compile the library as a position independent code (PIE). Defaults to On.
|
||||||
|
|
||||||
Testing:
|
Testing:
|
||||||
- `CPPTRACE_BUILD_TESTING` Build small demo and test program
|
- `CPPTRACE_BUILD_TESTING` Build small demo and test program
|
||||||
|
|||||||
@ -164,6 +164,7 @@ option(CPPTRACE_CONAN "" OFF)
|
|||||||
option(CPPTRACE_VCPKG "" OFF)
|
option(CPPTRACE_VCPKG "" OFF)
|
||||||
option(CPPTRACE_SANITIZER_BUILD "" OFF)
|
option(CPPTRACE_SANITIZER_BUILD "" OFF)
|
||||||
option(CPPTRACE_WERROR_BUILD "" OFF)
|
option(CPPTRACE_WERROR_BUILD "" OFF)
|
||||||
|
option(CPPTRACE_POSITION_INDEPENDENT_CODE "" ON)
|
||||||
|
|
||||||
mark_as_advanced(
|
mark_as_advanced(
|
||||||
CPPTRACE_BACKTRACE_PATH
|
CPPTRACE_BACKTRACE_PATH
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user