c - 如何在运行配置命令的地方手动指定 gcc
问题描述
我想在 Mac Mojave 中编译 GNU make,操作系统默认的 c 编译器是 clang。当我运行时:
./configure
输出是:
dolphins-MacBook-Air:make-3.82 dolphin$ ./configure
checking for a BSD-compatible install... /usr/local/bin/ginstall -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/local/bin/gmkdir -p
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/Users/dolphin/Desktop/make-3.82':
configure: error: C compiler cannot create executables
See `config.log' for more details.
安装make时如何指定C编译器?我努力了:
./configure CC=/usr/local/Cellar/gcc@7/7.4.0_2/bin/gcc-7
CC=/usr/local/Cellar/gcc@7/7.4.0_2/bin/gcc-7 ./configure
但它不起作用。
解决方案
在 make cli 上尝试一下
$ CC=/usr/local/Cellar/gcc@7/7.4.0_2/bin/gcc-7 make
但首先必须确保 Makefile 已完美生成并重新启动它,这需要make clean
推荐阅读
- ios - 用户在 Swift 中提交所有文本字段后如何启用按钮
- javascript - 如何在 sequelize 中编写查询以查找与 user_id 关联的所有待办事项
- firebase - 如何将子集合添加到 Firestore 中的文档?
- c++ - 使用填充 cstring
使用 File I/O C++ 来自文本文件的文本 - php - 使用 PHP 从动态表单提交多个数据
- azure - Azure ad b2c:无法在配置了自定义策略的情况下访问后端
- google-apps-script - 从特定列中获取文本字符串并选择该字符串的范围并编辑值
- node.js - Heroku 节点服务器部署未响应客户端
- django - 结合 2 个 CharFields 形成一个属性
- python - django 模型表值无法在 html 中看到