“安装"在/usr/lib 而不是/usr/lib64 中安装库 [英] "make install" installs libraries in /usr/lib instead of /usr/lib64

查看:62
本文介绍了“安装"在/usr/lib 而不是/usr/lib64 中安装库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 64 位 CentOS 7.2 上构建和安装一个库.为此,我正在运行

I am trying to build and install a library on 64-bit CentOS 7.2. For this purpose I am running

cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ..

sudo make install

当我运行上述命令时,我发现安装的库位于 /usr/lib 而不是 /usr/lib64.理想情况下,当我在 64 位 Linux 机器上编译时,安装目录是 /usr/lib64.

When I run the above commands I found that the installed library is in /usr/lib instead of /usr/lib64. Ideally, when I am compiling on a 64-bit Linux machine the installation directory is /usr/lib64.

推荐答案

@Tsyvarev 在评论中提出了建议,但他提到的变量不正确.这对我有用:

@Tsyvarev suggested it in the comments but the variable he mentioned was not correct. This did the trick for me:

cmake -DCMAKE_INSTALL_LIBDIR=lib <more defines> ..

它记录在 CMake GNUInstallDirs 页面中.还要考虑您正在构建的项目,如果它的第 3 方可能会通过这种或其他方式覆盖最终安装目录.

It is documented in CMake GNUInstallDirs page. Also consider the project you're building, if its 3rd party, may override the end up installation directory by this or other means.

这篇关于“安装"在/usr/lib 而不是/usr/lib64 中安装库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆