Skip to content

Instantly share code, notes, and snippets.

@coin8086
Last active March 8, 2023 10:13
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coin8086/488580e650a552bdfbd0f858c193a26e to your computer and use it in GitHub Desktop.
Save coin8086/488580e650a552bdfbd0f858c193a26e to your computer and use it in GitHub Desktop.
Compile CppREST on CentOS 7

Compile C++ REST SDK on CentOS 7

C++ REST SDK is built on Ubuntu 16 by the offical document. To build it on CentOS 7, here's how.

Prerequisites:

  1. Install build tools by sudo yum group install Development\ Tools
  2. Install dependent libraries by sudo yum install zlib-devel libicu-devel openssl-devel
  3. Get CMake 3.x binary from https://cmake.org/download/
  4. Get Boost 1.58 source code from https://www.boost.org/users/history/ and install it under /opt/boost_1_58_0 by https://www.boost.org/doc/libs/1_58_0/more/getting_started/unix-variants.html#easy-build-and-install.

CMake and Boost packages for CentOS are not used here because their versions are too old.

Building C++ REST SDK

  1. Get source code into a directory, name it casablanca. You can get it from official repo or a forked one.
  2. export BOOST_ROOT=/opt/boost_1_58_0
  3. Make sure casablanca/Release/CMakeLists.txt contains a WERROR option. If yes, do cmake .. -DCMAKE_BUILD_TYPE=Release -DWERROR=OFF under casablanca/Release/build.release. Otherwise, remove -Werror from casablanca/Release/src/CMakeLists.txt and do cmake .. -DCMAKE_BUILD_TYPE=Release, under casablanca/Release/build.release.
  4. make under casablanca/Release/build.release

Reference microsoft/cpprestsdk#682 and https://github.com/Microsoft/cpprestsdk/wiki/How-to-build-for-Linux

@mohakkataria007
Copy link

can you tell which file are you targetting for the make command. make command requires the target

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