Skip to main content

[Texte] Installation ViabLab à partir de GitHub

Niveau de difficulté
Thématique
Présentation formation

How to install and compile ViabLab from GitHub

Contenu
MAC OS
Read more 

 

Step 1. Prerequisite

  • Install gcc/g++. To verify gcc and g++ are installed :

which gcc
which g++

If not installed :

brew install gcc
brew install g++
  • Install cmake 3.13.5. To verify the correct version is installed :
which cmake

If not installed or not the correct version, uninstall cmake :

brew uninstall --force cmake brew cleanup -s cmake 

Then command which cmake should answer cmake not found.

Download cmake-3.13.5-Darwin-x86_64.tar at https://github.com/Kitware/CMake/releases/tag/v3.13.5 

Verify cmake version :

ls ~/Downloads | grep cmake cmake-3.13.5-Darwin-x86_64.tar 

Go to download folder and unzip the archive

cd ~/Downloads tar -xvf cmake-3.13.5-Darwin-x86_64.tar

 Move the folder to viablab folder : 

 mv cmake-3.13.5-Darwin-x86_64 ~/<your path>/viablab/cmake 

Verify the version :

~/<your path>/viablab/cmake/CMake.app/Contents/bin/cmake --version

should answer cmake version 3.13.5.

Add cmake command to global PATH global to use it more easily :

nano ~/.zshrc

 Add the following line at the end of file :

 export PATH="$HOME/Desktop/viablab/cmake/cmake-3.13.5-Darwin-x86_64/CMake.app/Contents/bin:$PATH" 

Save and quit :  Ctrl + X, then Y, and Return).

 Apply the modifications :

source ~/.zshrc

Step 2. Copy VIABLAB from GitHub 

Go to https://github.com/lastre-viab/VIABLAB, click on Code button and download the ZIP file VIABLAB-main.zip. 

Open FileExplorer, create the folder viablab that will contain the  program and results and unzip VIABLAB-main.zip there. 

Step 3. Build VIABLAB 

You are now ready to build VIABLAB code. 

First, go to the VIABLAB-main folder and verify the build folder is empty (create it if it doesn't exist). With the example folder shown above :

cd viablab/VIABLAB-main/

-> Evelyne : deux possibilités, j'espère que la première fonctionne, sinon, tester la seconde sil te plait en espérant qu'une des deux fonctionne :   

[1 - Then cmake command :  

cmake -S source/ -B build 

]

Si 1 ne fonctionne pas :

[2 - First, replace the CMakeLists.txt file in VIABLAB-main/source by this file CMakeLists.txt
In the new CMakeLists.txt file, replace the content below the line <## Substitute the text within the parentheses with your ... path> with your own file paths.

Then go to the build folder :

cd build

and the cmake command :

cmake -G "Unix Makefiles" -D CMAKE_BUILD_TYPE=Debug ../source

]

Note that cmake command must be executed only once, on first installation; further, only the make command below will be sufficient to build the code : 

make

Or to use all the Mac's CPUs to speed up compilation :

make -j$(sysctl -n hw.logicalcpu)

Once the compilation process finished, the executable viabLab.exe is created in build folder. 

 


Linux 
Read more 

FEDORA : 

Step 1. Installation des dépendances

  • Mettre à jour le manager de paquets apt :

sudo dnf update
  • Installer les compilateurs C/C++:   

 Pour vérifier si gcc/g++ sont installés, dans un terminal : 

gcc --version
g++ --version

Si gcc/g++ ne sont pas installés sur votre système :        

sudo dnf install gcc
sudo dnf install g++
  • Installer Cmake (version >= 3.22.1) : 

Pour vérifier si cmake est installé et connaitre sa version, dans un terminal :

cmake --version

Si ce n'est pas la bonne version , supprimer les versions existantes de CMake, dans un terminal :

sudo dnf remove cmake

Puis

sudo dnf install cmake
  • Installer git (optionnel - si on souhaite cloner la dernière version de travail du code)

sudo dnf install git
  • Installer les librairies externes open source

sudo dnf install boost-devel
sudo dnf install spdlog-devel
sudo dnf install libcurl-devel

Step 2. Copy VIABLAB from GitHub 

  • Cloner le dépôt : 

git clone https://github.com/lastre-viab/VIABLAB.git

      Open FileExplorer, create the folder dev-cpp that will contain the  program and results and unzip VIABLAB-main.zip there. 

Step 3. Build VIABLAB 

You are now ready to build VIABLAB code. 

First, go to the build folder (create it if it doesn't exist) of VIABLAB in bash (depending on your personal installation). With the example folder shown above : 

cd dev-cpp/VIABLAB-main/build/

Then cmake command : 

cmake ../source

If an error occurs during cmake, go to the build directory and completely delete its contents before restarting the cmake command.

Note that cmake command must be executed only once, on first installation; further, only the make command below will be sufficient to build the code : 

make

Once the compilation process finished, the executable viabLab is created in build folder. 

 

UBUNTU :

Step 1. Installation des dépendances

  • Mettre à jour le manager de paquets apt :

sudo apt update
  • Installer les compilateurs C/C++:   

 Pour vérifier si gcc/g++ sont installés, dans un terminal : 

gcc --version
g++ --version

Si gcc/g++ ne sont pas installés sur votre système :        

sudo apt install gcc
sudo apt install g++
  • Installer Cmake (version >= 3.22.1) : 

Pour vérifier si cmake est installé et connaitre sa version, dans un terminal :

cmake --version

Si ce n'est pas la bonne version , supprimer les versions existantes de CMake, dans un terminal :

sudo apt remove --purge cmake

Puis

sudo apt install cmake
  • Installer git (optionnel - si on souhaite cloner la dernière version de travail du code)

sudo apt install git
  • Installer les librairies externes open source

sudo apt install libboost-all-dev
sudo apt install libspdlog-dev
sudo apt install libcurl4

Step 2. Copy VIABLAB from GitHub 

  • Cloner le dépôt : 

git clone https://github.com/lastre-viab/VIABLAB.git

      Open FileExplorer, create the folder dev-cpp that will contain the  program and results and unzip VIABLAB-main.zip there. 

Step 3. Build VIABLAB 

You are now ready to build VIABLAB code. 

First, go to the build folder (create it if it doesn't exist) of VIABLAB in bash (depending on your personal installation). With the example folder shown above : 

cd dev-cpp/VIABLAB-main/build/

Then cmake command : 

cmake ../source

If an error occurs during cmake, go to the build directory and completely delete its contents before restarting the cmake command.

Note that cmake command must be executed only once, on first installation; further, only the make command below will be sufficient to build the code : 

make

Once the compilation process finished, the executable viabLab is created in build folder. 

 


WINDOWS 
Read more 

 

Step 1. Install MSYS2 

Follow instructions from https://www.msys2.org/

Download and run the installer :

Welcome to the MSYS2 Setup 

Choose the installation folder :

Installation folder

 

Follow installation steps : 

Installation steps

Wait for installation process to finish : 

Wait...

 

then click on Finish : 

Finish

Once installed, the MinGW64 bash can be launched from Windows menu :

Windows menu

MinGW64

 

Step 2. Install compiler tools and dependencies

Msys provides the package manager , called pacman, that can be used to install all necessary tools and dependencies Doc here : https://www.msys2.org/docs/package-management/

You will need to install the following packages ( you can use the commands below provided for each of them, or look for in https://packages.msys2.org/queue and choose Mingw64 binaries) : 

  • GCC: pacman -S mingw-w64-x86_64-gcc

  • CMake: pacman -S mingw-w64-x86_64-ccmake

  • Make: pacman -S mingw-w64-x86_64-make

  • Boost: pacman -S mingw-w64-x86_64-boost

  • Dlfcn: pacman -S mingw-w64-x86_64-dlfcn

  • Spdlog: pacman -S mingw-w64-x86_64-spdlog

To finish the installation, add into System Path variable the path to Mingw64 binaries C:\msys64\mingw64\bin:

Add path variable

 

After this operation you may need to restart your computer to ensure that the Path modifications are well registered. 


Step 3. Copy VIABLAB in MSyS folder 

Go to https://github.com/lastre-viab/VIABLAB, click on Code button and download the ZIP file VIABLAB-main.zip. 

By default the MSyS shell is open in /home/username folder. You can see it in FileExplorer 



 

Open this folder in FileExplorer, create the folder dev-cpp that will contain the  program and results and unzip VIABLAB-main.zip there. Example : 


Step 4. Install Eclipse (Integrated development environment) (optional)

Go to  https://www.eclipse.org/downloads/packages/release/kepler/sr2/eclipse-ide-cc-developers

Click on "download", again "download".

Once downloaded, run the installer and choose  Eclipse IDE for C/C++ developers.

Click on ‘’launch’’, and 'launch" again.

Step 5. Build VIABLAB in MSyS folder 

Go back to the MSyS MINGW64 shell . You are now ready to build VIABLAB code. 

First, go to the build folder (create it if it doesn't exist) of VIABLAB in bash (depending on your personal installation). With the example folder shown above : 

cd dev-cpp/VIABLAB-main/build/

Then cmake command : 

  • cmake -G"MinGW Makefiles" -D BUILD_LIB=OFF ../source

  • If you use Eclipse C++ IDE, you can use the cmake command below to generate Eclipse project settings and enable debugging in Eclipse :

    cmake -G"Eclipse CDT4 - MinGW Makefiles" -D CMAKE_BUILD_TYPE=Debug -D BUILD_LIB=OFF ../source

    After running CMake, the project is ready to be imported into Eclipse: the build directory (initially empty) contains the data generated by CMake.

    In Eclipse, go to the File menu => Import and select the Existing Projects into Workspace option.

    Click Next.

    Then, in the following window, select the build directory.

    Click Finish.

    After the import, you will see the project tree in the left panel.

Note that cmake command must be executed only once, on first installation; further, only the make command below will be sufficient to build the code : 

mingw32-make

Once the compilation process finished, the executable viabLab.exe is created in build folder.