Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static link seasocks #184

Open
toutriste opened this issue Oct 17, 2022 · 1 comment
Open

Static link seasocks #184

toutriste opened this issue Oct 17, 2022 · 1 comment

Comments

@toutriste
Copy link

toutriste commented Oct 17, 2022

Hi, how can I static link seasocks? I did not found anything on the documentation..

I have tried this:
LIBRARIES = -lm /home/user/seasocks/build/src/main/c/libseasocks.a

but getting these errors:

/usr/bin/ld: /home/user/seasocks/build/src/main/c/libseasocks.a(Server.cpp.o): relocation R_X86_64_PC32 against symbol `_ZTVN8seasocks6ServerE' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status

I suppose there is an extra step when I'm building seasocks?

@madebr
Copy link
Collaborator

madebr commented Oct 17, 2022

You need to build seasocks with -fPIC.
This can be done by configuring seasocks with CMAKE_POSITION_INDEPENDENT_CODE:

cmake -S /path/to/seasocks -B /tmp/seasocks_build -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=OFF
cmake --build /tmp/seasocks_build

Perhaps we should add the following to our cmake script:

set(CMAKE_POSITION_INDEPENDENT_CODE ON CACHE BOOL "Enable Position Independent Code")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants