macosgcccompiler-errorsclanggforth

How can I stop Apple’s compiler clang impersonating gcc?


I’m trying to install the bleeding edge version of gforth according to this page

My question is not about the details of installation but about how to stop clang conflicting with GNU compiler gcc.

There are many questions in SO about this issue, I added some of them at the end.

I have a bug report filed here and I tried their suggestions as well but nothing worked. They cannot reproduce the problem because gforth compiles fine in their system. So the issue is with my Mac not with gforth.

I hope that someone with a deep knowledge of Mac OSX can help. Thanks

I’m on Sonoma 14.2, Intel

My gcc is in this location:

/usr/local/bin/gcc-14

X-Code and Developers tools are installed.

EDIT

These are the commands I issued:

  1. Clone from git and create gforth directory

    git clone https://git.savannah.gnu.org/git/gforth/

  2. cd to gforth directory

  3. Run the script ./install-deps.sh

The script ended with

[...]

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 
  1. Run ./autogen.sh

This ends with

[...]

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 %      
  1. Run ./configure

This ends with:

*** 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 % 
  1. Run make

This stopped here

xcode-select: Failed to locate 'm4', requesting installation of command line developer tools.
make: *** [prim.b] Error 72

A message appeared asking to download the developer tools. (Already installed several times!)

m4 folder is already in the gforth directory. It contains 8 .m4 files

  1. I downloaded the developer tools and entered make again and I got this

    (base) a@Ahmet-MacBook-Air gforth % make zsh: parse error near `a@Ahmet-MacBook-Air'

  2. I ran ./configure again and I got

    *** 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 %

  3. I ran make again and I got this

    (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 (base) a@Ahmet-MacBook-Air gforth %

  4. I tried the last step sudo make install and I got

    (base) a@Ahmet-MacBook-Air gforth % sudo make install Password:

    xcode-select: Failed to locate 'm4', requesting installation of command line developer tools.

    make: *** [prim.b] Error 72

    (base) a@Ahmet-MacBook-Air gforth %


Some of the questions that I tried are:

How do I make sure that my default C/C++ compiler is GCC

How to remove clang?

How to uninstall a compiler on mac?

https://ports.macports.org/port/gcc12/

Install GNU GCC on mac

My question on Superuser before I realized that the issue was related to clang:


Solution

  • You ran ./configure without telling it which compiler to use. Issue ./configure --help to learn how to do this.

    Configure is not picking up your /usr/local version of gcc.