【问题标题】:How do I build into a specified directory using the "prefix" option of configure?如何使用配置的“前缀”选项构建到指定目录?
【发布时间】:2018-06-27 12:01:20
【问题描述】:

我正在尝试在 Clear Linux 上构建 glibc 2.27,在此处获得:https://www.gnu.org/software/libc/sources.html

根据帮助,我应该使用前缀命令构建到源文件夹之外的目录中。据我所知,我正在执行安装帮助中描述的操作:

配置和编译 GNU C 库

无法在源目录中编译 GNU C 库。你 必须在单独的构建目录中构建它。例如,如果您有 解压 '/src/gnu/glibc-VERSION' 中的 GNU C 库源代码,创建 一个目录'/src/gnu/glibc-build'来放置目标文件。这个 允许在发生错误时删除整个构建目录, 这是重新开始的最安全方式,并且应该始终是 完成。

从您的对象目录中,运行 shell 脚本“配置” 位于源代码树的顶层。在上面的场景中, 你会输入

 $ ../glibc-VERSION/configure ARGS...

请注意,即使您是在单独的构建中构建 目录,编译时可能需要创建或修改文件和 源目录中的目录。

'configure' 有很多选项,但通常只有一个 强制是'--prefix'。此选项告诉“配置”您想要的位置 安装了 GNU C 库。这默认为 '/usr/local',但是 作为标准系统库安装的正常设置是 '--prefix=/usr' 用于 GNU/Linux 系统和 '--prefix='(一个空的 前缀)用于 GNU/Hurd 系统。

所以,我认为我这样做是正确的,但它仍然给我一个关于在不同目录中构建的错误:

james@clr ~/Downloads/glibc $  ./configure --prefix=/home/james/Downloads/glibc-build/
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for gcc... gcc
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for readelf... readelf
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether g++ can link programs... yes
configure: error: you must configure in a separate build directory

【问题讨论】:

  • 为什么需要/想要从源代码构建它?

标签: gnu-make glibc configure


【解决方案1】:

您必须创建一个构建目录并从中运行configure 脚本。你的情况:

mkdir /home/james/Downloads/glibc-build/
cd /home/james/Downloads/glibc-build/
~/Downloads/glibc/configure

--prefix 选项将更改安装目录 (make install)。

【讨论】:

  • 谢谢,这让我解决了配置问题...但是我从哪里运行 make install 呢?我在 /home/james/Downloads/glibc-build/ 和 ~/Downloads/glibc/ 都没有成功。
  • 我认为应该从构建目录 (cd ~/Downloads/glibc-build && make && make install) 工作。你的错误信息是什么?
  • 请注意,执行make install(或更可能是sudo make install非常可能会导致您的系统无法启动。
  • 为什么这个错误信息如此错误?应该是configure: error: you must run configure from the targeted build directory
  • 你是如何尝试构建的?
猜你喜欢
  • 2012-03-14
  • 2013-09-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-06-07
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多