C 编译器无法创建可执行文件
Posted
技术标签:
【中文标题】C 编译器无法创建可执行文件【英文标题】:C compiler can't create executables 【发布时间】:2021-06-16 08:08:14 【问题描述】:我正在尝试安装弹性 beanstalk cli,如下所示:
./aws-elastic-beanstalk-cli-setup/scripts/bundled_installer
但我收到以下错误:
python-build: use openssl from homebrew
python-build: use readline from homebrew
Downloading Python-3.7.2.tar.xz...
-> https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tar.xz
Installing Python-3.7.2...
python-build: use readline from homebrew
BUILD FAILED (OS X 11.1 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/96/df02xppj77g7dx698gtmwmrw0000gn/T/python-build.20210319024756.38557
Results logged to /var/folders/96/df02xppj77g7dx698gtmwmrw0000gn/T/python-build.20210319024756.38557.log
Last 10 log lines:
checking for python3.7... python3.7
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... checking for --without-gcc... no
checking for --with-icc... no
checking for gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
checking whether the C compiler works... no
configure: error: in `/var/folders/96/df02xppj77g7dx698gtmwmrw0000gn/T/python-build.20210319024756.38557/Python-3.7.2':
configure: error: C compiler cannot create executables
See `config.log' for more details
Exiting due to failure
由于某种原因,安装脚本没有检测到 C 编译器。当然,gcc 和 cc 命令都可以在终端中运行。我正在使用 macOS 11.1。我该如何解决这个问题?
【问题讨论】:
查看 `config.log' 了解更多详情 在哪里可以找到这个文件? 无论你在哪里运行configure
我没有在任何地方运行配置
也许你应该弄清楚安装脚本在哪里运行配置。你熟悉 find 命令吗?
【参考方案1】:
您需要使用 Roseta 来运行命令,而通过 Rosetta 可以使用 arch 命令来运行命令:
arch -x86_64 ./aws-elastic-beanstalk-cli-setup/scripts/bundled_installer
【讨论】:
您是否尝试运行: brew install zlib openssl readline CFLAGS="-I$(brew --prefix openssl)/include -I$(brew --prefix readline)/include -I$( xcrun --show-sdk-path)/usr/include" LDFLAGS="-L$(brew --prefix openssl)/lib -L$(brew --prefix readline)/lib -L$(brew --prefix zlib )/lib"以上是关于C 编译器无法创建可执行文件的主要内容,如果未能解决你的问题,请参考以下文章