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

Make error: failed to link with libgflags.a #38

Closed
rantonels opened this issue Jul 4, 2015 · 3 comments
Closed

Make error: failed to link with libgflags.a #38

rantonels opened this issue Jul 4, 2015 · 3 comments

Comments

@rantonels
Copy link

/bin/bash ./libtool  --tag=CXX   --mode=link g++    -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare  -DNO_FRAME_POINTER  -DNDEBUG -g -O2    -o libglog.la -rpath /usr/local/lib  src/libglog_la-logging.lo src/libglog_la-raw_logging.lo src/libglog_la-vlog_is_on.lo src/libglog_la-utilities.lo src/libglog_la-demangle.lo src/libglog_la-symbolize.lo src/libglog_la-signalhandler.lo   -lgflags  -lpthread 
libtool: link: g++  -fPIC -DPIC -shared -nostdlib /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.9/crtbeginS.o  src/.libs/libglog_la-logging.o src/.libs/libglog_la-raw_logging.o src/.libs/libglog_la-vlog_is_on.o src/.libs/libglog_la-utilities.o src/.libs/libglog_la-demangle.o src/.libs/libglog_la-symbolize.o src/.libs/libglog_la-signalhandler.o   -lgflags -lpthread -L/usr/lib/gcc/x86_64-linux-gnu/4.9 -L/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.9/../../.. -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc/x86_64-linux-gnu/4.9/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/crtn.o  -O2   -Wl,-soname -Wl,libglog.so.0 -o .libs/libglog.so.0.0.0
/usr/bin/ld: //usr/local/lib/libgflags.a(gflags.cc.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
//usr/local/lib/libgflags.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Makefile:1041: recipe for target 'libglog.la' failed
make: *** [libglog.la] Error 1

note that it searches for the library at

//usr/local/lib/libgflags.a
@VictorLamoine
Copy link

VictorLamoine commented Oct 27, 2015

Similar to #45.

gflags is not compiled as a shared library by default; make sure it is compiled as a shared library:

cd gflags/build
cmake .. -DBUILD_SHARED_LIBS=ON
make -j2
sudo make -j2 install

After that glog compiles fine against gflags.

@ukai ukai changed the title Make error Make error: failed to link with libgflags.a Dec 17, 2015
@ukai ukai mentioned this issue Dec 17, 2015
@pearlmary
Copy link

/usr/bin/ld: warning: libgflags.so.2, needed by /usr/local/lib/libglog.so, not found (try using -rpath or -rpath-link)
/usr/local/lib/libglog.so: undefined reference to `google::FlagRegisterer::FlagRegisterer(char const*, char const*, char const*, char const*, void*, void*)'
collect2: error: ld returned 1 exit status
Makefile:625: recipe for target '.build_debug/tools/extract_features.bin' failed
make: *** [.build_debug/tools/extract_features.bin] Error 1

@pearlmary
Copy link

how to solve this
i have been installing caffe for months now

@sergiud sergiud closed this as completed Mar 30, 2021
@sergiud sergiud mentioned this issue May 6, 2021
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