构建 glibc 时出错:make/confgure 文件有什么问题?
Errors building glibc: what is wrong with the make/confgure files?
我一直在尝试在 Clear Linux 上构建 glibc,这里讨论了之前的问题:
How do I build into a specified directory using the "prefix" option of 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
您看到错误是因为此生成文件认为您的环境有误。 makefile 中你是 运行 的行是故意的语法错误:无论对这些行进行多少编辑都不会将其更改为正确的行,因为它的全部目的是在看到无效配置时强制 make 失败。
它试图告诉您的错误就在文本中:
objdir must be defined by the build-directory Makefile.
makefile 检查是否定义了 objdir
变量,如果没有,它就会陷入这种无效语法。
我已经有一段时间没有尝试自己构建 glibc 了,所以我不能确切地说出那是什么意思,但我敢肯定如果你 Google 那条错误消息,你会找到一些信息会让你前进。
很遗憾这个 makefile 没有使用更易读的方式来指定错误,例如 $(error ...)
函数(在 1999 年发布的 GNU make 3.78 中添加)。
libc 禁止从源码根目录构建。值得阅读安装文件(您也可以在源代码根目录中找到它):
The GNU C Library cannot be compiled in the source directory. You must
build it in a separate build directory. For example, if you have
unpacked the GNU C Library sources in '/src/gnu/glibc-VERSION', create a
directory '/src/gnu/glibc-build' to put the object files in. This
allows removing the whole build directory in case an error occurs, which
is the safest way to get a fresh start and should always be done.
在实践中,这意味着您应该 运行 configure 和 make 在构建目录中(您应该创建它自己),例如:
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 想从某些必须是 glibc-x 的父 Makefile 调用。xx/build/Makefile 由 configure.
考虑到来源在“~/Downloads/glibc”,那么
在其他地方创建一个构建文件夹,例如“~/Downloads/glibc-build”,cd 到它,然后运行 从该文件夹进行配置,例如“../glibc/configure”。很可能会出错,做一些错误,显示错误。
简单的修复是 运行 相同的配置(../glibc/configure,从内部 ~/Downloads/glibc-build )但现在有选项“--disable-sanity-checks” .这可能会产生一个 Makefile。现在 运行 'make'.
如果您正在构建旧的 glibc,请尝试使用同一时代的旧 gcc 版本,因为通常为特定编译器版本编写的代码只会为那些编译器版本构建。祝你好运
我一直在尝试在 Clear Linux 上构建 glibc,这里讨论了之前的问题: How do I build into a specified directory using the "prefix" option of 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
您看到错误是因为此生成文件认为您的环境有误。 makefile 中你是 运行 的行是故意的语法错误:无论对这些行进行多少编辑都不会将其更改为正确的行,因为它的全部目的是在看到无效配置时强制 make 失败。
它试图告诉您的错误就在文本中:
objdir must be defined by the build-directory Makefile.
makefile 检查是否定义了 objdir
变量,如果没有,它就会陷入这种无效语法。
我已经有一段时间没有尝试自己构建 glibc 了,所以我不能确切地说出那是什么意思,但我敢肯定如果你 Google 那条错误消息,你会找到一些信息会让你前进。
很遗憾这个 makefile 没有使用更易读的方式来指定错误,例如 $(error ...)
函数(在 1999 年发布的 GNU make 3.78 中添加)。
libc 禁止从源码根目录构建。值得阅读安装文件(您也可以在源代码根目录中找到它):
The GNU C Library cannot be compiled in the source directory. You must build it in a separate build directory. For example, if you have unpacked the GNU C Library sources in '/src/gnu/glibc-VERSION', create a directory '/src/gnu/glibc-build' to put the object files in. This allows removing the whole build directory in case an error occurs, which is the safest way to get a fresh start and should always be done.
在实践中,这意味着您应该 运行 configure 和 make 在构建目录中(您应该创建它自己),例如:
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 想从某些必须是 glibc-x 的父 Makefile 调用。xx/build/Makefile 由 configure.
考虑到来源在“~/Downloads/glibc”,那么
在其他地方创建一个构建文件夹,例如“~/Downloads/glibc-build”,cd 到它,然后运行 从该文件夹进行配置,例如“../glibc/configure”。很可能会出错,做一些错误,显示错误。
简单的修复是 运行 相同的配置(../glibc/configure,从内部 ~/Downloads/glibc-build )但现在有选项“--disable-sanity-checks” .这可能会产生一个 Makefile。现在 运行 'make'.
如果您正在构建旧的 glibc,请尝试使用同一时代的旧 gcc 版本,因为通常为特定编译器版本编写的代码只会为那些编译器版本构建。祝你好运