/ usr / bin / ld:在CentOS 7中找不到-lclapack

时间:2018-03-26 18:40:17

标签: c++ makefile centos ld

如何在CentOS 7中修复此错误?

[jalal@goku c++]$ make
[ 25%] Linking CXX executable TestSVM
/usr/bin/ld: cannot find -lclapack
collect2: error: ld returned 1 exit status
make[2]: *** [TestSVM] Error 1
make[1]: *** [CMakeFiles/TestSVM.dir/all] Error 2
make: *** [all] Error 2

我有:

$ lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 7.4.1708 (Core) 
Release:    7.4.1708
Codename:   Core

这是我正在使用的回购: https://github.com/sausax/pose_estimation/issues/1 https://github.com/sausax/pose_estimation

1 个答案:

答案 0 :(得分:1)

显然这个库对于CentOS来说并不存在,所以我只搜索包含它的文件并删除它:

[jalal@goku c++]$ grep -irn "lclapack"
CMakeLists.txt:5:set(CMAKE_CXX_FLAGS  "-lcblas -lclapack")
CMakeFiles/TestSVM.dir/link.txt:1:/usr/bin/c++  -lcblas -lclapack  -rdynamic CMakeFiles/TestSVM.dir/TestSVM.cpp.o  -o TestSVM -lopencv_calib3d -lopencv_contrib -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video -lopencv_videostab 
CMakeFiles/TestSVM.dir/flags.make:5:CXX_FLAGS = -lcblas -lclapack   -std=gnu++11
CMakeFiles/TrainSVM.dir/link.txt:1:/usr/bin/c++  -lcblas -lclapack  -rdynamic CMakeFiles/TrainSVM.dir/TrainSVM.cpp.o  -o TrainSVM -lopencv_calib3d -lopencv_contrib -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video -lopencv_videostab 
CMakeFiles/TrainSVM.dir/flags.make:5:CXX_FLAGS = -lcblas -lclapack   -std=gnu++11

此处还建议使用类似的解决方案https://github.com/SciRuby/nmatrix/commit/d126005ca9ce8339c54a80accaa835904f304f6c

或者更好的是从CMakeLists.txt

中删除它
set(CMAKE_CXX_FLAGS  "-lcblas -lclapack")

转换为

set(CMAKE_CXX_FLAGS  "-lcblas")