【发布时间】: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
【问题讨论】:
-
为什么需要/想要从源代码构建它?