Building MySQL C++ Connector from source - c++

I have been struggling for a few days trying to get MySQL C++ Connector to compile on Windows. I have Cygwin installed.
I run the following
set cc=gcc
set cxx=gcc
cmake -G "MinGW Makefiles" -DCMAKE_REQUIRED_FLAGS=-xO4 -DCMAKE_INSTALL_PREFIX=C:\\exports\\Connector -DMYSQL_CONFIG_EXECUTABLE="C:\\Program Files\\MySQL\\MySQL Server 5.7"
But I get the following output:
-- Boost version: 1.61.0
-- BOOST_INCLUDE_DIRS=C:/boost_1_61_0
-- You will link dynamically to the MySQL client library (set with -DMYSQLCLIENT_STATIC_LINKING=<bool>)
-- Searching for dynamic libraries with the base name(s) "libmysql"
CMake Error at FindMySQL.cmake:494 (message):
Could not find the include dir from running "C:\\Program
Files\\MySQL\\MySQL Server 5.7"
Call Stack (most recent call first):
CMakeLists.txt:218 (INCLUDE)
-- Configuring incomplete, errors occurred!
See also "C:/Users/Chris/MySQLConnector/CMakeFiles/CMakeOutput.log".
I don't get why it says it can't find the include directory because I can see it in the path C:\Program Files\MySQL\MySQL Server 5.7\include

Related

Trying to use vcpkg installation of SDL2 in Visual Studio Code with cmake in Windows 10

Been trying two days everything I can google. Here is the CMakeLists.txt:
cmake_minimum_required(VERSION 3.0.0)
project(main VERSION 0.1.0)
set(CMAKE_TOOLCHAIN_FILE "C:/vcpkg/scripts/buildsystems/vcpkg.cmake")
include(CTest)
enable_testing()
find_package(SDL2 CONFIG REQUIRED)
add_executable(main main.cpp)
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
target_link_libraries(main PRIVATE SDL2::SDL2 SDL2::SDL2main)
Here is the output:
[main] Building folder: Example
[main] Configuring folder: Example
[proc] Executing command: "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" --no-warn-unused-cli -DCMAKE_TOOLCHAIN_FILE:STRING=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug "-DCMAKE_C_COMPILER:FILEPATH=C:\Program Files (x86)\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin\gcc.exe" "-DCMAKE_CXX_COMPILER:FILEPATH=C:\Program Files (x86)\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin\g++.exe" -Hc:/Users/tausciam/Desktop/Programming/Example -Bc:/Users/tausciam/Desktop/Programming/Example/build -G "MinGW Makefiles"
[cmake] Not searching for unused variables given on the command line.
[cmake] CMake Error at C:/vcpkg/installed/x64-windows/share/sdl2/vcpkg-cmake-wrapper.cmake:1 (_find_package):
[rollbar] Unhandled exception: Unhandled exception: Processing "data" event from proc stderr TypeError: message must be set {"data":{"type":"Buffer","data":[67,77,97,107,101,32,69,114,114,111,114,32,97,116,32,67,58,47,118,99,112,107,103,47,105,110,115,116,97,108,108,101,100,47,120,54,52,45,119,105,110,100,111,119,115,47,115,104,97,114,101,47,115,100,108,50,47,118,99,112,107,103,45,99,109,97,107,101,45,119,114,97,112,112,101,114,46,99,109,97,107,101,58,49,32,40,95,102,105,110,100,95,112,97,99,107,97,103,101,41,58,10,32,32,67,111,117,108,100,32,110,111,116,32,102,105,110,100,32,97,32,99,111,110,102,105,103,117,114,97,116,105,111,110,32,102,105,108,101,32,102,111,114,32,112,97,99,107,97,103,101,32,34,83,68,76,50,34,32,116,104,97,116,32,105,115,32,99,111,109,112,97,116,105,98,108,101,10,32,32,119,105,116,104,32,114,101,113,117,101,115,116,101,100,32,118,101,114,115,105,111,110,32,34,34,46,10,10,32,32,84,104,101,32,102,111,108,108,111,119,105,110,103,32,99,111,110,102,105,103,117,114,97,116,105,111,110,32,102,105,108,101,115,32,119,101,114,101,32,99,111,110,115,105,100,101,114,101,100,32,98,117,116,32,110,111,116,32,97,99,99,101,112,116,101,100,58,10,10,32,32,32,32,67,58,47,118,99,112,107,103,47,105,110,115,116,97,108,108,101,100,47,120,54,52,45,119,105,110,100,111,119,115,47,115,104,97,114,101,47,115,100,108,50,47,83,68,76,50,67,111,110,102,105,103,46,99,109,97,107,101,44,32,118,101,114,115,105,111,110,58,32,50,46,48,46,49,50,32,40,54,52,98,105,116,41,10,10]},"command":"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\Common7\\IDE\\CommonExtensions\\Microsoft\\CMake\\CMake\\bin\\cmake.exe","args":["--no-warn-unused-cli","-DCMAKE_TOOLCHAIN_FILE:STRING=C:/vcpkg/scripts/buildsystems/vcpkg.cmake","-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE","-DCMAKE_BUILD_TYPE:STRING=Debug","-DCMAKE_C_COMPILER:FILEPATH=C:\\Program Files (x86)\\mingw-w64\\i686-8.1.0-posix-dwarf-rt_v6-rev0\\mingw32\\bin\\gcc.exe","-DCMAKE_CXX_COMPILER:FILEPATH=C:\\Program Files (x86)\\mingw-w64\\i686-8.1.0-posix-dwarf-rt_v6-rev0\\mingw32\\bin\\g++.exe","-Hc:/Users/tausciam/Desktop/Programming/Example","-Bc:/Users/tausciam/Desktop/Programming/Example/build","-G","MinGW Makefiles"]}
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "C:/Users/tausciam/Desktop/Programming/Example/build/CMakeFiles/CMakeOutput.log".
[cmake] CMake Error at C:/vcpkg/installed/x64-windows/share/sdl2/vcpkg-cmake-wrapper.cmake:1 (_find_package):Call Stack (most recent call first):
[rollbar] Unhandled exception: Unhandled exception: Processing "data" event from proc stderr TypeError: message must be set {"data":{"type":"Buffer","data":[67,97,108,108,32,83,116,97,99,107,32,40,109,111,115,116,32,114,101,99,101,110,116,32,99,97,108,108,32,102,105,114,115,116,41,58,10,32,32,67,58,47,118,99,112,107,103,47,115,99,114,105,112,116,115,47,98,117,105,108,100,115,121,115,116,101,109,115,47,118,99,112,107,103,46,99,109,97,107,101,58,52,52,52,32,40,105,110,99,108,117,100,101,41,10,32,32,67,77,97,107,101,76,105,115,116,115,46,116,120,116,58,56,32,40,102,105,110,100,95,112,97,99,107,97,103,101,41,10,10,10]},"command":"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\Common7\\IDE\\CommonExtensions\\Microsoft\\CMake\\CMake\\bin\\cmake.exe","args":["--no-warn-unused-cli","-DCMAKE_TOOLCHAIN_FILE:STRING=C:/vcpkg/scripts/buildsystems/vcpkg.cmake","-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE","-DCMAKE_BUILD_TYPE:STRING=Debug","-DCMAKE_C_COMPILER:FILEPATH=C:\\Program Files (x86)\\mingw-w64\\i686-8.1.0-posix-dwarf-rt_v6-rev0\\mingw32\\bin\\gcc.exe","-DCMAKE_CXX_COMPILER:FILEPATH=C:\\Program Files (x86)\\mingw-w64\\i686-8.1.0-posix-dwarf-rt_v6-rev0\\mingw32\\bin\\g++.exe","-Hc:/Users/tausciam/Desktop/Programming/Example","-Bc:/Users/tausciam/Desktop/Programming/Example/build","-G","MinGW Makefiles"]}
[cmake] CMake Error at C:/vcpkg/installed/x64-windows/share/sdl2/vcpkg-cmake-wrapper.cmake:1 (_find_package):Call Stack (most recent call first):
[rollbar] Unhandled exception: Unhandled exception: Resolving process on "close" event TypeError: message must be set {"line_acc":"","stderr_line_acc":"CMake Error at C:/vcpkg/installed/x64-windows/share/sdl2/vcpkg-cmake-wrapper.cmake:1 (_find_package):Call Stack (most recent call first):","command":"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\Common7\\IDE\\CommonExtensions\\Microsoft\\CMake\\CMake\\bin\\cmake.exe","retc":1}
[ctest] There was an error running ctest to determine available test executables
I did run the .\vcpkg integrate install and the library does seem to work in Visual Studio 2019 with MSBUILD.
I believe the unhelpful error message you are seeing is unrelated to the actual issue with your CMake configuration.
There is an open, recent issue here and here.
Please try running cmake . in your build directory in the terminal in order to configure outside of VS code. This may give you a more helpful error message.

What MinGw packages do I need to install to use CLion?

I am using CLion to write C++ programs and I am using MinGW.But I have some files missing namely-Make,C Compiler and C++ Compiler which are not found.I am using MinGW Installation Manager to install the packages but I don't know the exact names of the packages I have to install.
What are the names of the packages I need to install to get rid of this error?(I need the specific names that I can get in the MinGW Installation manager.)
I am also getting these error messages-
"C:\Program Files\JetBrains\CLion 2017.1.2\bin\cmake\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - MinGW Makefiles"
C:\Users\Lenovo\CLionProjects\untitled
CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
Thanks for any help!!
tps://i.stack.imgur.com/SFWFU.png
Under the "Basic Setup" category in the installer, you need to select and install mingw32-gcc-g++ and mingw32-make.

Openbr - system runtime library file does not exist: msvcp120.dll

I just found out about Openbr and started to install required libraries like OpenCV and QT. I followed these instructions for windows(win10 64bit):
http://openbiometrics.org/docs/install/#windows
but unfortionatly got stuck when executing the following command:
cmake -G "NMake Makefiles" -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DWITH_FFMPEG=OFF -DCMAKE_BUILD_TYPE=Debug ..
with this output:
CMake Error at C:/opencv-2.4.11/build-msvc2013/win-install/OpenCVConfig.cmake:71 (include):
include could not find load file:
C:/opencv-2.4.11/build-msvc2013/win-install/OpenCVModules.cmake
Call Stack (most recent call first):
CMakeLists.txt:87 (find_package)
-- adding C:/openbr/openbr/plugins/classification
-- adding C:/openbr/openbr/plugins/cluster
-- adding C:/openbr/openbr/plugins/cmake
-- adding C:/openbr/openbr/plugins/core
-- importing C:/openbr/openbr/plugins/cuda/module.cmake
-- adding C:/openbr/openbr/plugins/distance
-- adding C:/openbr/openbr/plugins/format
-- adding C:/openbr/openbr/plugins/gallery
-- adding C:/openbr/openbr/plugins/gui
-- adding C:/openbr/openbr/plugins/imgproc
-- adding C:/openbr/openbr/plugins/io
-- adding C:/openbr/openbr/plugins/metadata
-- adding C:/openbr/openbr/plugins/output
-- adding C:/openbr/openbr/plugins/representation
-- adding C:/openbr/openbr/plugins/video
CMake Error at openbr/CMakeLists.txt:52 (add_subdirectory):
The source directory
C:/openbr/openbr/janus
does not contain a CMakeLists.txt file.
CMake Warning at C:/Program Files/CMake/share/cmake-3.6/Modules /InstallRequiredSystemLibraries.cmake:463 (message):
system runtime library file does not exist:
'MSVC12_REDIST_DIR-NOTFOUND/x64/Microsoft.VC120.CRT/msvcp120.dll'
Call Stack (most recent call first):
share/openbr/cmake/InstallDependencies.cmake:135 (include)
openbr/CMakeLists.txt:67 (install_compiler_libraries)
CMake Warning at C:/Program Files/CMake/share/cmake-3.6/Modules/InstallRequiredSystemLibraries.cmake:463 (message):
system runtime library file does not exist:
'MSVC12_REDIST_DIR-NOTFOUND/x64/Microsoft.VC120.CRT/msvcr120.dll'
Call Stack (most recent call first):
share/openbr/cmake/InstallDependencies.cmake:135 (include)
openbr/CMakeLists.txt:67 (install_compiler_libraries)
-- Configuring incomplete, errors occurred!
See also "C:/openbr/build-msvc2013/CMakeFiles/CMakeOutput.log".

CMake Error: Could not find include directory and library

I am trying to build PODOFO library with CMake using MinGW compiler. It requires some external libraries like zlib, jpeg, openssl and freetype. My cmake command is as follows:
cmake -G "MinGW Makefiles"
-DCMAKE_INCLUDE_PATH=c:\Users\Abhishek\Downloads\freetype-2.3.5-1-bin\include -DCMAKE_LIBRARY_PATH=c:\Users\Abhishek\Downloads\freetype-2.3.5-1-bin\lib
-DCMAKE_INCLUDE_PATH=c:\Users\Abhishek\Downloads\zlib\include -DCMAKE_LIBRARY_PATH=c:\Users\Abhishek\Downloads\zlib\lib -DCMAKE_INCLUDE_PATH=C:\Users\Abhishek\Downloads\openssl-0.9.8h-1-lib\include -DCMAKE_LIBRARY_PATH=c:\Users\Abhishek\Downloads\openssl-0.9.8h-1-lib\lib
-DPODOFO_BUILD_SHARED:BOOL=FALSE ..
Somehow it is not able to find the freetype files. The error I get is as follows:
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:97 (message):
Could NOT find FREETYPE (missing: FREETYPE_LIBRARY FREETYPE_INCLUDE_DIR)
Call Stack (most recent call first):
C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStan dardArgs.cmake:291
(_FPHSA_FAILURE_MESSAGE)
cmake/modules/FindFREETYPE.cmake:75
(FIND_PACKAGE_HANDLE_STANDARD_ARGS) CMakeLists.txt:372
(FIND_PACKAGE)
-- Configuring incomplete, errors occurred!
One additional point. If I delete the previous CMake build files (cache etc) then it doesn't even find zlib!
I can't understand why this erratic behaviour. Can anyone shed light on this?
When you're configuring, you need to define FREETYPE_INCLUDE_DIR and the other variables for where you keep the libraries it depends on - cmake can't guess these just from your include paths.

Missing dependency when building with CMake

I'm trying to build the Polycode codes using CMake. I followed the instructions in the Build.md file, but I get the following error:
$ cmake -G "Visual Studio 10" ..
No POLYCODE_RELEASE_DIR specified, to C:/Development/Polycode/Release/Windows
DEBUG CMAKE_PREFIX_PATH=C:/Development/Polycode/Release/Windows/Framework/Core/Dependencies;C:/Development/Polycode/Release/Windows/Framework/Modules/Dependencies;C:/Development/Polycode/Release/Windows/Framework/Tools/Dependencies
CMake Error at c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:97 (message):
Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
Call Stack (most recent call first):
c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:291 (_FPHSA_FAILURE_MESSAGE)
c:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindZLIB.cmake:85 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMake/PolycodeIncludes.cmake:14 (FIND_PACKAGE)
Core/Contents/CMakeLists.txt:2 (INCLUDE)
-- Configuring incomplete, errors occurred!
I see that it needs ZLIB but, I don't know how to handle this. Shouldn't it download the dependency automatically? I could surely find ZLIB and download it but I don't really want to do this with every single lib it might need. Is there a convenient way to solve this?
It is a two-step build process. First you need to build the dependencies:
cd Dependencies # <---- this will run the next steps in the Dependencies subdirectory of your Polycode repo
mkdir Build
cd Build
cmake -G "Visual Studio 10" ..
This step should install the required libraries. Only then you can you proceed to build Polycode itself
# <---- this build step is run inside your Polycode root directory
mkdir Build
cd Build
cmake -G "Visual Studio 10" ..