Skip to content

Document new setup for Ubuntu 16.04 LTS #195

Closed

Description

@FourTwoOmega

This took me a long time to figure out, and I didn't know where else to dump this knowledge, so here goes.

Some of the information on the Installing C++ page is no longer applicable, at least to Ubuntu 16.04 LTS. I found rumblings and bits and pieces around the Internet, and filled in a bunch of gaps, and this is the result.

  1. Install Exercism per the Getting Started page.
  2. Install GCC and CMake as per the Installing C++ page.
  3. Install a package called libboost-all-dev:
    sudo apt-get install libboost-all-dev
  4. Install Boost 1.59. Install exactly this version and not a later one as implied on the Installing C++ page as both earlier and later versions will not work with CMake 3.5.1. The Samuel Bachmann PPA mentioned on the Installing C++ page (and the associated commands) will not work for Xenial Xerus (16.04 LTS) because it was never updated to, so download the source from Boost's Download page for Boost 1.59.
  5. Extract the tar archive containing Boost 1.59
    tar -xf boost_1_59_0.tar.gz
    -- OR --
    tar --bzip2 -xf boost_1_59_0.tar.bz2
  6. Move the extracted directory to /usr/local:
    sudo mv boost_1_59_0/ /usr/local/
  7. Open your shell config file; for example, if you're running Bash (the default in Ubuntu 16.04 LTS), you might open your .bashrc file in an editor like Text Editor:
    gedit ~/.bashrc
  8. Add these lines at the end of your config (still assuming Bash here) to let CMake know where your Boost installation is (though not sure if $BOOST_LIBRARYDIR is necessary):
# Boost (for CMake and Exercism)
export BOOST_ROOT="/usr/local/boost_1_59_0"
export BOOST_LIBRARYDIR="$BOOST_ROOT/boost"
  1. Reload your shell config file (assuming Bash, yet again):
    source ~/.bashrc
  2. Navigate to your Boost directory:
    cd $BOOST_ROOT
  3. Run the bootstrap.sh script:
    ./bootstrap.sh
  4. Run the b2.sh script (my machine is old, but it took about 30 minutes to complete for me):
    /.b2.sh
  5. Assuming you have not already done so, navigate to the folder you're keeping Exercism's CPP exercises in and download the first exercise:
    exercism download --exercise=hello-world --track=cpp
  6. If you have not already done so, create the exercise's files as per the Running the Tests page.
  7. If you have not already done this, either, use CMake to create the Unix Makefiles (include the quotes):
    cmake -G "Unix Makefiles"
    If you already attempted this once, delete these files from your exercise's folder:
CMakeFiles/
cmake_insall.cmake
CMakeCache.txt
  1. Once you have completed the exercise and want to build, simply run the make command:
    make
    There will be a lot of warnings, but if you did the exercise properly, the project will build successfully, and the output will end like this:
[ 66%] Building CXX object CMakeFiles/hello-world.dir/hello_world.cpp.o
[100%] Linking CXX executable hello-world
Running 1 test case...

*** No errors detected
[100%] Built target hello-world

I know lots of people were having issues with newer versions of Visual Studio and Windows 10, as well, so I hope this helps you at least find a direction to go in.

Activity

  1. radix-r commented on Aug 15, 2018

    @radix-r

    I think for your step 12 you need to run:
    ./b2 install
    At least that is what I had to do on my machine.

  2. arcuru commented on Apr 20, 2019

    @arcuru
    Contributor

    We've removed our dependency on Boost, see #233. The setup now is much simpler. Closing this.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions