问题描述
系统:The system is: Linux - 4.9.76-1-MANJARO - x86_64
今天是在用cmake配置库时候出现了这个问题,我以为是库的问题,但找了一个cmake测试程序
我发现并不是库出现了问题,而是在cmake执行的时候出现了问题,错误信息保存在如下两个文件里面:

Compiling the C compiler identification source file “CMakeCCompilerId.c” failed.
Compiler: /bin/cc
Build flags:
Id flags:
The output was:
1
/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.1/cc1:
error while loadin g shared libraries: libmpfr.so.6: cannot open shared object file: No such file or directory
解决方法
renhaofan@renhaofan-pc ~> sudo pacman -S mpfr
renhaofan@renhaofan-pc ~> ls /usr/lib | grep libmpfr
libmpfr.so
libmpfr.so.6
libmpfr.so.6.0.1
renhaofan@renhaofan-pc ~/t/b/CMakeFiles> sudo ln -s -f /usr/lib/libmpfr.so.6 /usr/lib/libmpfr.so.4
再次cmake
[renhaofan@renhaofan-pc build]$ sudo cmake ..
-- The C compiler identification is GNU 7.3.1
-- The CXX compiler identification is GNU 7.3.1
-- Check for working C compiler: /bin/cc
-- Check for working C compiler: /bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /bin/c++
-- Check for working CXX compiler: /bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/renhaofan/test_sqrt/build
版权声明:本文为renhaofan原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。