Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
How to build for Linux
How to setup, build, and run tests on Linux
0. We're in apt-get! Use
sudo apt-get install libcpprest-dev to get all our development files. If your distribution has an outdated version, continue on to build from source.
1. Install Ubuntu 16.04 or later.
2. Install all the needed build tools and libraries
sudo apt-get install g++ git libboost-atomic-dev libboost-thread-dev libboost-system-dev libboost-date-time-dev libboost-regex-dev libboost-filesystem-dev libboost-random-dev libboost-chrono-dev libboost-serialization-dev libwebsocketpp-dev openssl libssl-dev ninja-build
- g++: 4.8
- libboost: 1.58
- libssl: 1.0.0
- cmake: 3.1
3. Clone the project using Git (it will be stored in the folder "casablanca"):
git clone https://github.com/Microsoft/cpprestsdk.git casablanca
Going forward, you will want to pull from the master branch, which will always contain the last known release.
4. Build the SDK in Debug mode
cd casablanca mkdir build.debug cd build.debug cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Debug ninja
You can build the Release version by specifying -DCMAKE_BUILD_TYPE=Release on the cmake line instead.
You can also build the static libraries instead of the shared libraries by adding -DBUILD_SHARED_LIBS=0 on the cmake line above.
5. After building you can run the tests by executing the test_runner inside the "Binaries" folder:
cd Release/Binaries ./test_runner *_test.so
6. To install on your system run: sudo make install
7. You can check your first program by compiling it using necessary command line arguments
g++ -std=c++11 my_file.cpp -o my_file -lboost_system -lcrypto -lssl -lcpprest ./my_file
For versions prior to 2.0, please visit Setup and Build on Linux (1.4)