Installing SID problem:
After successfully installing the first part of SID and continuing the instructions below:
cd SID
mkdir Build
cd Build
cmake -DCMAKE_C_COMPILER=/opt/local/bin/gcc -DCMAKE_CXX_COMPILER=/opt/local/bin/c++ ..
An error occurred, gcc wasn’t found. When I tried in terminal “gcc -v” it showed that it was installed and gave the installed directory, but when I entered the directory I only found c++. When used “which gcc” it gave the directory: “usr/bin/gcc” which is not the one we need.
So I continued by trying to install gcc via sudo port and the Error: “Port gcc not found” appeared. Solved this by adding the version number: “sudo port install gcc7”.
After successful installation again tried “which gcc” which still gave me the “usr/bin/gcc”, meaning, it still didn’t work. Since I need it to be in /opt/local/bin.
At the end it was solved with: “sudo ln -s g++-mp-7 g++” and “sudo ln -s g++ -mp-7 c++”.
Finally, make sure you “export PATH=/usr/local/mysql/bin:$PATH”, and continue with the installation (sudo make install, etc).
One thought on “gcc not working and solved (Mac)”
Perfect. Just for the sake of clarity:
the symbolic link command (ln -s) must be done in the “/opt/local/bin” directory where the versioned gcc/g++/c++ reside.
I am still searching, but I do not understand why this links are not done automatically at installation time. For example on my Mac, using the “readlink” commad (could have used “ls -l”):
% readlink -f /opt/local/bin/c++
/opt/local/bin/c++-mp-6
% readlink -f /opt/local/bin/gcc
/opt/local/bin/gcc-mp-6
% readlink -f /opt/local/bin/g++
/opt/local/bin/g++-mp-6
L.