AWS IoT C++ SDK
Loading...
Searching...
No Matches
Overview

This file contains instructions for installing dependencies on different platforms. If you have all the prerequisites specified in the README file, you could simply skip following instructions.

Common Issues

  • Known Issues
    • If you run into error like "Unknown extension ".c" for file /XXX/CheckIncludeFiles.c try_compile() works only for enabled languages. Currently these are: CXX</tt>, you need to change <tt>project(aws-iot-sdk-cpp CXX)</tt> to <tt>project(aws-iot-sdk-cpp C CXX)</tt> and add <tt>ENABLE_LANGUAGE(C)</tt> below it. @subsection autotoc_md56 Raspberry Pi * Make sure to have CMake installed <a href="https://cmake.org/install/" >CMake Installation</a> * There is a reference for installing gcc-6 and g++-6 on raspberry pi. It also works for gcc-5/g++5 by replacing version number to 5. <a href="https://solarianprogrammer.com/2016/06/24/raspberry-pi-raspbian-install-gcc-compile-cpp-14-and-cpp-17-programs/" >GCC-6 Installation</a> * You could create symlinks to choose which version of gcc/g++ to use <a href="https://linux.die.net/man/8/update-alternatives" >update-alternatives</a>. Assuming both gcc-5 and gcc-6 installed, the following commands will maintain symbolic links of both versions. In this case, gcc-5/g++-5 has higher priority (20) than gcc-6/g++-6 (10), which means the alternatives will point to gcc-5/g++-5 in automatic mode. You could change the priority based on your needs. <tt>sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 20</tt> <tt>sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 10</tt> <tt>sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 20</tt> <tt>sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-6 10</tt> <tt>sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30</tt> <tt>sudo update-alternatives --set cc /usr/bin/gcc</tt> <tt>sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30</tt> <tt>sudo update-alternatives --set c++ /usr/bin/g++</tt> <tt>sudo update-alternatives --config gcc</tt> <tt>sudo update-alternatives --config g++</tt> * Install Openssl 1.1.0. Linux From Scratch has good guides on installing versions of OpenSSL from source. * Build libssl-dev 1.1.0 or above. @subsection autotoc_md57 Mac OS * Install Homebrew if it's not installed <tt>\$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"</tt> * Install CMake * You can build from source <a href="https://cmake.org/install/" >CMake Installation</a> or * Install directly using <tt>brew install cmake</tt> * If you use the .dmg installer, the following instructions are used to add the CMake path into $PATH after installation: * <tt>sudo vim /etc/paths</tt> * Add the following line to the paths already present <tt>/Applications/CMake.app/Contents/bin</tt> * save and quit * In a new terminal window, run <tt>echo \$PATH</tt>. The path for CMake should be displayed, along with the other paths. * With Mac OS, the default version of OpenSSL is not 1.1.0 and cannot be used with the SDK. Instead, version 1.1.0 needs to be installed. To install OpenSSL 1.1.0: * Update brew <tt>brew update \&\& brew upgrade</tt> * Run <tt>brew info openssl</tt> to list the versions of openssl available Example output: `openssl: stable 1.0.2l (bottled) [keg-only] SSL/TLS cryptography library https://openssl.org/ /usr/local/Cellar/openssl/1.0.2k (1,696 files, 12MB) Poured from bottle on 2017-02-03 at 14:20:40 /usr/local/Cellar/openssl/1.0.2l (1,709 files, 12.1MB) Poured from bottle on 2017-05-31 at 15:32:30` Use the latest stable 1.0.2 version available, which is 1.0.2l here <br> * Run <tt>brew switch openssl\@\<latest stable 1.1 version\></tt>. If the version is already installed, the path for this version of OpenSSL will be displayed. Example output: <tt>Cleaning /usr/local/Cellar/openssl/1.0.2l Opt link created for /usr/local/Cellar/openssl\@1.1/1.1.1m</tt> Use the path (<tt>/usr/local/Cellar/openssl\@1.1/1.1.1m</tt> in the example above) in your <BASE_SDK_DIRECTORY>/network/CMakeLists.txt * If not installed, run <tt>brew install openssl --force</tt> after the switch operation. The path will be displayed at the end of the installation. After that follow the below steps. * Open <BASE_SDK_DIRECTORY>/network/CMakelists.txt.in * Comment out the below line in default OpenSSL section by adding # in front of it <tt>\#find_package(OpenSSL REQUIRED)</tt> * Add following two lines below the line commented out in default OpenSSL section. Replace "YOUR_OPENSSL_PATH" with the path obtained from the <tt>brew switch</tt> or <tt>brew install</tt> command <tt>set(OPENSSL_LIBRARIES "YOUR_OPENSSL_PATH/lib/libssl.a;YOUR_OPENSSL_PATH/lib/libcrypto.a")</tt> <tt>set(OPENSSL_INCLUDE_DIR "YOUR_OPENSSL_PATH/include")</tt> <br> @subsection autotoc_md58 Windows * Both the Websocket and OpenSSL builds work on windows. The latest version of OpenSSL 1.1.0 needs to be installed for them to work properly. * Download and install the latest version of OpenSSL 1.1.0 from <a href="https://slproweb.com/products/Win32OpenSSL.html" >this link</a> * Download and install CMake for Windows from <a href="https://cmake.org/download/" >this link</a> * Download and install git from <a href="https://git-scm.com/downloads" >this link</a>. Please be sure to install git bash as well. * Open the Git Bash terminal and navigate to the folder where you want the SDK to be downloaded. * Clone the repository in this folder. Once finished, change directory to the downloaded repo. * Create a <tt>build</tt> folder. Change directory to the build folder. * Run the following command: <tt>\<absolute path to cmake install directory\>/bin/cmake -G "Visual Studio 14 2015 Win64" ../.</tt> * The above command will generate a Visual studio solution file called <tt>aws-iot-sdk-cpp</tt>. Open this file in VS2015. * The list of available targets will show up in the solution explorer. * Before running available targets, be sure to change the working directory of the project to Output directory. * There are known issues with the Windows Build currently. Please check the <a href="https://github.com/aws/aws-iot-device-sdk-cpp/blob/master/KnownIssues.md" >Known Issues</a> file for more information. @subsection autotoc_md59 Ubuntu 14.04 * Install CMake <a href="https://cmake.org/install/" >CMake Installation
  • To update to OpenSSL 1.1.0
    • sudo apt-get install make (if not already installed)
    • wget https://www.openssl.org/source/openssl-1.1.0.tar.gz
    • tar -xzvf openssl-1.1.0g.tar.gz
    • cd openssl-1.1.0g
    • sudo ./config
    • sudo make install
    • sudo ln -sf /usr/local/ssl/bin/openssl <which openssl>
    • openssl version -v (should show correct version of OpenSSL)
  • To install libssl-dev