Incase anyone has this problem when installing SID:
When installing SID
When I ran the command:
cmake -DCMAKE_C_COMPILER=/opt/local/bin/gcc -DCMAKE_CXX_COMPILER=/opt/local/bin/c++ ..
I got the error:
CXX_COMPILER=/opt/local/bin/c++ ..
— The C compiler identification is unknown
— The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:5 (PROJECT):
The CMAKE_C_COMPILER:
/opt/local/bin/gcc
is not a full path to an existing compiler tool.
I fixed it by changing the original command to:
cmake -DCMAKE_C_COMPILER=/usr/local/bin/gcc-8 -DCMAKE_CXX_COMPILER=/usr/local/bin/c++-8 ..
Homebrew installed gcc and c++ in the usr folder and gave them the names gcc-8, c++-8
2 thoughts on “homebrew gcc/c++ problem Mac”
As one needs to have the “standard” gcc and g++ commands on the path (being listed before those in /usr/bin !) , as a temporary fix we made two logical links in /usr/local/bin:
sudo ln -s gcc-8 gcc
sudo ln -s c++-8 c++
This was the definitive solution!
This should be have done automatically on gcc installation, I believe, but there must be something wrong on High Sierra OS. See e.g. this page:
https://stackoverflow.com/questions/48175913/homebrew-wont-link-gcc-on-mac-high-sierra
After a manual clean in the “contrib” directory (this will be fixed in the next SID version):
cd ../contrib
make clean
redo the cmake command using the logical links:
cd ../Build
make clean
cmake -DCMAKE_C_COMPILER=/usr/local/bin/gcc -DCMAKE_CXX_COMPILER=/usr/local/bin/c++ ..
and then make, make install:
make
sudo make install
All working!
L.
In my case, we had to do also this link
sudo ln -s g++-8 g++
after making
sudo ln -s gcc-8 gcc
sudo ln -s c++-8 c++
Now everything works! YAY!
Best wishes,
C.