Skip to content

Instantly share code, notes, and snippets.

@thaddeusc1
Created July 4, 2024 19:21
Show Gist options
  • Save thaddeusc1/254d7f6a41d13c4c8e33b314a55fd9a5 to your computer and use it in GitHub Desktop.
Save thaddeusc1/254d7f6a41d13c4c8e33b314a55fd9a5 to your computer and use it in GitHub Desktop.
Build FlexRIC with GCC 9 and install
#!/usr/bin/env bash
# Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# Install build tools and GCC 9.
sudo apt-get update
sudo apt-get install --assume-yes build-essential gcc-9 g++-9
# Configure environment for multiple versions of GCC.
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 75
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 # Default on Ubuntu 22.04 LTS
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 75
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 100 # Default on Ubuntu 22.04 LTS
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 100
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 100
# Install dependencies
## FlexRIC's packaged dependencies (See also: https://gitlab.eurecom.fr/mosaic5g/flexric)
sudo apt-get install libsctp-dev python3 cmake-curses-gui libpcre2-dev python3-dev
## FlexRIC dependencies that need to be built
### SWIG
git clone https://github.com/swig/swig.git
cd swig
git checkout release-4.1
./autogen.sh
./configure --prefix=/usr/
nice make -j `nproc`
# make -k check # Running unit tests on SWIG could take over an hour.
sudo make install
cd ../
# Build FlexRIC with GCC 9
# ------------------------
# Using GCC 11 produces internal compiler errors!
# - Does FlexRIC need updates to support compilation via GCC 11?
git clone https://gitlab.eurecom.fr/mosaic5g/flexric.git
cd flexric
git checkout v2.0.0
mkdir build
cd build
sudo update-alternatives --set gcc /usr/bin/gcc-9
sudo update-alternatives --set g++ /usr/bin/g++-9
cmake ../
nice make -j `nproc`
sudo make install
ctest
# Switch to the default compile toolchain that shipped with the running Linux distro.
sudo update-alternatives --auto gcc
sudo update-alternatives --auto g++
@thaddeusc1
Copy link
Author

Based on the FlexRIC installation instructions, the inference is that the software was originally developed using Ubuntu v20.04—where GCC 9 was the default compiler. GCC 10 may also work, but has not been tested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment