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

issue Linking CXX shared library libglog.so #906

Closed
fpalaric opened this issue Mar 7, 2023 · 1 comment
Closed

issue Linking CXX shared library libglog.so #906

fpalaric opened this issue Mar 7, 2023 · 1 comment

Comments

@fpalaric
Copy link

fpalaric commented Mar 7, 2023

Hello,
i have build gflags' files with : cmake -DINTTYPES_FORMAT:STRING=C99 -DNAMESPACE:STRING=google -DCMAKE_INSTALL_PREFIX=../../Install/gflags -DBUILD_SHARED_LIBS=ON ../../gflags

Then, i have added : set (CMAKE_POSITION_INDEPENDENT_CODE ON) to the CMakefile.txt
which, i believe, add the -fPic compile option.

i have the following error :

[ 24%] Built target glog_internal
[ 27%] Linking CXX shared library libglog.so
/usr/bin/ld: /home/franck/Dev/LibLivre/Build/..Install/gflags/lib/libgflags.a(gflags_completions.cc.o): warning: relocation against `_ZN3fLS25FLAGS_tab_completion_wordB5cxx11E' in read-only section `.text.startup'
/usr/bin/ld: /home/franck/Dev/LibLivre/Build/..Install/gflags/lib/libgflags.a(gflags.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
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/glog.dir/build.make:96: libglog.so.0.7.0] Error 1
make[1]: *** [CMakeFiles/Makefile2:889: CMakeFiles/glog.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

I looking for solutions but i run out of ideas... i didn't know if i manage well to "recompile with -fPic", i do not know what is fPic, i have googled it and there is no result...
Any idea ?

@sergiud
Copy link
Collaborator

sergiud commented Mar 7, 2023

The linker error message indicates that, in fact, you did not compile gflags using -fPIC which can be easily verified by inspecting the command-line used by the compiler.

Please ask the gflags folks how can this be best achieved or use the search function. This issue popped up several times in the past; see #680 #661 #174 #819.

@sergiud sergiud closed this as not planned Won't fix, can't repro, duplicate, stale Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants