Linux 如何从源代码编译我自己的 glibc C 标准库并使用它?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10412684/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 06:07:49  来源:igfitidea点击:

How to compile my own glibc C standard library from source and use it?

clinuxgccx86-64glibc

提问by pythonic

I am trying to compile my own glibc. I have a directory glibc, which contain the glibcsource code I downloaded from the internet. From that directory I typed mkdir ../build-glibc. Now from the build-glibcdirectory I typed ../glibc/configure, which performed the configuration. Now I'm not sure how to call make. I can't call it from glibcdirectory since it doesn't have the configuration set, neither I can call it from build-glibc, since makefile is not in that directory. How do I solve this problem?

我正在尝试编译我自己的 glibc。我有一个目录glibc,其中包含glibc我从 Internet 下载的源代码。我从那个目录输入mkdir ../build-glibc. 现在从build-glibc我输入的目录../glibc/configure中执行配置。现在我不确定如何调用make. 我不能从glibc目录中调用它,因为它没有配置集,我也不能从 调用它build-glibc,因为 makefile 不在该目录中。我该如何解决这个问题?

采纳答案by ArjunShankar

The Makefileis going to exist in your build-glibcdirectory if the configurescript finishes successfully.

Makefile会在你的存在build-glibc的目录,如果configure脚本成功完成。

If everything seemsto have gone smoothly during configureand still no Makefile, then you probably missed an idiosyncrasy:

如果在此期间一切似乎都很顺利configure,但仍然没有Makefile,那么您可能错过了一个特质:

While doing a configurefor glibc, it is expected that you normally provide an alternative --prefix, because installing to the default location (/usr/local) can potentially cripple the system. If you don't provide one, then you need to switch on --disable-sanity-checks.

configure为 glibc执行 a 时,通常希望您提供一个替代方案--prefix,因为安装到默认位置 ( /usr/local) 可能会削弱系统。如果您不提供,则需要打开--disable-sanity-checks.

If this is not the case either, look for a config.logfile, and read its contents.

如果也不是这种情况,请查找config.log文件并阅读其内容。