Skip to content

Steps for compiling COBS on server with old GCC/C++/C compiler #16

Description

@shenwei356

I spent two hours finguring out how to compile cobs on our server (CentOS 7.9 with gcc 4.8.5) using conda. May this helps.

  1. Create conda env and install new gcc/cc/c++ compilers

     # conda env remove -n cobs
    
     conda create -n cobs cmake
    
     conda activate cobs
    
     # mamba is faster for installing packages
     conda install -y mamba
     
     mamba install -c conda-forge -y gcc_impl_linux-64 c-compiler cxx-compiler zlib
    
  2. Link binaries and some libs

     # gcc binary
     cd /home/shenwei/app/miniconda3/envs/cobs/bin; 
     ln -s ../libexec/gcc/x86_64-conda-linux-gnu/9.3.0/gcc
     
     # cobs uses old boost version which relies on libboost_**-mt.a
     cd /home/shenwei/app/miniconda3/envs/cobs/lib
     ln -s libboost_system.a libboost_system-mt.a
     ln -s libboost_filesystem.a libboost_filesystem-mt.a
    
  3. Edit envinronment, add few lines to ~/.bashrc.

     # vim ~/.bashrc
     export LD_LIBRARY_PATH=$app/miniconda3/envs/cobs/lib:$LD_LIBRARY_PATH
     export C_INCLUDE_PATH=$app/miniconda3/envs/cobs/include
     export CPLUS_INCLUDE_PATH=$app/miniconda3/envs/cobs/include
    
  4. Reactivate envonment

     conda deactivate
     
     conda activate cobs    
    
  5. Compile cobs

     git clone --recursive https://github.com/bingmann/cobs.git
     mkdir cobs/build
     cd cobs/build
     cmake ..
     make -j4
     
     # copy binary to somewhere in $PATH
     cp src/cobs ~/bin/
    

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions