I'm not sure how exactly the packages relate, but I needed to install the gcc package to resolve some sort of load error. Given that gcc didn't produce any results, I ran a quick
Copy$ conda search gcc
Which yielded, among other things, gcc_linux-64. After
Copy$ conda install gcc_linux-64
My issue went away, despite the fact that which gcc still pointed to the system install 🤷♂️
I'm not sure how exactly the packages relate, but I needed to install the gcc package to resolve some sort of load error. Given that gcc didn't produce any results, I ran a quick
Copy$ conda search gcc
Which yielded, among other things, gcc_linux-64. After
Copy$ conda install gcc_linux-64
My issue went away, despite the fact that which gcc still pointed to the system install 🤷♂️
I had to install two conda packages to fix this issue:
Copy$ conda install gcc_linux-64
$ conda install gxx_linux-64
I'm still on Ubuntu 22.04 LTS but needed g++14. The sudo apt-get gcc-14 did not work for me, as it installed clang++14 for some reason (perhaps a misconfiguration on my part). What did work for me was following the instructions I found at https://www.dedicatedcore.com/blog/install-gcc-compiler-ubuntu/
The steps I took:
sudo apt install build-essential
sudo apt install libmpfr-dev libgmp3-dev libmpc-dev -y
wget https://ftp.gnu.org/gnu/gcc/gcc-14.1.0/gcc-14.1.0.tar.gz
tar -xf gcc-14.1.0.tar.gz
cd gcc-14.1.0
./configure -v --build=$(uname -m)-linux-gnu --host=$(uname -m)-linux-gnu --target=$(uname -m)-linux-gnu --prefix=/usr/local/gcc-14.1.0 --enable-checking=release --enable-languages=c,c++ --disable-multilib --program-suffix=-14.1.0
make
sudo make install
And if you would like to make it the default:
sudo update-alternatives --install /usr/bin/g++ g++ /usr/local/gcc-14.1.0/bin/g++-14.1.0 14
sudo update-alternatives --install /usr/bin/gcc gcc /usr/local/gcc-14.1.0/bin/gcc-14.1.0 14
After that, g++ showed I was running version 14.1.0. I was then able to compile my project that included some c++20/23 features that were not in the previous versions of g++ (chrono/format).
GCC-14 (and G++-14) is available in the Universe repository for Ubuntu 24.04, as evident in the Ubuntu Package archive.
It is equally evident that this package is not available for Ubuntu 22.04, so installing this on 22.04 will require some third-party interference, or you have to compile it yourself.
See here on how to enable the Universe repositories.
Just to share, not sure it will help you. However it shows that in standard conditions it is possible to use the conda gcc as described in the documentation instead of the system gcc.
# system gcc
which gcc && gcc --version
# /usr/bin/gcc
# gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
# creating a conda env with gcc
conda create -n gcc gcc
# activate the environment
conda activating gcc
which gcc && gcc --version
# /opt/conda/envs/gcc/bin/gcc
# gcc (GCC) 11.2.0
Here is the list of packages installed on a fresh environment created with only gcc.
# packages in environment at /opt/conda/envs/gcc:
#
# Name Version Build Channel
_libgcc_mutex 0.1 conda_forge conda-forge
_openmp_mutex 4.5 1_gnu conda-forge
binutils_impl_linux-64 2.36.1 h193b22a_2 conda-forge
gcc 11.2.0 h702ea55_2 conda-forge
gcc_impl_linux-64 11.2.0 h82a94d6_11 conda-forge
kernel-headers_linux-64 2.6.32 he073ed8_15 conda-forge
ld_impl_linux-64 2.36.1 hea4e1c9_2 conda-forge
libgcc-devel_linux-64 11.2.0 h0952999_11 conda-forge
libgcc-ng 11.2.0 h1d223b6_11 conda-forge
libgomp 11.2.0 h1d223b6_11 conda-forge
libsanitizer 11.2.0 he4da1e4_11 conda-forge
libstdcxx-ng 11.2.0 he4da1e4_11 conda-forge
sysroot_linux-64 2.12 he073ed8_15 conda-forge
In addition to the solution posted in this issue. I added symbolic-links that point to the conda installed gcc, which I was missing.
ln -s /home/envs/segmentation_base/bin/x86_64-conda_cos6-linux-gnu-cc gcc
ln -s /home/envs/segmentation_base/bin/x86_64-conda_cos6-linux-gnu-cpp g++