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

(gflags_reporting.cc.o): relocation R_X86_64_32 against.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC #174

Closed
shijiejie opened this issue Mar 30, 2017 · 2 comments

Comments

@shijiejie
Copy link

/usr/bin/ld: //usr/local/lib/libgflags.a(gflags.cc.o): relocation R_X86_64_32 against symbol __pthread_key_create@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: //usr/local/lib/libgflags.a(gflags_reporting.cc.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: //usr/local/lib/libgflags.a(gflags_completions.cc.o): relocation R_X86_64_32S against symbol `_ZNSs4_Rep20_S_empty_rep_storageE@@GLIBCXX_3.4' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
Makefile:1052: recipe for target 'libglog.la' failed
make: *** [libglog.la] Error 1

how to solve the problem,thanks

@shijiejie shijiejie changed the title make glog (gflags_reporting.cc.o): relocation R_X86_64_32 against.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC Mar 30, 2017
@kiukotsu
Copy link

kiukotsu commented Apr 5, 2017

i meet the same problem. After i tried on another machine, i find the reason why it generates. when i install gflags from the source code, i run ccmake .. , then there are some options for building. you should change the BUILD_SHARED_LIBS to ON,so it can be compiled to .so file。When you compile the glog, it will link to the libgflags, and the libgflags should be dynamic lib so that it can be linked.

@exoticDFT
Copy link

The answer from @kiukotsu does resolve the specific issue, but is there a reason position independent code isn't set for static builds, or why static building of the code is default? Is the only "appropriate" or "official" solution to build with the -DBUILD_SHARED_LIBS=True?

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

4 participants