架构Linux | caffe-lstm 构建的未定义引用
Archlinux | undefined referencies with caffe-lstm build
我安装了 caffe 没有任何问题,但是当我尝试构建 caffe-lstm 时,我遇到了下一个问题:
[ 86%] Linking CXX executable train_net
../lib/libcaffe.so: undefined reference to `H5LTget_dataset_ndims'
../lib/libcaffe.so: undefined reference to `H5LTread_dataset_int'
../lib/libcaffe.so: undefined reference to `H5LTfind_dataset'
../lib/libcaffe.so: undefined reference to `caffe::BlockingQueue<caffe::Batch<double>*>::pop(std::string const&)'
../lib/libcaffe.so: undefined reference to `google::base::CheckOpMessageBuilder::NewString()'
../lib/libcaffe.so: undefined reference to `H5LTmake_dataset_double'
../lib/libcaffe.so: undefined reference to `H5LTmake_dataset_int'
../lib/libcaffe.so: undefined reference to `H5LTread_dataset_float'
../lib/libcaffe.so: undefined reference to `google::protobuf::internal::NameOfEnum(google::protobuf::EnumDescriptor const*, int)'
../lib/libcaffe.so: undefined reference to `H5LTmake_dataset_float'
../lib/libcaffe.so: undefined reference to `H5LTget_dataset_info'
../lib/libcaffe.so: undefined reference to `H5LTread_dataset_string'
../lib/libcaffe.so: undefined reference to `caffe::BlockingQueue<caffe::Batch<float>*>::pop(std::string const&)'
../lib/libcaffe.so: undefined reference to `H5LTread_dataset_double'
../lib/libcaffe.so: undefined reference to `H5LTmake_dataset_string'
collect2: error: ld returned 1 exit status
make[2]: *** [tools/CMakeFiles/test_net.dir/build.make:127: tools/test_net] Error 1
make[1]: *** [CMakeFiles/Makefile2:510: tools/CMakeFiles/test_net.dir/all] Error 2
../lib/libcaffe.so: undefined reference to `H5LTget_dataset_ndims'
../lib/libcaffe.so: undefined reference to `H5LTread_dataset_int'
../lib/libcaffe.so: undefined reference to `H5LTfind_dataset'
../lib/libcaffe.so: undefined reference to `caffe::BlockingQueue<caffe::Batch<double>*>::pop(std::string const&)'
../lib/libcaffe.so: undefined reference to `google::base::CheckOpMessageBuilder::NewString()'
../lib/libcaffe.so: undefined reference to `H5LTmake_dataset_double'
../lib/libcaffe.so: undefined reference to `H5LTmake_dataset_int'
../lib/libcaffe.so: undefined reference to `H5LTread_dataset_float'
../lib/libcaffe.so: undefined reference to `google::protobuf::internal::NameOfEnum(google::protobuf::EnumDescriptor const*, int)'
../lib/libcaffe.so: undefined reference to `H5LTmake_dataset_float'
../lib/libcaffe.so: undefined reference to `H5LTget_dataset_info'
../lib/libcaffe.so: undefined reference to `H5LTread_dataset_string'
../lib/libcaffe.so: undefined reference to `caffe::BlockingQueue<caffe::Batch<float>*>::pop(std::string const&)'
../lib/libcaffe.so: undefined reference to `H5LTread_dataset_double'
../lib/libcaffe.so: undefined reference to `H5LTmake_dataset_string'
collect2: error: ld returned 1 exit status
make[2]: *** [tools/CMakeFiles/train_net.dir/build.make:127: tools/train_net] Error 1
make[1]: *** [CMakeFiles/Makefile2:548: tools/CMakeFiles/train_net.dir/all] Error 2
In file included from /usr/include/boost/type_traits/ice.hpp:15:0,
from /usr/include/boost/python/detail/def_helper.hpp:9,
from /usr/include/boost/python/class.hpp:29,
from /usr/include/boost/python.hpp:18,
from /home/standnail/Git/caffe-lstm/tools/caffe.cpp:2:
/usr/include/boost/type_traits/detail/ice_or.hpp:17:71: note: #pragma message: NOTE: Use of this header (ice_or.hpp) is deprecated
# pragma message("NOTE: Use of this header (ice_or.hpp) is deprecated")
^
In file included from /usr/include/boost/type_traits/ice.hpp:16:0,
from /usr/include/boost/python/detail/def_helper.hpp:9,
from /usr/include/boost/python/class.hpp:29,
from /usr/include/boost/python.hpp:18,
from /home/standnail/Git/caffe-lstm/tools/caffe.cpp:2:
/usr/include/boost/type_traits/detail/ice_and.hpp:18:72: note: #pragma message: NOTE: Use of this header (ice_and.hpp) is deprecated
# pragma message("NOTE: Use of this header (ice_and.hpp) is deprecated")
^
In file included from /usr/include/boost/type_traits/ice.hpp:17:0,
from /usr/include/boost/python/detail/def_helper.hpp:9,
from /usr/include/boost/python/class.hpp:29,
from /usr/include/boost/python.hpp:18,
from /home/standnail/Git/caffe-lstm/tools/caffe.cpp:2:
/usr/include/boost/type_traits/detail/ice_not.hpp:17:72: note: #pragma message: NOTE: Use of this header (ice_not.hpp) is deprecated
# pragma message("NOTE: Use of this header (ice_not.hpp) is deprecated")
^
In file included from /usr/include/boost/type_traits/ice.hpp:18:0,
from /usr/include/boost/python/detail/def_helper.hpp:9,
from /usr/include/boost/python/class.hpp:29,
from /usr/include/boost/python.hpp:18,
from /home/standnail/Git/caffe-lstm/tools/caffe.cpp:2:
/usr/include/boost/type_traits/detail/ice_eq.hpp:17:71: note: #pragma message: NOTE: Use of this header (ice_eq.hpp) is deprecated
# pragma message("NOTE: Use of this header (ice_eq.hpp) is deprecated")
^
[ 86%] Linking CXX executable caffe
../lib/libcaffe.so: undefined reference to `H5LTget_dataset_ndims'
../lib/libcaffe.so: undefined reference to `H5LTread_dataset_int'
../lib/libcaffe.so: undefined reference to `H5LTfind_dataset'
../lib/libcaffe.so: undefined reference to `caffe::BlockingQueue<caffe::Batch<double>*>::pop(std::string const&)'
../lib/libcaffe.so: undefined reference to `google::base::CheckOpMessageBuilder::NewString()'
../lib/libcaffe.so: undefined reference to `H5LTmake_dataset_double'
../lib/libcaffe.so: undefined reference to `H5LTmake_dataset_int'
../lib/libcaffe.so: undefined reference to `H5LTread_dataset_float'
../lib/libcaffe.so: undefined reference to `google::protobuf::internal::NameOfEnum(google::protobuf::EnumDescriptor const*, int)'
../lib/libcaffe.so: undefined reference to `H5LTmake_dataset_float'
../lib/libcaffe.so: undefined reference to `H5LTget_dataset_info'
../lib/libcaffe.so: undefined reference to `H5LTread_dataset_string'
../lib/libcaffe.so: undefined reference to `caffe::BlockingQueue<caffe::Batch<float>*>::pop(std::string const&)'
../lib/libcaffe.so: undefined reference to `H5LTread_dataset_double'
../lib/libcaffe.so: undefined reference to `H5LTmake_dataset_string'
collect2: error: ld returned 1 exit status
make[2]: *** [tools/CMakeFiles/caffe.bin.dir/build.make:127: tools/caffe] Error 1
make[1]: *** [CMakeFiles/Makefile2:472: tools/CMakeFiles/caffe.bin.dir/all] Error 2
make: *** [Makefile:128: all] Error 2
在 archlinux 上工作,所有软件包都已安装。我将 blas 设置为 openblas,如
cmake -DBLAS=open ../caffe-lstm/
并在 make.config 文件中修复
BLAS := open
基于 gcc4.9.3 和 g++5.4.0
问题出在 protobuf 和 cuda 中。之后我安装了 protobuf2.5 和 cuda8,没有任何问题。
小贴士:
Protobuf 应该从 git 或 sourceforge 下载并编译它。 cuda也一样。 Caffe 不喜欢从存储库下载的库。
我在尝试编译时遇到了同样的问题caffe-fast-rcnn,但是我注意到使用相同的配置(protobuf 和 cuda 版本)编译官方 caffe 版本没有问题。所以比较两个版本我通过在 CAFFE_ROOT/cmake/Dependencies.cmake 添加一行来纠正这个问题:
# ---[ HDF5
find_package(HDF5 COMPONENTS HL REQUIRED)
include_directories(SYSTEM ${HDF5_INCLUDE_DIRS} ${HDF5_HL_INCLUDE_DIR})
list(APPEND Caffe_LINKER_LIBS ${HDF5_LIBRARIES})
list(APPEND Caffe_LINKER_LIBS ${HDF5_HL_LIBRARIES}) #added
此问题已在当前的 caffe 版本中得到纠正,但是如果您尝试基于旧版本编译 fork,您仍然可能会发现它..
Ps : 我使用 cmake 构建。
我安装了 caffe 没有任何问题,但是当我尝试构建 caffe-lstm 时,我遇到了下一个问题:
[ 86%] Linking CXX executable train_net
../lib/libcaffe.so: undefined reference to `H5LTget_dataset_ndims'
../lib/libcaffe.so: undefined reference to `H5LTread_dataset_int'
../lib/libcaffe.so: undefined reference to `H5LTfind_dataset'
../lib/libcaffe.so: undefined reference to `caffe::BlockingQueue<caffe::Batch<double>*>::pop(std::string const&)'
../lib/libcaffe.so: undefined reference to `google::base::CheckOpMessageBuilder::NewString()'
../lib/libcaffe.so: undefined reference to `H5LTmake_dataset_double'
../lib/libcaffe.so: undefined reference to `H5LTmake_dataset_int'
../lib/libcaffe.so: undefined reference to `H5LTread_dataset_float'
../lib/libcaffe.so: undefined reference to `google::protobuf::internal::NameOfEnum(google::protobuf::EnumDescriptor const*, int)'
../lib/libcaffe.so: undefined reference to `H5LTmake_dataset_float'
../lib/libcaffe.so: undefined reference to `H5LTget_dataset_info'
../lib/libcaffe.so: undefined reference to `H5LTread_dataset_string'
../lib/libcaffe.so: undefined reference to `caffe::BlockingQueue<caffe::Batch<float>*>::pop(std::string const&)'
../lib/libcaffe.so: undefined reference to `H5LTread_dataset_double'
../lib/libcaffe.so: undefined reference to `H5LTmake_dataset_string'
collect2: error: ld returned 1 exit status
make[2]: *** [tools/CMakeFiles/test_net.dir/build.make:127: tools/test_net] Error 1
make[1]: *** [CMakeFiles/Makefile2:510: tools/CMakeFiles/test_net.dir/all] Error 2
../lib/libcaffe.so: undefined reference to `H5LTget_dataset_ndims'
../lib/libcaffe.so: undefined reference to `H5LTread_dataset_int'
../lib/libcaffe.so: undefined reference to `H5LTfind_dataset'
../lib/libcaffe.so: undefined reference to `caffe::BlockingQueue<caffe::Batch<double>*>::pop(std::string const&)'
../lib/libcaffe.so: undefined reference to `google::base::CheckOpMessageBuilder::NewString()'
../lib/libcaffe.so: undefined reference to `H5LTmake_dataset_double'
../lib/libcaffe.so: undefined reference to `H5LTmake_dataset_int'
../lib/libcaffe.so: undefined reference to `H5LTread_dataset_float'
../lib/libcaffe.so: undefined reference to `google::protobuf::internal::NameOfEnum(google::protobuf::EnumDescriptor const*, int)'
../lib/libcaffe.so: undefined reference to `H5LTmake_dataset_float'
../lib/libcaffe.so: undefined reference to `H5LTget_dataset_info'
../lib/libcaffe.so: undefined reference to `H5LTread_dataset_string'
../lib/libcaffe.so: undefined reference to `caffe::BlockingQueue<caffe::Batch<float>*>::pop(std::string const&)'
../lib/libcaffe.so: undefined reference to `H5LTread_dataset_double'
../lib/libcaffe.so: undefined reference to `H5LTmake_dataset_string'
collect2: error: ld returned 1 exit status
make[2]: *** [tools/CMakeFiles/train_net.dir/build.make:127: tools/train_net] Error 1
make[1]: *** [CMakeFiles/Makefile2:548: tools/CMakeFiles/train_net.dir/all] Error 2
In file included from /usr/include/boost/type_traits/ice.hpp:15:0,
from /usr/include/boost/python/detail/def_helper.hpp:9,
from /usr/include/boost/python/class.hpp:29,
from /usr/include/boost/python.hpp:18,
from /home/standnail/Git/caffe-lstm/tools/caffe.cpp:2:
/usr/include/boost/type_traits/detail/ice_or.hpp:17:71: note: #pragma message: NOTE: Use of this header (ice_or.hpp) is deprecated
# pragma message("NOTE: Use of this header (ice_or.hpp) is deprecated")
^
In file included from /usr/include/boost/type_traits/ice.hpp:16:0,
from /usr/include/boost/python/detail/def_helper.hpp:9,
from /usr/include/boost/python/class.hpp:29,
from /usr/include/boost/python.hpp:18,
from /home/standnail/Git/caffe-lstm/tools/caffe.cpp:2:
/usr/include/boost/type_traits/detail/ice_and.hpp:18:72: note: #pragma message: NOTE: Use of this header (ice_and.hpp) is deprecated
# pragma message("NOTE: Use of this header (ice_and.hpp) is deprecated")
^
In file included from /usr/include/boost/type_traits/ice.hpp:17:0,
from /usr/include/boost/python/detail/def_helper.hpp:9,
from /usr/include/boost/python/class.hpp:29,
from /usr/include/boost/python.hpp:18,
from /home/standnail/Git/caffe-lstm/tools/caffe.cpp:2:
/usr/include/boost/type_traits/detail/ice_not.hpp:17:72: note: #pragma message: NOTE: Use of this header (ice_not.hpp) is deprecated
# pragma message("NOTE: Use of this header (ice_not.hpp) is deprecated")
^
In file included from /usr/include/boost/type_traits/ice.hpp:18:0,
from /usr/include/boost/python/detail/def_helper.hpp:9,
from /usr/include/boost/python/class.hpp:29,
from /usr/include/boost/python.hpp:18,
from /home/standnail/Git/caffe-lstm/tools/caffe.cpp:2:
/usr/include/boost/type_traits/detail/ice_eq.hpp:17:71: note: #pragma message: NOTE: Use of this header (ice_eq.hpp) is deprecated
# pragma message("NOTE: Use of this header (ice_eq.hpp) is deprecated")
^
[ 86%] Linking CXX executable caffe
../lib/libcaffe.so: undefined reference to `H5LTget_dataset_ndims'
../lib/libcaffe.so: undefined reference to `H5LTread_dataset_int'
../lib/libcaffe.so: undefined reference to `H5LTfind_dataset'
../lib/libcaffe.so: undefined reference to `caffe::BlockingQueue<caffe::Batch<double>*>::pop(std::string const&)'
../lib/libcaffe.so: undefined reference to `google::base::CheckOpMessageBuilder::NewString()'
../lib/libcaffe.so: undefined reference to `H5LTmake_dataset_double'
../lib/libcaffe.so: undefined reference to `H5LTmake_dataset_int'
../lib/libcaffe.so: undefined reference to `H5LTread_dataset_float'
../lib/libcaffe.so: undefined reference to `google::protobuf::internal::NameOfEnum(google::protobuf::EnumDescriptor const*, int)'
../lib/libcaffe.so: undefined reference to `H5LTmake_dataset_float'
../lib/libcaffe.so: undefined reference to `H5LTget_dataset_info'
../lib/libcaffe.so: undefined reference to `H5LTread_dataset_string'
../lib/libcaffe.so: undefined reference to `caffe::BlockingQueue<caffe::Batch<float>*>::pop(std::string const&)'
../lib/libcaffe.so: undefined reference to `H5LTread_dataset_double'
../lib/libcaffe.so: undefined reference to `H5LTmake_dataset_string'
collect2: error: ld returned 1 exit status
make[2]: *** [tools/CMakeFiles/caffe.bin.dir/build.make:127: tools/caffe] Error 1
make[1]: *** [CMakeFiles/Makefile2:472: tools/CMakeFiles/caffe.bin.dir/all] Error 2
make: *** [Makefile:128: all] Error 2
在 archlinux 上工作,所有软件包都已安装。我将 blas 设置为 openblas,如
cmake -DBLAS=open ../caffe-lstm/
并在 make.config 文件中修复
BLAS := open
基于 gcc4.9.3 和 g++5.4.0
问题出在 protobuf 和 cuda 中。之后我安装了 protobuf2.5 和 cuda8,没有任何问题。
小贴士: Protobuf 应该从 git 或 sourceforge 下载并编译它。 cuda也一样。 Caffe 不喜欢从存储库下载的库。
我在尝试编译时遇到了同样的问题caffe-fast-rcnn,但是我注意到使用相同的配置(protobuf 和 cuda 版本)编译官方 caffe 版本没有问题。所以比较两个版本我通过在 CAFFE_ROOT/cmake/Dependencies.cmake 添加一行来纠正这个问题:
# ---[ HDF5
find_package(HDF5 COMPONENTS HL REQUIRED)
include_directories(SYSTEM ${HDF5_INCLUDE_DIRS} ${HDF5_HL_INCLUDE_DIR})
list(APPEND Caffe_LINKER_LIBS ${HDF5_LIBRARIES})
list(APPEND Caffe_LINKER_LIBS ${HDF5_HL_LIBRARIES}) #added
此问题已在当前的 caffe 版本中得到纠正,但是如果您尝试基于旧版本编译 fork,您仍然可能会发现它..
Ps : 我使用 cmake 构建。