Project

General

Profile

Wt cmake Could NOT find Boost

Added by Gunnar Skogsholm over 3 years ago

I've used Wt successfully on Windows. It was great that you provided pre-built binaries. I'm also using vcpkg to build boost & various other 3rd party libraries.

Now, I'm building my project for Linux. Since Wt is built using cmake, I figured I could just add a reference to Wt in my cmake file. See attached file.

However, I'm having a lot of trouble: CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message): Could NOT find Boost

Any help would be greatly appreciated !

[main] Building folder: Couloir
[main] Configuring folder: Couloir
[proc] Executing command: /usr/bin/cmake --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=/bin/gcc-9 -DCMAKE_CXX_COMPILER:FILEPATH=/bin/g++-9 -H/mnt/c/Dev/Couloir -B/mnt/c/Dev/Intermediate/ubuntu/Debug -G Ninja
[cmake] Not searching for unused variables given on the command line.
[cmake] -- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
[cmake] -- Could NOT find PNG (missing: PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
[cmake] -- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
[cmake] -- [ /usr/share/cmake-3.16/Modules/FindBoost.cmake:1463 ] _boost_TEST_VERSIONS = "1.50;1.51;1.52;1.53;1.54;1.55;1.56;1.57;1.58;1.59;1.60;1.61;1.62;1.63;1.64;1.65;1.65.1;1.66;1.67;1.68;1.69;1.70;1.71;1.72;1.73;1.74;1.75;1.76;1.77;1.78;1.79;1.72.0;1.72;1.71.0;1.71;1.70.0;1.70;1.69.0;1.69;1.68.0;1.68;1.67.0;1.67;1.66.0;1.66;1.65.1;1.65.0;1.65;1.64.0;1.64;1.63.0;1.63;1.62.0;1.62;1.61.0;1.61;1.60.0;1.60;1.59.0;1.59;1.58.0;1.58;1.57.0;1.57;1.56.0;1.56;1.55.0;1.55;1.54.0;1.54;1.53.0;1.53;1.52.0;1.52;1.51.0;1.51;1.50.0;1.50"
[cmake] -- [ /usr/share/cmake-3.16/Modules/FindBoost.cmake:1464 ] Boost_USE_MULTITHREADED = "ON"
[cmake] -- [ /usr/share/cmake-3.16/Modules/FindBoost.cmake:1465 ] Boost_USE_STATIC_LIBS = "ON"
[cmake] -- [ /usr/share/cmake-3.16/Modules/FindBoost.cmake:1466 ] Boost_USE_STATIC_RUNTIME = "OFF"
[cmake] -- [ /usr/share/cmake-3.16/Modules/FindBoost.cmake:1467 ] Boost_ADDITIONAL_VERSIONS = "1.50;1.51;1.52;1.53;1.54;1.55;1.56;1.57;1.58;1.59;1.60;1.61;1.62;1.63;1.64;1.65;1.65.1;1.66;1.67;1.68;1.69;1.70;1.71;1.72;1.73;1.74;1.75;1.76;1.77;1.78;1.79"
[cmake] -- [ /usr/share/cmake-3.16/Modules/FindBoost.cmake:1468 ] Boost_NO_SYSTEM_PATHS =
[cmake] -- [ /usr/share/cmake-3.16/Modules/FindBoost.cmake:1537 ] BOOST_ROOT = "/mnt/c/Dev/Couloir/3pLibs/boost_1_75_0"
[cmake] -- [ /usr/share/cmake-3.16/Modules/FindBoost.cmake:1538 ] ENV{BOOST_ROOT} =
[cmake] -- [ /usr/share/cmake-3.16/Modules/FindBoost.cmake:1539 ] BOOST_INCLUDEDIR =
[cmake] -- [ /usr/share/cmake-3.16/Modules/FindBoost.cmake:1540 ] ENV{BOOST_INCLUDEDIR} =
[cmake] -- [ /usr/share/cmake-3.16/Modules/FindBoost.cmake:1541 ] BOOST_LIBRARYDIR =
[cmake] -- [ /usr/share/cmake-3.16/Modules/FindBoost.cmake:1542 ] ENV{BOOST_LIBRARYDIR} =
[cmake] -- [ /usr/share/cmake-3.16/Modules/FindBoost.cmake:1630 ] location of version.hpp: /mnt/c/Dev/Couloir/3pLibs/boost_1_75_0/boost/version.hpp
[cmake] -- [ /usr/share/cmake-3.16/Modules/FindBoost.cmake:1670 ] Boost_VERSION = "107500"
[cmake] -- [ /usr/share/cmake-3.16/Modules/FindBoost.cmake:1671 ] Boost_VERSION_STRING = "1.75.0"
[cmake] -- [ /usr/share/cmake-3.16/Modules/FindBoost.cmake:1672 ] Boost_VERSION_MACRO = "107500"
[cmake] -- [ /usr/share/cmake-3.16/Modules/FindBoost.cmake:1673 ] Boost_VERSION_MAJOR = "1"
[cmake] -- [ /usr/share/cmake-3.16/Modules/FindBoost.cmake:1674 ] Boost_VERSION_MINOR = "75"
[cmake] -- [ /usr/share/cmake-3.16/Modules/FindBoost.cmake:1675 ] Boost_VERSION_PATCH = "0"
[cmake] -- [ /usr/share/cmake-3.16/Modules/FindBoost.cmake:1676 ] Boost_VERSION_COUNT = "3"
[cmake] -- [ /usr/share/cmake-3.16/Modules/FindBoost.cmake:1693 ] Boost_LIB_PREFIX = ""
[cmake] -- [ /usr/share/cmake-3.16/Modules/FindBoost.cmake:1694 ] Boost_NAMESPACE = "boost"
[cmake] -- [ /usr/share/cmake-3.16/Modules/FindBoost.cmake:790 ] _boost_COMPILER = "-gcc9" (guessed)
[cmake] -- [ /usr/share/cmake-3.16/Modules/FindBoost.cmake:1730 ] _boost_MULTITHREADED = "-mt"
[cmake] -- [ /usr/share/cmake-3.16/Modules/FindBoost.cmake:1807 ] _boost_ARCHITECTURE_TAG = "" (detected)
[cmake] -- [ /usr/share/cmake-3.16/Modules/FindBoost.cmake:1811 ] _boost_RELEASE_ABI_TAG = "-"
[cmake] -- [ /usr/share/cmake-3.16/Modules/FindBoost.cmake:1812 ] _boost_DEBUG_ABI_TAG = "-d"
[cmake] -- [ /usr/share/cmake-3.16/Modules/FindBoost.cmake:1872 ] _boost_LIBRARY_SEARCH_DIRS_RELEASE = "/mnt/c/Dev/Couloir/3pLibs/ubuntu/vcpkg/installed/x64-linux/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH"
[cmake] -- [ /usr/share/cmake-3.16/Modules/FindBoost.cmake:1873 ] _boost_LIBRARY_SEARCH_DIRS_DEBUG = "/mnt/c/Dev/Couloir/3pLibs/boost_1_75_0/lib;/mnt/c/Dev/Couloir/3pLibs/boost_1_75_0/stage/lib;/mnt/c/Dev/Couloir/3pLibs/boost_1_75_0/lib;/mnt/c/Dev/Couloir/3pLibs/boost_1_75_0/../lib;/mnt/c/Dev/Couloir/3pLibs/boost_1_75_0/stage/lib;PATHS;C:/boost/lib;C:/boost;/sw/local/lib"
[cmake] CMake Warning at /usr/share/cmake-3.16/Modules/FindBoost.cmake:1161 (message):
[cmake] New Boost version may have incorrect or missing dependencies and imported
[cmake] targets
[cmake] Call Stack (most recent call first):
[cmake] /usr/share/cmake-3.16/Modules/FindBoost.cmake:1283 (_Boost_COMPONENT_DEPENDENCIES)
[cmake] /usr/share/cmake-3.16/Modules/FindBoost.cmake:1921 (_Boost_MISSING_DEPENDENCIES)
[cmake] 3pLibs/wt-4/cmake/WtFindBoost.txt:60 (find_package)
[cmake] 3pLibs/wt-4/cmake/WtFindBoost.txt:75 (find_boost_system)
[cmake] 3pLibs/wt-4/CMakeLists.txt:241 (INCLUDE)


Replies (6)

RE: Wt cmake Could NOT find Boost - Added by Gunnar Skogsholm over 3 years ago

My Conclusion:

  1. cmake is a clumsy, ill conceived technology, yet roughly works & provides some value
  2. vcpkg is a clumsy, ill conceived technology, yet roughly works & provides some value
  3. combining the two is non-functional

So, the right solution for me was to switch to using the vcpkg version of Wt

RE: Wt cmake Could NOT find Boost - Added by Gunnar Skogsholm over 3 years ago

Now, b/c of the tortured path I've chosen, I'm stuck trying to figure out the correct libraries to link to on Linux. Looking through the cmakefiles, but not finding a solid list.
On Windows, #pragmas took care of this

Any Help would be Greatly Appreciated!

RE: Wt cmake Could NOT find Boost - Added by Gunnar Skogsholm over 3 years ago

vcpkg has:

wt 4.5.0 Wt is a C++ library for developing web applications
wt[openssl] TLS support

In order to have SSL support, was I supposed to build the 2nd one?

RE: Wt cmake Could NOT find Boost - Added by Gunnar Skogsholm over 3 years ago

Thanks for all the help. I really appreciate it. For the record, for anyone else in vcpkg/boost/cmake hell, this is what worked for me:

target_link_libraries(HelloWorld.Wt.http.web-Linux ${vcpkgLib}/libwthttpd.a ${vcpkgLib}/libwtd.a ${vcpkgLib}/libboost_program_options.a)
target_link_libraries(HelloWorld.Wt.http.web-Linux ${vcpkgLib}/libhpdfd.a ${vcpkgLib}/libssl.a ${vcpkgLib}/libboost_filesystem.a)
target_link_libraries(HelloWorld.Wt.http.web-Linux ${vcpkgLib}/libboost_regex.a ${vcpkgLib}/libboost_random.a )
target_link_libraries(HelloWorld.Wt.http.web-Linux ${vcpkgLib}/libcrypto.a ${vcpkgLib}/libboost_thread.a ${vcpkgLib}/libz.a)
target_link_libraries(HelloWorld.Wt.http.web-Linux ${vcpkgLib}/libboost_date_time.a ${vcpkgLib}/libpng16d.a ${vcpkgLib}/libboost_system.a)
target_link_libraries(HelloWorld.Wt.http.web-Linux pthread dl ${vcpkgLib}/libcurl-d.a)

[main] Building folder: Couloir
[build] Starting build
[proc] Executing command: /usr/bin/cmake --build /mnt/c/Dev/Intermediate/ubuntu/Debug --config Debug --target all -- -j 18
[build] [1/1 0% :: 0.000] Re-running CMake...
[build] Snowbird Debug
[build] Alta Debug
[build] -- Configuring done
[build] -- Generating done
[build] -- Build files have been written to: /mnt/c/Dev/Intermediate/ubuntu/Debug
[build] [1/1 100% :: 42.974] Linking CXX executable Generic/REF/HelloWorld.Wt.http.web/HelloWorld.Wt.http.web-Linux
[build] Build finished with exit code 0

RE: Wt cmake Could NOT find Boost - Added by Gunnar Skogsholm about 3 years ago

:) You all were such a great help last time, I thought I would "give back" & add the Windows equivalent of the above:

VS 16.9.1 -> Linker -> Input -> Additional Dependencies:

wthttpd.lib;wtd.lib;boost_program_options-vc140-mt-gd.lib;libhpdfd.lib;libssl.lib;boost_filesystem-vc140-mt-gd.lib;boost_regex-vc140-mt-gd.lib;boost_random-vc140-mt-gd.lib;libcrypto.lib;boost_thread-vc140-mt-gd.lib;zlibd.lib;boost_date_time-vc140-mt-gd.lib;libpng16d.lib;

RE: Wt cmake Could NOT find Boost - Added by Gunnar Skogsholm about 3 years ago

So, to summarize:

vcpkg doesn't generate the expected boost lib names, so I have modified line 477-9 of auto_link.hpp (file attached)

Examples of what I previously got by with: wthttpd.lib;wtd.lib; AND libssl.lib;libcrypto.lib;wtisapid.lib;wtd.lib;<

Based on that, I would guess that not all of these libs are required, but there is no price to including libs which are not needed.

from: wt 4.0ish, prebuilt binaries
to: wt 4.5, vcpkg build of wt & boost

Win Debug:
wthttpd.lib;wtd.lib;boost_program_options-vc140-mt-gd.lib;boost_filesystem-vc140-mt-gd.lib;boost_regex-vc140-mt-gd.lib;boost_random-vc140-mt-gd.lib;boost_thread-vc140-mt-gd.lib;boost_date_time-vc140-mt-gd.lib;libhpdfd.lib;libssl.lib;libcrypto.lib;zlibd.lib;libpng16d.lib;crypt32.lib

Release
wthttp.lib;wt.lib;boost_program_options-vc140-mt.lib;boost_filesystem-vc140-mt.lib;boost_regex-vc140-mt.lib;boost_random-vc140-mt.lib;boost_thread-vc140-mt.lib;boost_date_time-vc140-mt.lib;libcrypto.lib;libhpdf.lib;libssl.lib;zlib.lib;libpng16.lib;crypt32.lib

ISAPI -> replace wthttp.lib with wtisapi.lib:

wtisapid.lib;wtd.lib;boost_program_options-vc140-mt-gd.lib;boost_filesystem-vc140-mt-gd.lib;boost_regex-vc140-mt-gd.lib;boost_random-vc140-mt-gd.lib;boost_thread-vc140-mt-gd.lib;boost_date_time-vc140-mt-gd.lib;libhpdfd.lib;libssl.lib;libcrypto.lib;zlibd.lib;libpng16d.lib;crypt32.lib

wtisapi.lib;wt.lib;boost_program_options-vc140-mt.lib;boost_filesystem-vc140-mt.lib;boost_regex-vc140-mt.lib;boost_random-vc140-mt.lib;boost_thread-vc140-mt.lib;boost_date_time-vc140-mt.lib;libcrypto.lib;libhpdf.lib;libssl.lib;zlib.lib;libpng16.lib;crypt32.lib

    (1-6/6)