构建glibc时出错:make / confgure文件出了什么问题?

时间:2018-06-27 20:47:27

标签: build gnu-make glibc

我一直在尝试在Clear Linux上构建glibc,此处讨论了先前的问题: How do I build into a specified directory using the "prefix" option of configure?

现在我已经成功运行了configure,makefile中似乎出现了一些错误:

james@clr ~/Downloads/glibc $ make
Makeconfig:42: *** missing separator.  Stop.

Makeconfig的第42行:

objdir must be defined by the build-directory Makefile.

和nakefile直到错误点:

ifneq (,)
This makefile requires GNU Make.
endif

all: # Make this the default goal

ifneq "$(origin +included-Makeconfig)" "file"

+included-Makeconfig := yes

ifdef subdir
.. := ../
endif

# $(common-objdir) is the place to put objects and
# such that are not specific to a single subdir.
ifdef objdir
objpfx := $(patsubst %//,%/,$(objdir)/$(subdir)/)
common-objpfx = $(objdir)/
common-objdir = $(objdir)
else
objdir must be defined by the build-directory Makefile.
endif

我有GNU Make 4.2.1

2 个答案:

答案 0 :(得分:2)

您看到一个错误,因为此Makefile认为您的环境是错误的。您正在运行的makefile中的行是有目的的语法错误:无需过多地编辑这些行即可将其更改为正确的行,因为其整个目的是在看到无效配置时强制make失败。

它试图告诉您的错误就在文本中:

  

objdir必须由构建目录Makefile定义。

makefile会检查是否定义了objdir变量,如果没有定义,它就属于这种无效的语法。

我已经有一段时间没有尝试自己构建glibc了,所以我不能确切地说出这是什么意思,但是我敢肯定,如果您在Google中看到该错误消息,您会找到一些可以使您前进的信息。

这个Makefile不使用更易读的方式指定错误,例如$(error ...)函数(在1999年发布的GNU make 3.78中添加了此功能),真是太糟糕了。

答案 1 :(得分:0)

libc 禁止从源根目录构建。值得阅读 INSTALL 文件(您也可以在源根目录中找到它):

<块引用>

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

在实践中,这意味着您应该在构建目录中运行configuremake(您应该自己创建它),例如:

glibc-x.xx/build> ../configure "CFLAGS=-m64 -O2" "CXXFLAGS=-m64" "LDFLAGS=-m64" --prefix=$HOME/glibc-x.xx-bin
glibc-x.xx/build> make all install

您收到的错误消息意味着 glibc-x.xx/Makefile 想要从某个父 Makefile 调用,该父 Makefile 必须是由 configure 生成的 glibc-x.xx/build/Makefile。