赞
踩
今天开始一个新的项目,从git上面拉取到了项目的代码,这个项目用的是cmake编译的,之前还没有用过cmake,所以应该是要安装一下
1.先用已经存在的脚本试着运行一下
./cmk: line 48: cmake: command not found
提示cmake命令不存在,果然是要安装一下
2.安装cmake
sudo apt install cmake
3.装完之后,再运行一下
cmake: error while loading shared libraries: librtmp.so.0: cannot open shared object file: No such file or directory
提示librtmp.so.0这个库不存在,,查了一下发现我的虚拟机上这个库在/usr/local/lib/目录下面
4.按照网上的方法,把路径写到/etc/ld.so.conf下面
- vi /etc/ld.so.conf
-
- sudo vi /etc/ld.so.conf
-
- /sbin/ldconfig -v
结果还是不行
5.经过同事提醒,确认cmake是否安装上了,使用ldd命令查看库的依赖关系(惭愧,ldd命令之前可能见过没用过。。。,)
whereis cmake
- zqq@zqq-virtual-machine:~$ whereis cmake
- cmake: /usr/bin/cmake /usr/local/lib/cmake /usr/share/man/man1/cmake.1.gz
ldd /usr/bin/cmake
- zqq@zqq-virtual-machine:~$ ldd /usr/bin/cmake
- /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake)
- linux-vdso.so.1 => (0x00007ffc0419f000)
- libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f8c2fb9f000)
- libz.so.1 => /usr/local/lib/libz.so.1 (0x00007f8c2f983000)
- libarchive.so.13 => /usr/lib/x86_64-linux-gnu/libarchive.so.13 (0x00007f8c2f6e0000)
- libcurl.so.4 => /usr/local/lib/libcurl.so.4 (0x00007f8c2f469000)
- libjsoncpp.so.1 => /usr/lib/x86_64-linux-gnu/libjsoncpp.so.1 (0x00007f8c2f238000)
- libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f8c2eeb6000)
- libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f8c2eca0000)
- libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8c2e8d6000)
- /lib64/ld-linux-x86-64.so.2 (0x00007f8c2fda3000)
- libnettle.so.6 => /usr/lib/x86_64-linux-gnu/libnettle.so.6 (0x00007f8c2e6a0000)
- libattr.so.1 => /lib/x86_64-linux-gnu/libattr.so.1 (0x00007f8c2e49b000)
- liblzo2.so.2 => /lib/x86_64-linux-gnu/liblzo2.so.2 (0x00007f8c2e279000)
- liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f8c2e057000)
- libbz2.so.1.0 => /lib/x86_64-linux-gnu/libbz2.so.1.0 (0x00007f8c2de47000)
- libxml2.so.2 => /usr/lib/x86_64-linux-gnu/libxml2.so.2 (0x00007f8c2da8c000)
- librtmp.so.0 => not found
- libssl.so.1.0.0 => /lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007f8c2d823000)
- libcrypto.so.1.0.0 => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007f8c2d3de000)
- libldap_r-2.4.so.2 => /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2 (0x00007f8c2d18d000)
- liblber-2.4.so.2 => /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2 (0x00007f8c2cf7e000)
- libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f8c2cd61000)
- libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f8c2ca58000)
- libicuuc.so.55 => /usr/lib/x86_64-linux-gnu/libicuuc.so.55 (0x00007f8c2c6c4000)
- libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f8c2c4a9000)
- libsasl2.so.2 => /usr/lib/x86_64-linux-gnu/libsasl2.so.2 (0x00007f8c2c28e000)
- libgssapi.so.3 => /usr/lib/x86_64-linux-gnu/libgssapi.so.3 (0x00007f8c2c04d000)
- libgnutls.so.30 => /usr/lib/x86_64-linux-gnu/libgnutls.so.30 (0x00007f8c2bd1d000)
- libicudata.so.55 => /usr/lib/x86_64-linux-gnu/libicudata.so.55 (0x00007f8c2a266000)
- libheimntlm.so.0 => /usr/lib/x86_64-linux-gnu/libheimntlm.so.0 (0x00007f8c2a05d000)
- libkrb5.so.26 => /usr/lib/x86_64-linux-gnu/libkrb5.so.26 (0x00007f8c29dd3000)
- libasn1.so.8 => /usr/lib/x86_64-linux-gnu/libasn1.so.8 (0x00007f8c29b31000)
- libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2 (0x00007f8c2992d000)
- libhcrypto.so.4 => /usr/lib/x86_64-linux-gnu/libhcrypto.so.4 (0x00007f8c296fa000)
- libroken.so.18 => /usr/lib/x86_64-linux-gnu/libroken.so.18 (0x00007f8c294e4000)
- libp11-kit.so.0 => /usr/lib/x86_64-linux-gnu/libp11-kit.so.0 (0x00007f8c29280000)
- libidn.so.11 => /usr/lib/x86_64-linux-gnu/libidn.so.11 (0x00007f8c2904d000)
- libtasn1.so.6 => /usr/lib/x86_64-linux-gnu/libtasn1.so.6 (0x00007f8c28e3a000)
- libhogweed.so.4 => /usr/lib/x86_64-linux-gnu/libhogweed.so.4 (0x00007f8c28c07000)
- libgmp.so.10 => /usr/lib/x86_64-linux-gnu/libgmp.so.10 (0x00007f8c28987000)
- libwind.so.0 => /usr/lib/x86_64-linux-gnu/libwind.so.0 (0x00007f8c2875e000)
- libheimbase.so.1 => /usr/lib/x86_64-linux-gnu/libheimbase.so.1 (0x00007f8c2854f000)
- libhx509.so.5 => /usr/lib/x86_64-linux-gnu/libhx509.so.5 (0x00007f8c28304000)
- libsqlite3.so.0 => /usr/local/lib/libsqlite3.so.0 (0x00007f8c28007000)
- libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007f8c27dcf000)
- libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f8c27bc7000)
- zqq@zqq-virtual-machine:~$ cd /usr/lib/x86_64-linux-gnu/
1./usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake)
2.librtmp.so.0 => not found
libcurl.so.4网上查说是冲突了 librtmp.so.0动态库没找到
1. ldconfig -p | grep libcurl.so.4使用这条命令查看libcurl.so.4的路径,
- zqq@zqq-virtual-machine:/usr/lib/x86_64-linux-gnu$ ldconfig -p | grep libcurl.so.4
- libcurl.so.4 (libc6,x86-64) => /usr/local/lib/libcurl.so.4
- libcurl.so.4 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libcurl.so.4
删除掉/usr/local/lib/libcurl.so.4,使用软连接到usr/lib/x86_64-linux-gnu/libcurl.so.4.4.0
- zqq@zqq-virtual-machine:/usr/lib/x86_64-linux-gnu$ sudo rm -rf /usr/local/lib/libcurl.so.4
- zqq@zqq-virtual-machine:/usr/lib/x86_64-linux-gnu$ sudo ln -s /usr/lib/x86_64-linux-gnu/libcurl.so.4.4.0 /usr/local/lib/libcurl.so.4
2.看到cmake的库依赖基本上都在/usr/lib/x86_64-linux-gnu/这个路径,把librtmp.so.0复制到前面的路径下面
cmake -version查看信息正常
-
- zqq@zqq-virtual-machine:~/share/work/indoor/anyka3760d$ cmake -version
- cmake version 3.5.1
-
- CMake suite maintained and supported by Kitware (kitware.com/cmake).
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。