0

I am having difficulties building the SOCI library.

Relevant software:

  • Boost ver 1.73.0
  • CMake ver 3.16
  • MSVC compiler ver 19.26.28805.0
  • MySQL ver 5.7
  • SOCI ver 4.0.0

Relevant paths:

  • Path to Boost is E:\cpp\Lib\boost\boost_1_73_0.
  • Path to CMake is E:\Apps\CMake\share\cmake-3.16.
  • Path to MySQL server is C:\Program Files\MySQL\MySQL Server 5.7\.
  • Path to MSVC is C:\Apps\32\Microsoft\Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\Hostx64\x64.

Command to build SOCI is cmake -DCMAKE_BUILD_TYPE=Debut -DSOCI_CXX11=ON -DSOCI_SHARED=ON -DWITH_BOOST=ON -DWITH_MYSQL=ON ..

Here is the modified Boost.cmake file, found at %SOCI%\cmake\dependencies\. Comments beginning ## explain changes.

## commented
#set(Boost_FIND_QUIETLY TRUE)

set(Boost_USE_MULTITHREADED ON)
## commented
#find_package(Boost 1.33.1 COMPONENTS date_time)

## BEGIN inserted
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "E:/cpp/Lib/boost/boost_1_73_0")
message(STATUS "<< set CMAKE_INCLUDE_PATH >> " ${CMAKE_INCLUDE_PATH})

set(BOOST_ROOT E:/cpp/Lib/boost/boost_1_73_0)
message(STATUS "<< set BOOST_ROOT >> " ${BOOST_ROOT})

message(STATUS "<< FIND_PACKAGE >>")
FIND_PACKAGE(Boost)

message(STATUS "<< FIND_PACKAGE COMPONENTS >>")
FIND_PACKAGE(Boost COMPONENTS date_time)

message(STATUS "<< Boost_FOUND >> " ${Boost_FOUND})

message(STATUS "<< Boost_DATE_TIME_FOUND >> " ${Boost_DATE_TIME_FOUND})
## END inserted

## commented
#if (NOT Boost_DATE_TIME_FOUND)
#  find_package(Boost 1.33.1)
#endif()

set(Boost_RELEASE_VERSION
  "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")

boost_external_report(Boost RELEASE_VERSION INCLUDE_DIR LIBRARIES)

Here is the relevant output. Full output available here.

-- Boost:
-- << set CMAKE_INCLUDE_PATH >> E:/cpp/Lib/boost/boost_1_73_0
-- << set BOOST_ROOT >> E:/cpp/Lib/boost/boost_1_73_0
-- << FIND_PACKAGE >>
-- << FIND_PACKAGE COMPONENTS >>
CMake Warning at E:/Apps/CMake/share/cmake-3.16/Modules/FindBoost.cmake:1161 (message):
  New Boost version may have incorrect or missing dependencies and imported
  targets
Call Stack (most recent call first):
  E:/Apps/CMake/share/cmake-3.16/Modules/FindBoost.cmake:1283 (_Boost_COMPONENT_DEPENDENCIES)
  E:/Apps/CMake/share/cmake-3.16/Modules/FindBoost.cmake:1921 (_Boost_MISSING_DEPENDENCIES)
  cmake/dependencies/Boost.cmake:18 (FIND_PACKAGE)
  cmake/SociDependencies.cmake:79 (include)
  CMakeLists.txt:83 (include)


-- Could NOT find Boost (missing: date_time) (found version "1.73.0")
-- << Boost_FOUND >> FALSE
-- << Boost_DATE_TIME_FOUND >> 0
-- WARNING: Boost libraries not found, some features will be disabled.

Executing msbuild.exe SOCI.sln produces output available here.

Can anyone tell me why SOCI will not build correctly? Why is it not finding the date_time component when it is most certainly there?

J Vines
  • 182
  • 1
  • 16
  • 1
    What version of Boost libraries have you built? Did you build them for Visual Studio 2019? Did you build static or shared libraries, or both? – Kevin Jun 25 '20 at 17:38
  • `warning C4003: not enough arguments for function-like macro invocation 'min'` seems to mean its using the min macro from windows.h instead of `std::min` related [https://stackoverflow.com/questions/13416418/define-nominmax-using-stdmin-max](https://stackoverflow.com/questions/13416418/define-nominmax-using-stdmin-max) – drescherjm Jun 25 '20 at 17:44
  • @squareskittles While in `E:\cpp\Lib\boost\boost_1_73_0`, I used the commands `bootstrap.bat` then `b2 install --prefix=E:\cpp\Lib\boost\boost_1_73_0\build`. – J Vines Jun 25 '20 at 18:05
  • This doesn't specify the compiler, so it doesn't guarantee they built with Visual Studio 2019. It might be easier if you provide the *name* of one of the built libraries in your question post. – Kevin Jun 25 '20 at 18:08
  • The output after running the command `b2 install --prefix=E:\cpp\Lib\boost\1_73 --build-dir=E:\cpp\Lib\boost\build --build-type=complete` is available, here: https://raw.githubusercontent.com/ptrongithub/misc/master/boost/b2_output. Unfortunately, the first part got cut off. – J Vines Jun 26 '20 at 16:27
  • Re-ran the `b2` command inside `Developer Command Prompt for VS 2019`. Command output file has been updated. Now shows the full output. https://raw.githubusercontent.com/ptrongithub/misc/master/boost/b2_output – J Vines Jun 26 '20 at 17:36

1 Answers1

0

Turns out, most of the errors I was getting was from the included unit tests. Why? I do not know. However, if I ignore the errors and move on, everything seems to work fine.

J Vines
  • 182
  • 1
  • 16