Skip to content

GCC in Anaconda

Sometimes, we may not have root access to install software packages. In this case, we can use Anaconda and specifically conda-forge to install the GCC compiler and other software packages we need.

Install GCC

To install the GCC compiler, we can use the following command:

conda install -c conda-forge gxx

Check the version of the GCC compiler:

gcc --version

This should show the version of the GCC compiler installed in the conda environment.

Troubleshooting

version `GLIBCXX_3.4.XX' not found

  1. Check whether libstdc++ is installed in the conda environment:
ls $CONDA_PREFIX/lib | grep libstdc++

If the library is not found, then follow Install GCC to install the GCC compiler.

  1. Check whether the symbolic link is pointing to the correct version:
strings $CONDA_PREFIX/lib/libstdc++.so.6 | grep GLIBCXX

If nothing there, we need to create a symbolic link:

ln -s libstdc++.so.6.0.33 $CONDA_PREFIX/lib/libstdc++.so.6

This will create a symbolic link to the correct version of the library.