如何阻止Apple编译器Clang冒充GCC(Mac安装Gforth遇冲突)
macOS Sonoma下编译Gforth时GCC与Clang冲突及m4缺失问题
我正尝试按照官方文档安装最新版Gforth,核心问题并非安装流程细节,而是如何阻止Apple编译器Clang与GNU编译器GCC(可执行文件gcc)产生冲突。
我已提交Bug报告并尝试了相关建议,但均无效,对方无法复现该问题,说明问题出在我的本地Mac环境而非Gforth本身。
我的环境:
- macOS v14.2(Sonoma)Intel机型
- GCC可执行文件路径:
/usr/local/bin/gcc-14 - 已安装Xcode及开发者工具
执行的命令及结果:
从Git克隆代码并创建gforth目录
git clone https://git.savannah.gnu.org/git/gforth/进入gforth目录
运行脚本
./install-deps.sh,脚本执行完成,输出如下:Installing /Users/a/gforth/local/bin/ccache-swig-forth /usr/bin/install -c -d /Users/a/gforth/local/bin /usr/bin/install -c -m 755 ccache-swig /Users/a/gforth/local/bin/`echo ccache-swig | sed 's&$&-forth&'` Installation complete /usr/bin/sudo (base) a@Ahmet-MacBook-Air gforth运行
./autogen.sh,执行完成但有警告:glibtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am. configure.ac:1419: warning: The macro 'AC_HEADER_STDC' is obsolete. configure.ac:1419: You should run autoupdate. ./lib/autoconf/headers.m4:663: AC_HEADER_STDC is expanded from... configure.ac:1419: the top level (base) a@Ahmet-MacBook-Air gforth %运行
./configure,完成后存在警告:*** Config summary: Warnings exist *** texi2html not found, HTML document won't be built. swig not found. Swig without -forth feature, library interfaces will not be generated. (base) a@Ahmet-MacBook-Air gforth %运行
make时停止,提示:xcode-select: Failed to locate 'm4', requesting installation of command line developer tools. make: *** [prim.b] Error 72虽已多次安装开发者工具,但仍弹出下载提示,且gforth目录下已有包含8个.m4文件的m4文件夹。
重新下载开发者工具后再次执行
make,出现错误:zsh: parse error near `a@Ahmet-MacBook-Air'再次运行
./configure,仍出现相同警告再次执行
make,仍提示找不到m4尝试
sudo make install,同样提示找不到m4
我已尝试过Stack Overflow及相关平台的多个解决方案,但均无效。
内容的提问来源于stack exchange,提问作者zeynel
相关产品推荐
相关产品推荐

