Skip to content

Commit

Permalink
Fix position location code
Browse files Browse the repository at this point in the history
Linking with fmt could to get a error like
the following:
/usr/local/lib/libfmt.a(format.cc.o): relocation R_X86_64_PC32
against symbol `stderr@@GLIBC_2.2.5' can not be used when making
a shared object; recompile with -fPIC

To fix it, CMAKE_POSITION_INDEPENDENT_CODE must be configured.

Signed-off-by: Lucas Dias <[email protected]>
  • Loading branch information
lucassdiass committed May 26, 2024
1 parent 12ef9e0 commit a40e25b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ if (${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif ()

set(CMAKE_POSITION_INDEPENDENT_CODE on)
# Determine if fmt is built as a subproject (using add_subdirectory)
# or if it is the master project.
if (NOT DEFINED FMT_MASTER_PROJECT)
Expand Down

0 comments on commit a40e25b

Please sign in to comment.