CentOS 7下编译出现/usr/bin/ld: cannot find -lclapack错误如何解决?
/usr/bin/ld: cannot find -lclapack Error on CentOS 7.4.1708 That linker error you're hitting means your system is missing the CLAPACK (C interface to the LAPACK linear algebra library) development packages—so the linker can't locate libclapack.so when trying to build your TestSVM executable. Here's how to resolve this on CentOS 7.4:
1. Install the required CLAPACK packages
Use yum with root privileges to install the necessary development libraries:
sudo yum install -y lapack-devel clapack-devel
Why both?
lapack-develprovides the underlying LAPACK library dependencies, whileclapack-develincludes the C-compatible headers and shared libraries that your code is linking against.
2. Verify the library is installed correctly
Check that the shared library exists in your system's default library path:
ls /usr/lib64/libclapack.so
If you see the file path printed, the installation was successful.
3. Rebuild your project
Clean up any partial build artifacts first, then re-run the compile command:
make clean make
Troubleshooting tip
If you still run into issues, double-check your CMake configuration. Ensure your CMakeLists.txt explicitly links against clapack for your target, like this:
target_link_libraries(TestSVM PRIVATE clapack)
内容的提问来源于stack exchange,提问作者Mona Jalal

