使用 google 命名空间编译导致未定义引用的 caffe

Compiling caffe causing undefined references with google namespace

我的代码有问题,由于 gflags 而导致错误。所以我决定手动使用 gflags 存储库和链接,这似乎是个坏主意。现在连caffe都编译不了

在执行以下命令时

make all -j $(($(nproc) + 1))

我收到以下错误消息。

.build_release/tools/convert_imageset.o: In function `_GLOBAL__sub_I_convert_imageset.cpp':
convert_imageset.cpp:(.text.startup+0x74): undefined reference to `google::FlagRegisterer::FlagRegisterer<bool>(char const*, char const*, char const*, bool*, bool*)'
convert_imageset.cpp:(.text.startup+0xa3): undefined reference to `google::FlagRegisterer::FlagRegisterer<bool>(char const*, char const*, char const*, bool*, bool*)'
convert_imageset.cpp:(.text.startup+0x117): 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> >*)'

我通过互联网在一些 git 线程和其他一些 threads 中寻找一些可能的解决方案。没有工作。任何形式的帮助或建议都将不胜感激。

问题已通过下载gflags包并手动安装解决。使用以下命令:

$ tar xzf gflags-$version-source.tar.gz
$ cd gflags-$version
$ mkdir build && cd build
$ ccmake ..

  - Press 'c' to configure the build system and 'e' to ignore warnings.
  - Set CMAKE_INSTALL_PREFIX and other CMake variables and options.
  - Continue pressing 'c' until the option 'g' is available.
  - Then press 'g' to generate the configuration files for GNU Make.

$ sudo make -j4
$ sudo make test    -j4 
$ sudo make install -j4