Skip to content

a cmake compiler flag problem #31

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

Closed
douxing opened this issue Jun 25, 2015 · 2 comments
Closed

a cmake compiler flag problem #31

douxing opened this issue Jun 25, 2015 · 2 comments

Comments

@douxing
Copy link

douxing commented Jun 25, 2015

i am making a .so file out of libsioclient.a, and /usr/bin/ld says relocation error, require me to recompile with -fPIC, so i use this command to cmake again:

cmake -DBOOST_ROOT=path_to_boost -DBOOST_VER=my_boost_version -DCMAKE_CXX_FLAGS=-fPIC ./

and in ./CMakeFiles/sioclient_tls.dir/flags.make:5 and ./CMakeFiles/sioclient_tls.dir/flags.make:5: -fPIC was added to CXX_FLAGS and my dynamic library was generated

however, this problem still exists in the libboost_*.a files, and i have to use my own boost libraries.
any idea to fix this?

ps. my platform is ubuntu 1404LTS, and using repo at this commit (Jun.15th)

@melode11
Copy link
Contributor

Likely you're linking your .so on x64 platform which PIC is a must. To make a PIC shared lib, you need make every input whatever static or dynamic to be PIC. So seems you need to remake your boost lib with -fPIC.

@douxing
Copy link
Author

douxing commented Jun 29, 2015

@melode11 thanks for the reply.
you are right, i have rebuild the boost with cxxflags='-fPIC' and g++ does not complain anymore when linking.

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