如何确定 autoconf 的系统类型 --build 配置选项的正确输入?
How to determine proper input for autoconf's system type --build configure option?
在 CPython 中,有一个构建机器系统类型的配置选项
$ wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz
$ tar -xzvf Python-3.7.3.tgz
$ cd Python-3.7.3
$ ./configure --help | grep -A 3 "System types"
System types:
--build=BUILD configure for building on BUILD [guessed]
--host=HOST cross-compile to build programs to run on HOST [BUILD]
--target=TARGET configure for building compilers for TARGET [HOST]
如何正确确定 BUILD
对于任何 Linux 分布应该在此处?通过搜索我发现 CPython Issue 3754 (cross-compilation support for python build) I can see that valid BUILD
values are --build=x86_64-linux-gnu
and --build=x86_64-redhat-linux-gnu
. I can also see from the CPython Dockerfile for Python 3.7 --build
被设置为 $(dpkg-architecture --query DEB_BUILD_GNU_TYPE)
的输出,这在 Debian stretch 上给出
$ docker run --rm debian:stretch /bin/bash -c "echo '$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)'"
x86_64-linux-gnu
但是如果我在像 CentOS 7 这样的东西上,那么我如何使用 OS 命令正确地确定它?
理想情况下,我想要一些能更好地描述 --build
选项的文档。因此,如果这是已知的并且可以链接到它就可以充分回答这个问题。
编辑: Thanks to Anthony Shaw I learned that this is not a CPython issue but related to autoconf. From this information given to me, I see in the autoconf manual (Section 16.7 Specifying the System Type) 那
...give it the --build=type
option. type
can either be a short name for the system type, such as ‘sun4’, or a canonical name which has the form:
cpu-company-system
where system can have one of these forms:
os
kernel-os
See the file config.sub
for the possible values of each field. If config.sub
isn't included in this package, then this package doesn't need to know the machine type.
CPython 有一个 config.sub
$ wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz
$ tar -xzvf Python-3.7.3.tgz
$ cd Python-3.7.3
$ ./config.sub --help
Usage: ./config.sub [OPTION] CPU-MFR-OPSYS or ALIAS
Canonicalize a configuration name.
Options:
-h, --help print this help, then exit
-t, --time-stamp print date of last modification, then exit
-v, --version print version number, then exit
Report bugs and patches to <config-patches@gnu.org>.
但我仍然不太清楚是否有通用的 Linux 广泛解决方案来确定 OS 命令如何获取此信息。
考虑到我的问题,从 The GNU configure and build system documentation's section on Configuration Names 看来,当我要求“[Linux] OS 命令”时,我所描述的基本上就是 config.guess
已经提供:
The shell script config.guess
will normally print the correct configuration name for the system on which it is run. It does by running uname
and by examining other characteristics of the system.
Because config.guess
can normally determine the configuration name for a machine, it is normally only necessary to specify a configuration name when building a cross-compiler or when building using a cross-compiler.
所以我的问题的答案似乎是 configure
已经支持我想做的事情,并且当我在同一台机器上构建时尝试传递 --build
信息我会 运行 如果我尝试编写 Shell 脚本来自动执行配置和构建过程,我将无济于事。
这个问题 What's the difference of “./configure” option “--build”, “--host” and “--target”? 对得出这个结论很有帮助。
在 CPython 中,有一个构建机器系统类型的配置选项
$ wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz
$ tar -xzvf Python-3.7.3.tgz
$ cd Python-3.7.3
$ ./configure --help | grep -A 3 "System types"
System types:
--build=BUILD configure for building on BUILD [guessed]
--host=HOST cross-compile to build programs to run on HOST [BUILD]
--target=TARGET configure for building compilers for TARGET [HOST]
如何正确确定 BUILD
对于任何 Linux 分布应该在此处?通过搜索我发现 CPython Issue 3754 (cross-compilation support for python build) I can see that valid BUILD
values are --build=x86_64-linux-gnu
and --build=x86_64-redhat-linux-gnu
. I can also see from the CPython Dockerfile for Python 3.7 --build
被设置为 $(dpkg-architecture --query DEB_BUILD_GNU_TYPE)
的输出,这在 Debian stretch 上给出
$ docker run --rm debian:stretch /bin/bash -c "echo '$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)'"
x86_64-linux-gnu
但是如果我在像 CentOS 7 这样的东西上,那么我如何使用 OS 命令正确地确定它?
理想情况下,我想要一些能更好地描述 --build
选项的文档。因此,如果这是已知的并且可以链接到它就可以充分回答这个问题。
编辑: Thanks to Anthony Shaw I learned that this is not a CPython issue but related to autoconf. From this information given to me, I see in the autoconf manual (Section 16.7 Specifying the System Type) 那
...give it the
--build=type
option.type
can either be a short name for the system type, such as ‘sun4’, or a canonical name which has the form:cpu-company-system
where system can have one of these forms:
os kernel-os
See the file
config.sub
for the possible values of each field. Ifconfig.sub
isn't included in this package, then this package doesn't need to know the machine type.
CPython 有一个 config.sub
$ wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz
$ tar -xzvf Python-3.7.3.tgz
$ cd Python-3.7.3
$ ./config.sub --help
Usage: ./config.sub [OPTION] CPU-MFR-OPSYS or ALIAS
Canonicalize a configuration name.
Options:
-h, --help print this help, then exit
-t, --time-stamp print date of last modification, then exit
-v, --version print version number, then exit
Report bugs and patches to <config-patches@gnu.org>.
但我仍然不太清楚是否有通用的 Linux 广泛解决方案来确定 OS 命令如何获取此信息。
考虑到我的问题,从 The GNU configure and build system documentation's section on Configuration Names 看来,当我要求“[Linux] OS 命令”时,我所描述的基本上就是 config.guess
已经提供:
The shell script
config.guess
will normally print the correct configuration name for the system on which it is run. It does by runninguname
and by examining other characteristics of the system.Because
config.guess
can normally determine the configuration name for a machine, it is normally only necessary to specify a configuration name when building a cross-compiler or when building using a cross-compiler.
所以我的问题的答案似乎是 configure
已经支持我想做的事情,并且当我在同一台机器上构建时尝试传递 --build
信息我会 运行 如果我尝试编写 Shell 脚本来自动执行配置和构建过程,我将无济于事。
这个问题 What's the difference of “./configure” option “--build”, “--host” and “--target”? 对得出这个结论很有帮助。