AMQP-CPP RabbitMQ Build Integrating to CPP Project - c++

Hi I currently try to integrate RabbitMQ via AMQPCPP into my VisualStudio Project. I am restricted to use a Windows PC which is a pain in the ass for the installation.
I think I was able to build the Project using CMAKE But I received some Error doing it . Now I am trying to include the build into the VS2017 Project. In the Readme https://github.com/CopernicaMarketingSoftware/AMQP-CPP this is done using
#include <amqpcpp.h>
But this header is not found in my build. I am not used to CPP so I hope I havent done some rudimental error. Thanks in advance!

Steps to build AMQP-CPP using CMake in Windows - Visual Studio 2017
Open command prompt and switch to AMQP-CPP git/source path.
1) >mkdir build
2) >cd build
3) >cmake -G "Visual Studio 15 2017 Win64" ..\
-- Selecting Windows SDK version 10.0.15063.0 to target Windows 6.1.7601.
-- The C compiler identification is MSVC 19.10.25019.0
-- The CXX compiler identification is MSVC 19.10.25019.0
-- Check for working C compiler: E:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.10.25017/bin/HostX86/x64/cl.exe
-- Check for working C compiler: E:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.10.25017/bin/HostX86/x64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: E:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.10.25017/bin/HostX86/x64/cl.exe
-- Check for working CXX compiler: E:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.10.25017/bin/HostX86/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: D:/Projects/AMQP-CPP/build
4) >cmake --build . --target ALL_BUILD --config RELEASE --clean-first -- /m
Build succeeded.
"D:\Projects\AMQP-CPP\build\ALL_BUILD.vcxproj" (default target) (1) -> "D:\Projects\AMQP-CPP\build\amqpcpp.vcxproj" (default target) (3) -> (ClCompile target) ->
D:\Projects\AMQP-CPP\src\deferredreceiver.cpp(48): warning C424
4: 'argument': conversion from 'uint64_t' to 'uint32_t', possible loss o
f data [D:\Projects\AMQP-CPP\build\amqpcpp.vcxproj]
1 Warning(s)
0 Error(s)
Time Elapsed 00:00:44.16
How to include amqpcpp in your project
Edit your project CMakeLists.txt file for adding amqpcpp include path and library path for linking.
include_directories(../include)
link_directories(../build/bin/Release)
Include and link directory path may differ based on actual location in your machine.

Related

Qt Cmake error compilation "GuiSupportQt not found"

I'm new to Qt and i already have a problem so i start to create a simple UI for my VTK project, first of all, i tested a sample project UI designed by Qt in Qt 5.5.0 and compiled in Cmake 3.10 and VS2013 programmed with C++, and i've got a line after compiling with Cmake before "Configuration done" saying that"GuiSupportQt not found." i ignored it and generated solution then i gone to VS2013 to compile the solution provided by Cmake , i didn't find my project after opening solution in VS2013, i found only the common 2 projects that are named ALL_BUILD and ZERO_CHECK.
For more info, i've compiled before a non Gui project (3d vtk visualisation with vtk rendered without Qt) which is my own homework project and i've got a successful results which means in my opinion that the problem appears exactly when i compile a project that uses Qt considering that my Qt-VTK are compiled before with Cmake and built with VS2013 without any errors.
This is the code of Qt project sample that i used to test :
https://vtk.org/Wiki/VTK/Examples/Cxx/Qt/RenderWindowUISingleInheritance
This is what i get when i try to compile it with Cmake :
The C compiler identification is MSVC 18.0.21005.1
The CXX compiler identification is MSVC 18.0.21005.1
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
VTK_VERSION: 7.1.1
GuiSupportQt not found.
Configuring done
Generating done
After looking a while i found out another tricky solution to evade problems since i had Vtk visualisation part work fine and i work on windows, so i just sent parameters via command in cmd using Qt gui and then Vtk project compiled exe file will take parameters in execution (iso-value,data folder name..ect) in argv[] array then launch it in a new window, so i didn't have to compile Qt project with Cmake.

CMake build Tensorflow C++ on Windows 10 Error : Test COMPILER_OPT_ARCH_NATIVE_SUPPORTED - failed

I want to build Tensorflow C++ on Windows 10 using CMake. However I cannot pass the COMPILER_OPT_ARCH_NATIVE_SUPPORTED test, which resulting in failed building attempts. Here is my open issue on tf github repo: https://github.com/tensorflow/tensorflow/issues/24076, which has received no response thus why I am asking on stackoverflow and hopefully someone here can enlighten me. I am running out of ideas now. I have tried Python 3.5 and 3.6, visual studio 2017 and 2015. All with no success.
System information
OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10
TensorFlow installed from (source or binary): source
TensorFlow version: the latest version
Python version: 3.6
Bazel version (if compiling from source): I am using CMake
GCC/Compiler version (if compiling from source): gcc 6.30
CUDA/cuDNN version: Installing only the CPU version
I am also using Microsoft Visual Studio Community 2017 Version 15.9.3, btw
Describe the problem
I am following the "Step by step Windows Build" from https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/cmake. However, at step 3, I can't seem to pass Performing Test COMPILER_OPT_ARCH_NATIVE_SUPPORTED, which resulting failed building process.
Provide the exact sequence of commands / steps that you executed before running into the problem
PS C:\Users\bw\tensorflow\tensorflow\contrib\cmake\build> cmake .. -A x64 -Thost=x64 -DCMAKE_BUILD_TYPE=Release `
>> -DSWIG_EXECUTABLE='C:\Program Files\swigwin-3.0.12\swig.exe' `
>> -DPYTHON_EXECUTABLE='C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\python.exe' `
>> -DPYTHON_LIBRARIES='C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\libs\python36.lib'
-- Building for: Visual Studio 15 2017
CMake Warning at CMakeLists.txt:9 (message):
Your current cmake generator is set to use 32 bit toolset architecture.
This may cause "compiler out of heap space" errors when building. Consider
using the flag -Thost=x64 when running cmake.
-- The C compiler identification is MSVC 19.16.27024.1
-- The CXX compiler identification is MSVC 19.16.27024.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test COMPILER_OPT_ARCH_NATIVE_SUPPORTED
-- Performing Test COMPILER_OPT_ARCH_NATIVE_SUPPORTED - Failed
-- Performing Test MSVC_OPENMP_SUPPORT
-- Performing Test MSVC_OPENMP_SUPPORT - Success
-- Found PythonInterp: C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/python.exe (found version "3.6.7")
-- Found PythonLibs: optimized;C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/libs/python36.lib;debug;C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/libs/python36_d.lib (found version "3.6.7")
-- Found SWIG: C:/Program Files/swigwin-3.0.12/swig.exe (found version "3.0.12")
CMake Error at tf_python.cmake:811 (string):
string sub-command REPLACE requires at least four arguments.
Call Stack (most recent call first):
CMakeLists.txt:583 (include)
CMake Error at tf_python.cmake:812 (string):
string sub-command REPLACE requires at least four arguments.
Call Stack (most recent call first):
CMakeLists.txt:583 (include)
CMake Error at tf_python.cmake:813 (string):
string sub-command REPLACE requires at least four arguments.
Call Stack (most recent call first):
CMakeLists.txt:583 (include)
-- Configuring incomplete, errors occurred!
See also "C:/Users/bw/tensorflow/tensorflow/contrib/cmake/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/bw/tensorflow/tensorflow/contrib/cmake/build/CMakeFiles/CMakeError.log".
Any other info / logs
CMakeOutput.log: https://www.dropbox.com/s/7fweyunxdbmxa1k/CMakeOutput.log?dl=0
CMakeError.log: https://www.dropbox.com/s/tucx0tl6346kdpd/CMakeError.log?dl=0
The first line of the guide states:
CMAKE build is deprecated for TensorFlow. Please use bazel to build TF for all platforms. For details, see the TensorFlow install guide.
Apparently you need to use a release version that is known to build correctly via CMAKE on Windows. Probably should switch to the recommended build system if you want to build the latest code.
Looking at the CMakeLists.txt file for this project shows that Performing Test COMPILER_OPT_ARCH_NATIVE_SUPPORTED - Failed is the step where it checks if the compiler accepts the -march=native flag. It doesn't, see this fix https://github.com/tensorflow/tensorflow/issues/8724#issuecomment-289326917.
The actual errors are due to a scripting issue in tf_python.cmake that cannot properly parse one of the source files. It seems to me that the issues are unrelated.

How to pass CMAKE_GENERATOR to a CMake external project?

I am trying to compile the TensorFlow CMake build as an external project on Windows. This requires the 64-bit toolchain to not run out of memory during compilation. However, even though the CMAKE_GENERATOR for the top-level project is Visual Studio 14 2015 Win64, and this is passed to the external project via the CMAKE_GENERATOR variable, the 32 bit toolchain is used to compile the external project.
What I observe: When the build is started, a 64 bit MSBuild process spawns to drive the main project as expected. This can be seen in the task manager. When building the TensorFlow external project however, an MSBuild (32 bit) process start for the external project. The compiler later fails with the error: c1060: compiler is out of heap space.
The CMake code for the TensorFlow external project is
ExternalProject_Add(TensorFlow
GIT_REPOSITORY ${TensorFlow_REPOSITORY}
SOURCE_DIR ${TensorFlow_SOURCE_DIR}
SOURCE_SUBDIR tensorflow/contrib/cmake
BINARY_DIR ${TensorFlow_BINARY_DIR}
CMAKE_GENERATOR ${CMAKE_GENERATOR}
CMAKE_ARGS
--no-warn-unused-cli
-DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
-DSWIG_EXECUTABLE:FILEPATH=${SWIG_EXECUTABLE}
-DPYTHON_EXEUTABLE:FILEPATH=${PYTHON_EXECUTABLE}
-DPYTHON_LIBRARIES:LIST=${PYTHON_LIBRARIES}
-Dtensorflow_WIN_CPU_SIMD_OPTIONS=/arch:AVX
UPDATE_COMMAND ""
DEPENDS ${TensorFlow_DEPENDENCIES}
)
The output from the TensorFlow configuration stage is
Creating directories for 'TensorFlow'
Performing download step (git clone) for 'TensorFlow'
Cloning into 'TensorFlow'...
Checking out files: 100% (7280/7280), done.
Already on 'master'
Your branch is up-to-date with 'origin/master'.
No update step for 'TensorFlow'
No patch step for 'TensorFlow'
Performing configure step for 'TensorFlow'
Not searching for unused variables given on the command line.
-- The C compiler identification is MSVC 19.0.24215.1
-- The CXX compiler identification is MSVC 19.0.24215.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- wor
ks
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test COMPILER_OPT_ARCH_NATIVE_SUPPORTED
-- Performing Test COMPILER_OPT_ARCH_NATIVE_SUPPORTED - Failed
-- Performing Test COMPILER_OPT_WIN_CPU_SIMD_SUPPORTED
-- Performing Test COMPILER_OPT_WIN_CPU_SIMD_SUPPORTED - Success
-- Found PythonInterp: C:/Users/kasper/Anaconda3/python.exe (found version "3.5.2")
-- Found PythonLibs: C:/Users/kasper/Anaconda3/libs/python35.lib (found version "3.5.2")
-- Found SWIG: C:/Development/build/t/SWIG/swig.exe (found version "3.0.10")
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Development/build/t/TensorFlow-build
Then adding message(STATUS "CMAKE_GENERATOR: ${CMAKE_GENERATOR") to the top-level TensorFlow CMakeLists.txt and running cmake . in the TensorFlow-build directory gives
-- CMAKE_GENERATOR: Visual Studio 14 2015 Win64
-- Configuring done
-- Generating done
The value of CMAKE_GENERATOR in the TensorFlow external project is Visual Studio 14 2015 Win64. I also tried to add -G ${CMAKE_GENERATOR} to CMAKE_ARGS but to no avail. Task manager still shows MSBuild (32 bit) and Microsoft Compiler/Linker Driver (32 bit) when the external project starts.
The code can be found here: https://github.com/kaspermarstal/TensorFlowImageFilter.
What am I missing?

Cmake Visual Studio 2015 Identification Unknown

So basically i am trying to use Cmake to build a project i am working on, the project uses GLEW (as shared library). GLEW links to both glu32.lib and opengl32.lib. They are added to the CMakelists.txt of glew on the target_link_libraries call like:
target_link_libraries(glew PUBLIC opengl32 glu32)
When i try to generate code for using the viusal studio compiler (2015 Community). I get problems with CMake adding the link libraries to the Visual studio project with -lopengl32 and -lglue32. This is wrong since visual studio cant handle this and gives met the following error when trying to compile:
LINK : warning LNK4044: unrecognized option '/lglu32.lib';
LINK : warning LNK4044: unrecognized option '/lopengl32.lib';
The output of running the Visual Studio Generator is:
C:\Project\build>cmake .. -G "Visual Studio 14 2015 Win64"
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Check for working C compiler using: Visual Studio 14 2015 Win64
-- Check for working C compiler using: Visual Studio 14 2015 Win64 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Visual Studio 14 2015 Win64
-- Check for working CXX compiler using: Visual Studio 14 2015 Win64 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found OpenGL: opengl32
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Project/build
The following two lines:
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
seem quite odd to me since it is able to run the Visual Studio compiler. I read something about this being the cause of the invalid -l addition to the linker.
Is there anyone that had this problem and knows how to solve it?
Thanks in advance
CMakeError.txt:
Compilation of the C compiler identification source "CMakeCCompilerId.c" did not produce an executable in "C:Project/build/CMakeFiles/3.5.2/CompilerIdC".
Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" did not produce an executable in "C:/Project/build/CMakeFiles/3.5.2/CompilerIdCXX".
After spending some time searching i fixed it! The actual path of the project i was trying to build contained a SPACE in its path. Appearantly CMake can't handle this.

CMake could not find SDL2

I want to add this library to my project. However, it does not come with pre-compiled files. It asks me to build the library myself with cmake, which I am not familiar with. One of its dependencies is SDL2. So I download the sdl2 development libraries folder. In cmake, I click configure and choose the generator. After a couple of seconds processing, a window pops up showing the error: Error in configuration process project files may be invalid
And this is what the log screen shows:
The C compiler identification is MSVC 18.0.40629.0 The CXX
compiler identification is MSVC 18.0.40629.0 Check for working C
compiler using: Visual Studio 12 2013 Check for working C compiler
using: Visual Studio 12 2013 -- works Detecting C compiler ABI
info Detecting C compiler ABI info - done Check for working
CXX compiler using: Visual Studio 12 2013 Check for working CXX
compiler using: Visual Studio 12 2013 -- works Detecting CXX
compiler ABI info Detecting CXX compiler ABI info - done
Detecting CXX compile features Detecting CXX compile features -
done CMake Error at C:/Program Files
(x86)/CMake/share/cmake-3.4/Modules/FindPackageHandleStandardArgs.cmake:148
(message): Could NOT find SDL2 (missing: SDL2_INCLUDE_DIR
SDL2_LIBRARY) Call Stack (most recent call first):
C:/Program Files
(x86)/CMake/share/cmake-3.4/Modules/FindPackageHandleStandardArgs.cmake:388
(_FPHSA_FAILURE_MESSAGE) cmake/FindSDL2.cmake:18
(FIND_PACKAGE_HANDLE_STANDARD_ARGS) CMakeLists.txt:30 (FIND_PACKAGE)
Configuring incomplete, errors occurred! See also "E:/game
dev/libraries/libSDL2pp-master/build/CMakeFiles/CMakeOutput.log".
Could anyone tell me what to do? I am not sure that I am doing the right thing.
cmake doesn't come with a module for finding sdl2 by default. That's most likely the reason why you provided your own in cmake/FindSDL2.cmake. As you are on windows, it is most likely that you have to set an environment variable to point to the sdl2 installation directory (but this is really something that depends on the FindSDL2.cmake that you use).