fmtlib / fmt

A modern formatting library
https://fmt.dev
Other
19.84k stars 2.42k forks source link

Fix position location code - linking fmt occurs error suggesting recompile with -fPIC #3981

Closed lucassdiass closed 1 month ago

lucassdiass commented 1 month ago

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.

vitaut commented 1 month ago

Thanks for the PR but it doesn't need to be set as the default, you can set it when compiling {fmt} if necessary (e.g. when linking into a shared library).