CMU-Perceptual-Computing-Lab / openpose

OpenPose: Real-time multi-person keypoint detection library for body, face, hands, and foot estimation
https://cmu-perceptual-computing-lab.github.io/openpose
Other
31.19k stars 7.86k forks source link

undefined reference to google::FlagRegisterer with no root user #702

Closed universewill closed 6 years ago

universewill commented 6 years ago
  1. my enviroment: ubuntu16.04 , cuda9.0, cudnn7.0.5, python3.6

  2. OpenPose version: Latest GitHub code

  3. General configuration: Installation mode: cmake .. with python option turned on gcc version: 5.4.0

  4. cmake version: 3.11.1

I encounter 'undefined reference to google::FlagRegisterer' error when run 'make -jnproc' command. However, i already installed libgflags-dev libgoogle-glog-dev using apt-get. Besides, how to turn the BUILD_python and USE_OPENCV option on while buiding caffe? I use a ubuntu server with no gui.

I add user root to run make -jnproc, and the error is gone. Can anyone tell me why?

Here is the print log:

[ 12%] Performing build step for 'openpose_caffe'
-- Boost version: 1.58.0
-- Found the following Boost libraries:
--   system
--   thread
--   filesystem
--   chrono
--   date_time
--   atomic
-- Found gflags  (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libgflags.so)
-- Found glog    (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libglog.so)
CMake Warning at /home/universe/miniconda3/share/cmake-3.11/Modules/FindProtobuf.cmake:455 (message):
  Protobuf compiler version 3.5.1 doesn't match library version 3.5.0
Call Stack (most recent call first):
  cmake/ProtoBuf.cmake:4 (find_package)
  cmake/Dependencies.cmake:43 (include)
  CMakeLists.txt:46 (include)

-- Found PROTOBUF Compiler: /home/universe/miniconda3/bin/protoc
-- HDF5: Using hdf5 compiler wrapper to determine C configuration
-- HDF5: Using hdf5 compiler wrapper to determine CXX configuration
-- CUDA detected: 9.0
-- Found cuDNN: ver. 7.0.5 found (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libcudnn.so)
-- Added CUDA NVCC flags for: sm_61
-- Found Atlas (include: /usr/include library: /usr/lib/libatlas.so lapack: /usr/lib/liblapack.so
-- Python interface is disabled or not all required dependencies found. Building without it...
--
-- ******************* Caffe Configuration Summary *******************
-- General:
--   Version           :   1.0.0
--   Git               :   1.0-112-g9453eb0
--   System            :   Linux
--   C++ compiler      :   /usr/bin/c++
--   Release CXX flags :   -O3 -DNDEBUG -fPIC -Wall -Wno-sign-compare -Wno-uninitialized
--   Debug CXX flags   :   -g -fPIC -Wall -Wno-sign-compare -Wno-uninitialized
--   Build type        :   Release
--
--   BUILD_SHARED_LIBS :   ON
--   BUILD_python      :   OFF
--   BUILD_matlab      :   OFF
--   BUILD_docs        :   OFF
--   CPU_ONLY          :   OFF
--   USE_OPENCV        :   OFF
--   USE_LEVELDB       :   OFF
--   USE_LMDB          :   OFF
--   USE_NCCL          :   OFF
--   ALLOW_LMDB_NOLOCK :   OFF
--
-- Dependencies:
--   BLAS              :   Yes (Atlas)
--   Boost             :   Yes (ver. 1.58)
--   glog              :   Yes
--   gflags            :   Yes
--   protobuf          :   Yes (ver. 3.5.0)
--   CUDA              :   Yes (ver. 9.0)
--
-- NVIDIA CUDA:
--   Target GPU(s)     :   Auto
--   GPU arch(s)       :   sm_61
--   cuDNN             :   Yes (ver. 7.0.5)
--
-- Install:
--   Install path      :   /home/universe/jupyter/gxl/project/action/openPose/openpose/build/caffe
--
-- Configuring done
CMake Warning at src/caffe/CMakeLists.txt:23 (add_library):
  Cannot generate a safe runtime search path for target caffe because files
  in some directories may conflict with libraries in implicit directories:

    runtime library [libglog.so.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
      /home/universe/miniconda3/lib

  Some of these libraries may not be found correctly.

CMake Warning at src/caffe/test/CMakeLists.txt:29 (add_executable):
  Cannot generate a safe runtime search path for target test.testbin because
  files in some directories may conflict with libraries in implicit
  directories:

    runtime library [libglog.so.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
      /home/universe/miniconda3/lib

  Some of these libraries may not be found correctly.

CMake Warning at tools/CMakeLists.txt:14 (add_executable):
  Cannot generate a safe runtime search path for target
  upgrade_solver_proto_text because files in some directories may conflict
  with libraries in implicit directories:

    runtime library [libglog.so.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
      /home/universe/miniconda3/lib

  Some of these libraries may not be found correctly.

CMake Warning at tools/CMakeLists.txt:14 (add_executable):
  Cannot generate a safe runtime search path for target compute_image_mean
  because files in some directories may conflict with libraries in implicit
  directories:

    runtime library [libglog.so.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
      /home/universe/miniconda3/lib

  Some of these libraries may not be found correctly.

CMake Warning at tools/CMakeLists.txt:14 (add_executable):
  Cannot generate a safe runtime search path for target caffe.bin because
  files in some directories may conflict with libraries in implicit
  directories:

    runtime library [libglog.so.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
      /home/universe/miniconda3/lib

  Some of these libraries may not be found correctly.

CMake Warning at tools/CMakeLists.txt:14 (add_executable):
  Cannot generate a safe runtime search path for target
  upgrade_net_proto_binary because files in some directories may conflict
  with libraries in implicit directories:

    runtime library [libglog.so.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
      /home/universe/miniconda3/lib

  Some of these libraries may not be found correctly.

CMake Warning at tools/CMakeLists.txt:14 (add_executable):
  Cannot generate a safe runtime search path for target convert_imageset
  because files in some directories may conflict with libraries in implicit
  directories:

    runtime library [libglog.so.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
      /home/universe/miniconda3/lib

  Some of these libraries may not be found correctly.

CMake Warning at tools/CMakeLists.txt:14 (add_executable):
  Cannot generate a safe runtime search path for target extract_features
  because files in some directories may conflict with libraries in implicit
  directories:

    runtime library [libglog.so.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
      /home/universe/miniconda3/lib

  Some of these libraries may not be found correctly.

CMake Warning at tools/CMakeLists.txt:14 (add_executable):
  Cannot generate a safe runtime search path for target
  upgrade_net_proto_text because files in some directories may conflict with
  libraries in implicit directories:

    runtime library [libglog.so.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
      /home/universe/miniconda3/lib

  Some of these libraries may not be found correctly.

CMake Warning at examples/CMakeLists.txt:11 (add_executable):
  Cannot generate a safe runtime search path for target classification
  because files in some directories may conflict with libraries in implicit
  directories:

    runtime library [libglog.so.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
      /home/universe/miniconda3/lib

  Some of these libraries may not be found correctly.

CMake Warning at examples/CMakeLists.txt:11 (add_executable):
  Cannot generate a safe runtime search path for target convert_mnist_data
  because files in some directories may conflict with libraries in implicit
  directories:

    runtime library [libglog.so.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
      /home/universe/miniconda3/lib

  Some of these libraries may not be found correctly.

CMake Warning at examples/CMakeLists.txt:11 (add_executable):
  Cannot generate a safe runtime search path for target convert_cifar_data
  because files in some directories may conflict with libraries in implicit
  directories:

    runtime library [libglog.so.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
      /home/universe/miniconda3/lib

  Some of these libraries may not be found correctly.

CMake Warning at examples/CMakeLists.txt:11 (add_executable):
  Cannot generate a safe runtime search path for target
  convert_mnist_siamese_data because files in some directories may conflict
  with libraries in implicit directories:

    runtime library [libglog.so.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
      /home/universe/miniconda3/lib

  Some of these libraries may not be found correctly.

-- Generating done
-- Build files have been written to: /home/universe/jupyter/gxl/project/action/openPose/openpose/build/caffe/src/openpose_caffe-build
[  1%] Built target caffeproto
Scanning dependencies of target caffe
[  1%] Linking CXX shared library ../../lib/libcaffe.so
[ 86%] Built target caffe
[ 86%] Linking CXX executable convert_imageset
[ 86%] Linking CXX executable upgrade_net_proto_binary
[ 87%] Linking CXX executable siamese/convert_mnist_siamese_data
[ 89%] Linking CXX executable compute_image_mean
[ 89%] Linking CXX executable mnist/convert_mnist_data
[ 90%] Linking CXX executable cifar10/convert_cifar_data
[ 90%] Linking CXX executable caffe
[ 91%] Linking CXX executable upgrade_solver_proto_text
[ 93%] Linking CXX executable upgrade_net_proto_text
[ 94%] Linking CXX executable extract_features
[ 94%] Linking CXX executable cpp_classification/classification
[ 95%] Built target classification
CMakeFiles/convert_imageset.dir/convert_imageset.cpp.o: In function `_GLOBAL__sub_I_convert_imageset.cpp':
convert_imageset.cpp:(.text.startup+0x18d): undefined reference to `google::FlagRegisterer::FlagRegisterer<bool>(char const*, char const*, char const*, bool*, bool*)'
convert_imageset.cpp:(.text.startup+0x1bc): undefined reference to `google::FlagRegisterer::FlagRegisterer<bool>(char const*, CMakeFiles/compute_image_mean.dir/compute_image_mean.cpp.o:char  Inconst* function , `char_GLOBAL__sub_I_compute_image_mean.cpp const'*,:
boolcompute_image_mean.cpp*,: bool(*.)'text.startup
convert_imageset.cpp+0x1de:):(. text.startupundefined+ 0x241reference ):to  `undefinedgoogle: reference: FlagRegistererto: :`FlagRegisterergoogle::<stdFlagRegisterer::::FlagRegisterer__cxx11:<:stdbasic_string::<__cxx11char::,basic_string <charstd,:: stdchar_traits:<char:>char_traits,<char >std, std::::allocatorallocator<char<>char> >  >>( char> (charconst* ,const char const*, char* , const*char, const std*:,:__cxx11 :char :basic_stringconst<*,char,  stdstd:::char_traits:<__cxx11char:>:basic_string, <stdchar,:: allocatorstd<:char:>char_traits< >char*>,,  stdstd:::__cxx11:allocator:<char:>basic_string <char>,*,  std::stdchar_traits::<char__cxx11>::, basic_stringstd<char:,: allocator<stdchar:> :>char_traits<*)char'>,
convert_imageset.cpp :std(.:text.startup:+0x2baallocator)<char: >undefined > reference* )to'
`google::FlagRegisterer::FlagRegisterer<int>(char const*, char const*, char const*, int*, int*)'
convert_imageset.cpp:(.text.startup+0x2e9): undefined reference to `google::collect2: error: ld returned 1 exit status
FlagRegisterer::FlagRegisterer<int>(char const*, char const*, char const*, int*, int*)'
convert_imageset.cpp:(.text.startup+0x318): undefined reference to `google::FlagRegisterer::FlagRegisterer<bool>(char const*, char const*, char const*, bool*, bool*)'
convert_imageset.cpp:(.text.startup+0x347): undefined reference to `google::FlagRegisterer::FlagRegisterer<bool>(char const*, char const*, char const*, bool*, bool*)'
convert_imageset.cpp:(.text.startup+0x3c8): undefined reference to `google::FlagRegisterer::FlagRegisterer<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(char const*, char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
collect2: error: ld returned 1 exit status
tools/CMakeFiles/convert_imageset.dir/build.make:111: recipe for target 'tools/convert_imageset' failed
tools/CMakeFiles/compute_image_mean.dir/build.make:111: recipe for target 'tools/compute_image_mean' failed
make[5]: *** [tools/convert_imageset] Error 1
make[5]: *** [tools/compute_image_mean] Error 1
CMakeFiles/Makefile2:577: recipe for target 'tools/CMakeFiles/convert_imageset.dir/all' failed
make[4]: *** [tools/CMakeFiles/convert_imageset.dir/all] Error 2
make[4]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:463: recipe for target 'tools/CMakeFiles/compute_image_mean.dir/all' failed
make[4]: *** [tools/CMakeFiles/compute_image_mean.dir/all] Error 2
[ 95%] Built target convert_mnist_siamese_data
[ 97%] Built target convert_mnist_data
CMakeFiles/caffe.bin.dir/caffe.cpp.o: In function `_GLOBAL__sub_I_caffe.cpp':
caffe.cpp:(.text.startup+0x4d2): undefined reference to `google::FlagRegisterer::FlagRegisterer<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(char const*, char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
caffe.cpp:(.text.startup+0x597): undefined reference to `google::FlagRegisterer::FlagRegisterer<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(char const*, char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
caffe.cpp:(.text.startup+0x655): undefined reference to `google::FlagRegisterer::FlagRegisterer<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(char const*, char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
caffe.cpp:(.text.startup+0x713): undefined reference to `google::FlagRegisterer::FlagRegisterer<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(char const*, char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
caffe.cpp:(.text.startup+0x785): undefined reference to `google::FlagRegisterer::FlagRegisterer<int>(char const*, char const*, char const*, int*, int*)'
caffe.cpp:(.text.startup+0x800): undefined reference to `google::FlagRegisterer::FlagRegisterer<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(char const*, char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
caffe.cpp:(.text.startup+0x8be): undefined reference to `google::FlagRegisterer::FlagRegisterer<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(char const*, char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
caffe.cpp:(.text.startup+0x97c): undefined reference to `google::FlagRegisterer::FlagRegisterer<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(char const*, char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
caffe.cpp:(.text.startup+0x9ee): undefined reference to `google::FlagRegisterer::FlagRegisterer<int>(char const*, char const*, char const*, int*, int*)'
caffe.cpp:(.text.startup+0xa69): undefined reference to `google::FlagRegisterer::FlagRegisterer<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(char const*, char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
caffe.cpp:(.text.startup+0xb27): undefined reference to `google::FlagRegisterer::FlagRegisterer<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(char const*, char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
collect2: error: ld returned 1 exit status
tools/CMakeFiles/caffe.bin.dir/build.make:111: recipe for target 'tools/caffe' failed
make[5]: *** [tools/caffe] Error 1
CMakeFiles/Makefile2:501: recipe for target 'tools/CMakeFiles/caffe.bin.dir/all' failed
make[4]: *** [tools/CMakeFiles/caffe.bin.dir/all] Error 2
[ 97%] Built target upgrade_net_proto_text
[ 98%] Built target upgrade_net_proto_binary
[ 98%] Built target convert_cifar_data
[ 98%] Built target upgrade_solver_proto_text
[ 98%] Built target extract_features
Makefile:129: recipe for target 'all' failed
make[3]: *** [all] Error 2
CMakeFiles/openpose_caffe.dir/build.make:110: recipe for target 'caffe/src/openpose_caffe-stamp/openpose_caffe-build' failed
make[2]: *** [caffe/src/openpose_caffe-stamp/openpose_caffe-build] Error 2
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/openpose_caffe.dir/all' failed
make[1]: *** [CMakeFiles/openpose_caffe.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
philipNoonan commented 6 years ago

I'm getting similar issues with unresolved external symbols for google::Flagregisterer on my Win10 - latest github code - MSVC 2017 -T v140 cuda 9.2.

I get ...

error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl google::FlagRegisterer::FlagRegisterer(char const *,char const *,char const *,char const *,void *,void *)" (__imp_??0FlagRegisterer@google@@QEAA@PEBD000PEAX1@Z) referenced in function "void __cdecl fLB::dynamic initializer for o_3d''(void)" (??__Eo_3d@fLB@@YAXXZ)

... on the examples when I try and link against the versions of gflags and glog that I've installed via VCPKG rather than the bundled versions in the zip files. I'm trying to build a vcpkg port and am trying to see if I can link the building of openpose against other vcpkg-able libraries.

Building openpose with the bundled libs works fine, its just when I'm trying to use my other versions that I get this error. Perhaps the original poster is accidentally linking against other versions in their /lib directory?

soulslicer commented 6 years ago

That is because your Conda package is messing with your linker search paths. Conda likely has a newer version of GLOG that may not be compatible with Caffe. Try to remove Conda from your search path

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

JHL1998 commented 3 years ago

I hava a same condition with you ,dou you solve it?