Problems installing AWS C++ SDK on Cloud9 - c++

I am trying to install the AWS C++ SDK on my Cloud9 environment(m4.large). I followed the steps in this tutorial.
My steps:
sudo yum -y install libcurl-devel openssl-devel libuuid-devel cmake3
wget https://github.com/aws/aws-sdk-cpp/archive/master.zip
unzip master.zip
rm master.zip
mkdir sdk_build && cd sdk_build
cmake3 ../aws-sdk-cpp-master -DBUILD_ONLY="dynamodb" //I changed s3 to dynamodb
make && cd ..
In the file dynamodb-demo.cpp:
#include <aws/core/Aws.h>
int main(){ return 0;}
In CMakeLists.txt:
cmake_minimum_required(VERSION 2.8)
project(dynamodb-demo)
find_package(aws-sdk-cpp)
add_definitions(-DUSE_IMPORT_EXPORT)
add_executable(dynamodb-demo dynamodb-demo.cpp)
target_link_libraries(dynamodb-demo aws-cpp-sdk-dynamodb)
The problem seems to be here this command throws no errors but a Warning:
cmake3 -Daws-sdk-cpp_DIR=sdk_build .
Output:
CMake Warning at /usr/share/cmake3/Modules/CMakeFindDependencyMacro.cmake:65 (find_package):
By not providing "Findaws-c-event-stream.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"aws-c-event-stream", but CMake did not find one.
Could not find a package configuration file provided by
"aws-c-event-stream" with any of the following names:
aws-c-event-streamConfig.cmake
aws-c-event-stream-config.cmake
Add the installation prefix of "aws-c-event-stream" to CMAKE_PREFIX_PATH or
set "aws-c-event-stream_DIR" to a directory containing one of the above
files. If "aws-c-event-stream" provides a separate development package or
SDK, be sure it has been installed.
Call Stack (most recent call first):
sdk_build/aws-cpp-sdk-core/aws-cpp-sdk-core-config.cmake:2 (find_dependency)
sdk_build/aws-sdk-cpp-config.cmake:1 (include)
CMakeLists.txt:14 (find_package)
CMake Warning at CMakeLists.txt:14 (find_package):
Found package configuration file:
/home/ec2-user/environment/sdk_build/aws-sdk-cpp-config.cmake
but it set aws-sdk-cpp_FOUND to FALSE so package "aws-sdk-cpp" is
considered to be NOT FOUND. Reason given by package:
aws-sdk-cpp could not be found because dependency aws-c-event-stream could
not be found.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ec2-user/environment
Therefore the make command throws fatal error: aws/core/Aws.h: No such file or directory, which i understand so i guess the mistake should be in the command above.
I haven't configured my AWS credentials yet, but i don't think this would throw those kind of erros. The problem seems to be related with cmake.
Some research showed, that aws-c-event-stream-config.cmake should be located at /home/ec2-user/environment/sdk_build/.deps/install/lib64/aws-c-event-stream/cmake which it is.
Maybe the solution is very simple, but I have only basic knowledge about cmake.

With Tsyvarev's help the project configures:
cmake3 -DCMAKE_PREFIX_PATH=/home/ec2-user/environment/sdk_build/.deps/install/lib64/aws-checksums/cmake\;/home/ec2-user/environment/sdk_build/.deps/install/lib64/aws-c-common/cmake\;/home/ec2-user/environment/sdk_build/.deps/install/lib64/aws-c-event-stream/cmake\;/home/ec2-user/environment/sdk_build .
Things i needed to change as well:
Build the AWS core (not sure if necessary):
cmake3 ../aws-sdk-cpp-master -DBUILD_ONLY="core;dynamodb"
Add this to your CMakeLists.txt:
target_link_libraries(dynamodb-demo aws-cpp-sdk-core)
And set the standard to C++ 11:
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

Related

How to install V2X-Hub on Ubuntu 18.04

I am trying to install V2X-Hub following those steps : https://github.com/usdot-fhwa-OPS/V2X-Hub/blob/develop/docs/installation_and_Setup.md
I did the compilation instructions until this one :
« Now, run the following commands from V2X-Hub directory
cd src/v2i-hub
cmake . -DqserverPedestrian_DIR=/usr/local/share/qserverPedestrian/cmake »
And it tells me :
« Cmake Error at CARMACloudPlugin/CMakeLists.txt:10 (find package):
By not providing «Findv2xhubWebAPI.cmake » in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by « v2xhubWebAPI », but Cmake did not find one.
Could not find a package configuration file provided by « v2xhubWebAPI » with any of the following names:
v2xhubWebAPIConfig.cmake
v2xhubwebapi-config.cmake
Add the installation prefix of « v2xhubWebAPI » to CMAKE_PREFIX_PATH or set « v2xhubWebAPI_DIR » to a directory containing one of the above files. If « v2xhubWebAPI » provides a separate development package or SDK, be sure it has been installed. »
Thanking you in advance for your help i am blocked.

OpenSpliceConfig.cmake or opensplice-config.cmake not found while building dds-tutorial-cpp-ex

I am trying to learn dds. According to the tutorial, Appendix 1 suggests to look at examples on provided in github called dds-examples-cpp-ex.
The simple commands to build this examples according to readme is cmake . && make
I execute the command
cmake . && make
from the cmake directory of this folder after cloning it on my local machine
I get the following error:
CMake Error at CMakeLists.txt:28 (FIND_PACKAGE):
By not providing "FindOpenSplice.cmake" in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
"OpenSplice", but CMake did not find one.
Could not find a package configuration file provided by "OpenSplice" with
any of the following names:
OpenSpliceConfig.cmake
opensplice-config.cmake
Add the installation prefix of "OpenSplice" to CMAKE_PREFIX_PATH or set
"OpenSplice_DIR" to a directory containing one of the above files. If
"OpenSplice" provides a separate development package or SDK, be sure it has
been installed.
-- Configuring incomplete, errors occurred!
See also "/home/gajendra/Documents/AnokhiDocs/DDS/dds-tutorial-cpp-ex/cmake/CMakeFiles/CMakeOutput.log".
I tried to locate OpenSpliceConfig.cmake && opensplice-config.cmake on my system but I did not get any result.
My question is how can I correct the paths or fix this error?
I have OpenSplice running on my local machine and I have executed other examples directly from $OSPL_HOME/opensplice/dcps/Tutorial. and they work fine.
I also tried to build ch1. I edited the second line in ch1/CMakeLists.txt from
set(CMAKE_MODULE_PATH ../cmake)
to
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
so that it can find cmake folder in the root directory where CMakeLists.txt resides.
I run into the same problem when I execute the following:
cd ch1 && mkdir build && cd build && cmake ..
CMake Error at /home/gajendra/Documents/AnokhiDocs/DDS/dds-tutorial-cpp-ex/cmake/FindOpenSplice.cmake:72 (MESSAGE):Could not find OpenSplice DDS
Call Stack (most recent call first):
CMakeLists.txt:8 (find_package)
I had the same problem on Ubuntu 20.04 and OpenSplice 6.10.3p1
I just sourced the release.com file in the installation directory, then went to each "ch" folder as suggested by #Tsyvarev and ran cmake . && make from there.
CMake ran successfully afterwards.

How to compile and run a hello world JUCE program?

I cloned https://github.com/juce-framework/JUCE
I first uncommented find_package(JUCE) in /GuiApp' CMakeList.txt.
Then I ran cmake .. . -B cmake-build-dir -D JUCE_BUILD_EXAMPLES=ON
on the top level directory.
It says:
-- Checking for modules 'webkit2gtk-4.0;gtk+-x11-3.0'
-- No package 'webkit2gtk-4.0' found
-- No package 'gtk+-x11-3.0' found
-- Checking for module 'alsa'
-- No package 'alsa' found
-- Configuring juceaide
-- Building juceaide
-- Exporting juceaide
CMake Error at examples/CMake/GuiApp/CMakeLists.txt:27 (find_package):
Could not find a package configuration file provided by "JUCE" with any of
the following names:
JUCEConfig.cmake
juce-config.cmake
Add the installation prefix of "JUCE" to CMAKE_PREFIX_PATH or set
"JUCE_DIR" to a directory containing one of the above files. If "JUCE"
provides a separate development package or SDK, be sure it has been
installed.
-- Configuring incomplete, errors occurred!
I tried to find where is JUCEConfig.cmake
/work/juce/temp/JUCE/build$ find . -name JUCEConfig.cmake
./cmake-build-dir/tools/JUCEConfig.cmake
How am I supposed to put this path in CMAKE_PREFIX_PATHS?
Clone this repository: https://github.com/juce-framework/JUCE
alsa and webkit2gtk are required dependencies which were absent on Ubuntu 18.04 in my computer. You too may have to install as follows:
sudo apt install libwebkit2gtk-4.0-dev libasound2-dev
In the examples/CMake folder in this repository there is a folder called GuiApp.
To build a new GUI App project with JUCE/CMake, do this (starting from scratch):
Copy the GuiApp folder to a new location.
In the GuiApp's CMakeLists.txt that you copied, replace the
add_subdirectory(JUCE)
with
add_subdirectory("<path_to_JUCE_cloned_repository>" JUCE)
replacing the path with the real location of the JUCE repository on your system.
From the GuiApp folder that you copied, run
cmake . -B cmake-build-dir
Above command will create a build tree folder named cmake-build-dir
cmake --build cmake-build-dir
Above command will build all targets in the cmake-build-dir folder.
After successful build, you can run the executable by going in directory:
cmake-build-dir/GuiAppExample_artefacts/
and issuing ./Gui\ App\ Example. That's the name of the resultant default executable.
Credit: https://forum.juce.com/u/reuk/summary

Link SDL2_net with CMake

I'm trying to link SDL2_net (SDL_net 2.0) to my project via CMake, but after searching around I've yet to find a solution. My CMakeLists.txt currently looks like this:
1 cmake_minimum_required (VERSION 3.7)
2 project (SDL_net_test)
3 include (FindPkgConfig)
4 include (FindSDL_net)
5
6 pkg_search_module (SDL2 REQUIRED sdl2)
7 pkg_search_module (SDL_NET REQUIRED sdl2_net)
8
9 include_directories (${SDL2_INCLUDE_DIRS} ${SDL_NET_INCLUDE_DIRS})
10
11 add_executable (SDL_net_test main.cpp)
12 target_link_libraries (SDL_net_test ${SDL2_LIBRARIES} ${SDL_NET_LIBRARIES})
However, when I attempt to run CMake it gives me the following error(s):
-- Could NOT find SDL_net (missing: SDL_NET_LIBRARIES SDL_NET_INCLUDE_DIRS)
-- Checking for one of the modules 'sdl2_net'
CMake Error at /usr/share/cmake/Modules/FindPkgConfig.cmake:659 (message):
None of the required 'sdl2_net' found
Call Stack (most recent call first):
CMakeLists.txt:7 (pkg_search_module)
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
SDL_NET_INCLUDE_DIR (ADVANCED)
used as include directory in directory /home/neboula/Programming/sandbox/sdl2_net
used as include directory in directory /home/neboula/Programming/sandbox/sdl2_net
used as include directory in directory /home/neboula/Programming/sandbox/sdl2_net
SDL_NET_LIBRARY (ADVANCED)
linked by target "SDL_net_test" in directory /home/neboula/Programming/sandbox/sdl2_net
-- Configuring incomplete, errors occurred!
See also "/home/neboula/Programming/sandbox/sdl2_net/build/CMakeFiles/CMakeOutput.log".
I have installed the SDL2_net-devel package from my package manager (dnf on Fedora 29), and I've successfully linked SDL2 and SDL2_image previously basing it on this answer, which worked brilliantly. I also found this, but I'm not entirely sure how to use it. How should I go about this?
Since the person who provided an answer only posted a comment about it, I'll put it down here myself.
The solution was seemingly very simple: I had written pkg_search_module (SDL_NET REQUIRED sdl2_net), while it was supposed to be pkg_search_module (SDL_NET REQUIRED SDL2_net).
To easily integrate the SDL2 library and other related libraries (SDL2_net, SDL2_mixer, ...), I developed modern cross-platform CMake modules that can be used as follows:
Clone SDL2 CMake modules inside our project:
git clone https://github.com/aminosbh/sdl2-cmake-modules cmake/sdl2
Add the following lines in your main CMakeLists.txt
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/sdl2)
find_package(SDL2 REQUIRED)
find_package(SDL2_net REQUIRED)
target_link_libraries(${PROJECT_NAME} SDL2::Main SDL2:Net)
You can even specify a custom path to find the SDL2, SDL2_net, ... useful specially on Windows.
cmake .. -DSDL2_PATH="/path/to/sdl2" -DSDL2_NET_PATH="/path/to/sdl2-net"
For sure, you should not forgot to install the specific packages:
# Fedora/RPM
sudo yum install SDL2-devel SDL2_net-devel
# Debian/Ubuntu
sudo apt install libsdl2-dev libsdl2-net-dev

CMake is not able to find BOOST libraries

I tried everything like:
Configure environment variable
Make fresh build
Re-install BOOST from source
sudo apt-get install libboost-all-dev
But still getting following Errors:
CMake Error at /usr/share/cmake-2.8/Modules/FindBoost.cmake:1131 (message):
Unable to find the requested Boost libraries.
Unable to find the Boost header files. Please set BOOST_ROOT to the root
directory containing Boost or BOOST_INCLUDEDIR to the directory containing
Boost's headers.
Call Stack (most recent call first):
CMakeLists.txt:147 (find_package)
CMake Error at /usr/share/cmake-2.8/Modules/FindBoost.cmake:1131 (message):
Unable to find the requested Boost libraries.
Unable to find the Boost header files. Please set BOOST_ROOT to the root
directory containing Boost or BOOST_INCLUDEDIR to the directory containing
Boost's headers.
Source code directory for boost: /usr/local/src/boost_1_45_0
Boost Library path: /usr/local/lib
Boost Header file: /usr/local/include/boost
Here is bashrc file:
BOOST_ROOT="/usr/local/src/boost_1_45_0"
Boost_LIBRARY_DIRS="/usr/local/lib"
BOOST_INCLUDEDIR="/usr/local/src/boost_1_45_0"
How to solve these Errors? Am i missing something?
Edit:
cmake -DCMAKE_TOOLCHAIN_FILE=$ANDTOOLCHAIN -DBOOST_ROOT=/usr/local/src/boost_1_45_0 -DBOOST_INCLUDEDIR=/usr/local/include/boost -DBOOST_LIBRARYDIR=/usr/local/lib -DPYTHON_LIBRARIES=/usr/local/lib/python2.7 -DPYTHON_INCLUDE_DIRS=/usr/include/python2.7 -DCMA-DRDK_BUILD_PYTHON_WRAPPERS=
Try to complete cmake process with following libs:
sudo apt-get install cmake libblkid-dev e2fslibs-dev libboost-all-dev libaudit-dev
I'm using this to set up boost from cmake in my CMakeLists.txt. Try something similar (make sure to update paths to your installation of boost).
SET (BOOST_ROOT "/opt/boost/boost_1_57_0")
SET (BOOST_INCLUDEDIR "/opt/boost/boost-1.57.0/include")
SET (BOOST_LIBRARYDIR "/opt/boost/boost-1.57.0/lib")
SET (BOOST_MIN_VERSION "1.55.0")
set (Boost_NO_BOOST_CMAKE ON)
FIND_PACKAGE(Boost ${BOOST_MIN_VERSION} REQUIRED)
if (NOT Boost_FOUND)
message(FATAL_ERROR "Fatal error: Boost (version >= 1.55) required.")
else()
message(STATUS "Setting up BOOST")
message(STATUS " Includes - ${Boost_INCLUDE_DIRS}")
message(STATUS " Library - ${Boost_LIBRARY_DIRS}")
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
endif (NOT Boost_FOUND)
This will either search default paths (/usr, /usr/local) or the path provided through the cmake variables (BOOST_ROOT, BOOST_INCLUDEDIR, BOOST_LIBRARYDIR). It works for me on cmake > 2.6.
I got the same error the first time I wanted to install LightGBM on python (GPU version).
You can simply fix it with this command line :
sudo apt-get install cmake libblkid-dev e2fslibs-dev libboost-all-dev libaudit-dev
the boost libraries will be installed and you'll be fine to continue your installation process.
seems the answer is in the comments and as an edit but to clarify this should work for you:
export BUILDDIR='your path to build directory here'
export SRCDIR='your path to source dir here'
export BOOST_ROOT="/opt/boost/boost_1_57_0"
export BOOST_INCLUDE="/opt/boost/boost-1.57.0/include"
export BOOST_LIBDIR="/opt/boost/boost-1.57.0/lib"
export BOOST_OPTS="-DBOOST_ROOT=${BOOST_ROOT} -DBOOST_INCLUDEDIR=${BOOST_INCLUDE} -DBOOST_LIBRARYDIR=${BOOST_LIBDIR}"
(cd ${BUILDDIR} && cmake ${BOOST_OPTS} ${SRCDIR})
you need to specify the arguments as command line arguments or you can use a toolchain file for that, but cmake will not touch your environment variables.
I just want to point out that the FindBoost macro might be looking for an earlier version, for instance, 1.58.0 when you might have 1.60.0 installed. I suggest popping open the FindBoost macro from whatever it is you are attempting to build, and checking if that's the case. You can simply edit it to include your particular version. (This was my problem.)
Thanks Paul-g for your advise. For my part it was a bit different.
I installed Boost by following the Step 5 of : https://www.boost.org/doc/libs/1_59_0/more/getting_started/unix-variants.html
And then I add PATH directory in the "FindBoos.cmake", located in /usr/local/share/cmake-3.5/Modules :
SET (BOOST_ROOT "../boost_1_60_0")
SET (BOOST_INCLUDEDIR "../boost_1_60_0/boost")
SET (BOOST_LIBRARYDIR "../boost_1_60_0/libs")
SET (BOOST_MIN_VERSION "1.55.0")
set (Boost_NO_BOOST_CMAKE ON)
Long answer to short, if you install boost in custom path, all header files must in ${path}/boost/.
if you want to konw why cmake can't find the requested Boost libraries after you have set BOOST_ROOT/BOOST_INCLUDEDIR, you can check cmake install location path_to_cmake/share/cmake-xxx/Modules/FindBoost.
cmake which will find Boost_INCLUDE_DIR in boost/config.hpp in BOOST_ROOT. That means your boost header file must in ${path}/boost/, any other format (such as ${path}/boost-x.y.z) will not be suitable for find_package in CMakeLists.txt.
I had the same issue inside an alpine docker container, my solution was to add the boost-dev apk library because libboost-dev was not available.