xeco23 / WasIstLos

An unofficial WhatsApp desktop application for Linux.
GNU General Public License v3.0
1.01k stars 105 forks source link

build fails with ld: error: can't create dynamic relocation R_X86_64_64 #339

Open mohrezaei opened 1 year ago

mohrezaei commented 1 year ago

Description When building from source, at the linking stage, the following error is produced:

ld: error: can't create dynamic relocation R_X86_64_64 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output

To Reproduce Steps to reproduce the behavior: Install all dev dependencies and build according to the README instructions.

Expected behavior Build should work.

Environment

Adding the following line to CMakeLists.txt fixes the issue:

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

(from https://stackoverflow.com/questions/38296756/what-is-the-idiomatic-way-in-cmake-to-add-the-fpic-compiler-option)