Cmake FindBoost error-POP without matching PUSH - c++

I am trying to install LightGBM-gpu on Centos. It seems boost 1.56 can be find, but this error occurred.I google it all day but can not solve it.
Here is the Message
$ cmake -DUSE_GPU=1 -DOpenCL_LIBRARY=/usr/local/cuda/lib64/libOpenCL.so -DOpenCL_INCLUDE_DIR=/usr/local/cuda/include/ ..
-- The C compiler identification is GNU 4.8.5
-- The CXX compiler identification is GNU 4.8.5
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- 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: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenMP_C: -fopenmp (found version "3.1")
-- Found OpenMP_CXX: -fopenmp (found version "3.1")
-- Looking for CL_VERSION_2_0
-- Looking for CL_VERSION_2_0 - not found
-- Looking for CL_VERSION_1_2
-- Looking for CL_VERSION_1_2 - found
-- Found OpenCL: /usr/local/cuda/lib64/libOpenCL.so (found version "1.2")
-- OpenCL include directory: /usr/local/cuda/include
Boost 1.56.0 found.
Found Boost components:
filesystem;system
CMake Error in /usr/local/share/cmake-3.9/Modules/FindBoost.cmake:
cmake_policy POP without matching PUSH
Call Stack (most recent call first):
CMakeLists.txt:144 (find_package)
-- Performing Test MM_PREFETCH
-- Performing Test MM_PREFETCH - Success
-- Using _mm_prefetch
-- Performing Test MM_MALLOC
-- Performing Test MM_MALLOC - Success
-- Using _mm_malloc
-- Configuring incomplete, errors occurred!
See also "/home/rd/LightGBM/build/CMakeFiles/CMakeOutput.log".
See also "/home/rd/LightGBM/build/CMakeFiles/CMakeError.log".

This question was cross-posted to the LightGBM issues page as microsoft/LightGBM#3613. The issue was solved there.
Updating CMake to at least version 3.14 fixes this issue.

Related

How do I find the path of CUDA on linux?

I have pytorch installed and working no problem, making use of the GPU. While trying to install Libtorch, I kept getting errors like:
CUDA_TOOLKIT_ROOT_DIR not found or specified
I can't find where this path is. I will edit the post with the output of commands.
CMake error:
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
CUDA_TOOLKIT_ROOT_DIR not found or specified
-- Could NOT find CUDA (missing: CUDA_TOOLKIT_ROOT_DIR CUDA_NVCC_EXECUTABLE CUDA_INCLUDE_DIRS CUDA_CUDART_LIBRARY)
Caffe2: CUDA cannot be found. Depending on whether you are building Caffe2
or a Caffe2 dependent library, the next warning / error will give you more
info
output of sudo find / |grep nvcc:
/usr/local/share/cmake-3.24/Modules/FindCUDA/run_nvcc.cmake
/usr/local/boost_1_80_0/boost/predef/compiler/nvcc.h
/usr/local/boost_1_80_0/boost/config/compiler/nvcc.hpp
/usr/share/cmake-3.16/Modules/FindCUDA/run_nvcc.cmake
/usr/include/boost/predef/compiler/nvcc.h
/usr/include/boost/config/compiler/nvcc.hpp
find: ‘/run/user/1000/doc’: Permission denied
find: ‘/run/user/1000/gvfs’: Permission denied
find: ‘/run/user/125/gvfs’: Permission denied
/home/xxx/.local/share/Trash/files/libtorch/share/cmake/Caffe2/Modules_CUDA_fix/upstream/FindCUDA/run_nvcc.cmake
/home/xxx/.local/share/xmake/modules/core/tools/nvcc.lua
/home/xxx/.local/share/xmake/modules/detect/tools/find_nvcc.lua
/home/xxx/.local/share/xmake/modules/detect/tools/nvcc
/home/xxx/.local/share/xmake/modules/detect/tools/nvcc/has_flags.lua
/home/xxx/Documents/xxx/mongo/env/lib/python3.8/site-packages/torch/share/cmake/Caffe2/Modules_CUDA_fix/upstream/FindCUDA/run_nvcc.cmake
/home/xxx/Documents/pytorch/libtorch/share/cmake/Caffe2/Modules_CUDA_fix/upstream/FindCUDA/run_nvcc.cmake
/home/xxx/Documents/mongo/env/lib/python3.8/site-packages/torch/share/cmake/Caffe2/Modules_CUDA_fix/upstream/FindCUDA/run_nvcc.cmake
/home/xxx/Documents/xxx/xx/env/lib/python3.8/site-packages/torch/share/cmake/Caffe2/Modules_CUDA_fix/upstream/FindCUDA/run_nvcc.cmake
find: ‘/home/midas/mydrive’: Permission denied
/home/xxx/git/xxx-projects/xx/Script/env/lib/python3.8/site-packages/torch/share/cmake/Caffe2/Modules_CUDA_fix/upstream/FindCUDA/run_nvcc.cmake
/home/xxx/git/midas-engine/cicd-venv/lib/python3.8/site-packages/torch/share/cmake/Caffe2/Modules_CUDA_fix/upstream/FindCUDA/run_nvcc.cmake
/home/xxx/git/xxx-xx/venv/lib/python3.8/site-packages/torch/share/cmake/Caffe2/Modules_CUDA_fix/upstream/FindCUDA/run_nvcc.cmake
/var/lib/docker/overlay2/<large-string>/diff/usr/local/lib/python3.8/dist-packages/torch/share/cmake/Caffe2/Modules_CUDA_fix/upstream/FindCUDA/run_nvcc.cmake
/var/lib/docker/overlay2/<large-string>/diff/usr/local/lib/python3.8/dist-packages/torch/share/cmake/Caffe2/Modules_CUDA_fix/upstream/FindCUDA/run_nvcc.cmake

C++/Cmake - Unable to compile MySQL Connector

This is what I do:
git clone https://github.com/mysql/mysql-connector-cpp.git
Than I do:
cd mysql-connector-cpp
git checkout 8.0
cmake .
And than I receive the following output:
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- 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: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
-- BIG_ENDIAN: 0
Building version 8.0.26
Building on system: Linux-5.11.0-27-generic (x86_64)
Using cmake generator: Unix Makefiles
Using toolset:
Building 64bit code
Building shared connector library
Configuring CDK as part of MySQL_CONCPP project
-- Looking for SSL library.
CMake Error at cdk/cmake/DepFindSSL.cmake:79 (message):
Cannot find appropriate system libraries for SSL. Make sure you've
specified a supported SSL version. Consult the documentation for WITH_SSL
alternatives
Call Stack (most recent call first):
cdk/cmake/DepFindSSL.cmake:354 (main)
cdk/cmake/dependency.cmake:42 (include)
cdk/CMakeLists.txt:96 (find_dependency)
-- Setting up Protobuf.
==== Configuring Protobuf build using cmake generator: Unix Makefiles -DCMAKE_SYSTEM_NAME=Linux;-DCMAKE_SYSTEM_VERSION=5.11.0-27-generic
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- 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: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
-- BIG_ENDIAN: 0
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Performing Test protobuf_HAVE_BUILTIN_ATOMICS
-- Performing Test protobuf_HAVE_BUILTIN_ATOMICS - Success
-- Configuring done
-- Generating done
-- Build files have been written to: /home/armegon/mysql-connector-cpp/cdk/protobuf
==== Protobuf build configured.
Processor Count: 8
-- Setting up RapidJSON.
Skipping second declaration of config option: THROW_AS_ASSERT (found in: /home/armegon/mysql-connector-cpp/cdk/CMakeLists.txt)
-- Performing Test HAVE_STATIC_ASSERT
-- Performing Test HAVE_STATIC_ASSERT - Success
-- Performing Test HAVE_IS_SAME
-- Performing Test HAVE_IS_SAME - Failed
-- Check size of off64_t
-- Check size of off64_t - done
-- Looking for fseeko
-- Looking for fseeko - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- ZSTD_LEGACY_SUPPORT not defined!
-- Performing Test HAVE_SHARED_PTR
-- Performing Test HAVE_SHARED_PTR - Success
-- Performing Test HAVE_SYSTEM_ERROR
-- Performing Test HAVE_SYSTEM_ERROR - Success
-- Check size of wchar_t
-- Check size of wchar_t - done
-- Looking for sys/endian.h
-- Looking for sys/endian.h - not found
-- Looking for sys/byteorder.h
-- Looking for sys/byteorder.h - not found
Wrote configuration header: /home/armegon/mysql-connector-cpp/cdk/include/mysql/cdk/config.h
Preparing to merge SHARED library: connector (xapi;devapi)
Connector library name: mysqlcppconn8
Building version 8.0.26
Generating INFO_SRC
Generating INFO_BIN
Install location: /usr/local/mysql/connector-c++-
Connector libraries will be installed at: lib64
Project configuration options:
: BUILD_STATIC: OFF
Build static version of connector library
: WITH_SSL: system
Either 'system' to use system-wide OpenSSL library, or custom OpenSSL location. (default : system)
: WITH_JDBC: OFF
Whether to build a variant of connector library which implements legacy JDBC API
-- Configuring incomplete, errors occurred!
See also "/home/armegon/mysql-connector-cpp/CMakeFiles/CMakeOutput.log".
See also "/home/armegon/mysql-connector-cpp/CMakeFiles/CMakeError.log".
The content of CMakeOutput.log is here and the content of CMakeError.log is here.
Any idea how can I fix this issue ?
Never, ever do an in-source build. cmake . is always wrong. It even says so in the MySQL documentation: https://dev.mysql.com/doc/connector-cpp/8.0/en/connector-cpp-installation-source-cpp.html
This worked for me:
$ git clone --depth 1 --branch 8.0 https://github.com/mysql/mysql-connector-cpp.git
$ cmake -G "Unix Makefiles" -S mysql-connector-cpp -B mysql-connector-cpp-build -DCMAKE_BUILD_TYPE=Release
$ cmake --build mysql-connector-cpp-build
It also looks like you're missing the SSL dependency. If you're running a Debian derivative (Ubuntu, Mint), you can install this with:
$ sudo apt install libssl-dev

When Cross Compiling (Linux to Windows) The Vulkan Loader There Are Many Undefined References to Vulkan Objects

When using the mingw-32 cmake the code from https://github.com/KhronosGroup/Vulkan-Loader fails to compile this is the cmake command I am using:x86_64-w64-mingw32-cmake -DVULKAN_HEADERS_INSTALL_DIR=/usr/x86_64-w64-mingw32/ -DVulkanRegistry_DIR=/usr/x86_64-w64-mingw32/share/vulkan/registry/ -DUSE_MASM=OFF ..
Which Outputs:
-- The C compiler identification is GNU 11.1.0
-- The CXX compiler identification is GNU 11.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/x86_64-w64-mingw32-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/x86_64-w64-mingw32-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found VulkanHeaders: /usr/x86_64-w64-mingw32/include
-- Found VulkanRegistry: /usr/x86_64-w64-mingw32/share/vulkan/registry
-- Detected Vulkan Version 1.2.182
-- Looking for secure_getenv
-- Looking for secure_getenv - not found
-- Looking for __secure_getenv
-- Looking for __secure_getenv - not found
CMake Warning at loader/CMakeLists.txt:27 (message):
Using non-secure environmental lookups. This loader will not properly
disable environent variables when run with elevated permissions.
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.7.3")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/flippers2652/Documents/Temp/Vulkan-Loader/build
Output from make: https://pastebin.pl/view/7467739f
Thank you.
P.S. Distrobution is manjaro.
The problem was that I had a MASM assembler. Which caused it to attempt an assembly thing that it failed to do.

Not able to install Folly on Fedora 31

I'm not able to compile on Fedora 31. I installed fmt and followed these instructions:
git clone https://github.com/facebook/folly.git
cd folly
mkdir _build
cd _build
cmake ..
When I run cmake .., I get the following error:
[vagrant#localhost _build]$ cmake ..
-- The CXX compiler identification is GNU 9.3.1
-- The C compiler identification is GNU 9.3.1
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:164 (message):
Could NOT find Boost (missing: Boost_INCLUDE_DIR context filesystem
program_options regex system thread) (Required is at least version
"1.51.0")
Call Stack (most recent call first):
/usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:445 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake/Modules/FindBoost.cmake:2166 (find_package_handle_standard_args)
CMake/folly-deps.cmake:36 (find_package)
CMakeLists.txt:113 (include)
-- Configuring incomplete, errors occurred!
See also "/vagrant/folly/_build/CMakeFiles/CMakeOutput.log".
See also "/vagrant/folly/_build/CMakeFiles/CMakeError.log".

Mongodb C++ compilation issue

I am trying to compile mongodb driver for c++ and following instructions given in url : Mongocxx
I am getting below errors :
-- The CXX compiler identification is GNU 4.8.5
-- Check for working CXX compiler: /bin/c++
-- Check for working CXX compiler: /bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The C compiler identification is GNU 4.8.5
-- Check for working C compiler: /bin/cc
-- Check for working C compiler: /bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Checking for module 'libbson-1.0>=1.5.0'
--
CMake Error at /usr/share/cmake3/Modules/FindPkgConfig.cmake:424 (message):
A required package was not found
Call Stack (most recent call first):
/usr/share/cmake3/Modules/FindPkgConfig.cmake:597 (_pkg_check_modules_internal)
cmake/FindLibBSON.cmake:33 (pkg_check_modules)
src/bsoncxx/CMakeLists.txt:67 (find_package)
-- Configuring incomplete, errors occurred!
See also "/data/2/nirmal/mongo_cpp/mongo-cxx-
driver/build/CMakeFiles/CMakeOutput.log".
I checked libbson is already installed in /usr/local/bin .
Unable to figure the root cause.
Kindly assist.
If you are building version 3.1.X or 3.0.x you have to specify libbson of your libmongoc (mongodb c driver) installation.
"Users building mongocxx versions 3.1.x and 3.0.x should specify the libmongoc installation directory by using the -DLIBMONGOC_DIR and -DLIBBSON_DIR options to cmake. See the following example, which assumes that both libmongoc and libbson are installed into /your/cdriver/prefix:"
if you are building on a linux system try something like this:
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local .. -DBSONCXX_POLY_USE_MNMLSTC=1 -DLIBMONGOC_DIR=/usr -DLIBBSON_DIR=/usr/lib64
More detailed information can be found https://mongodb.github.io/mongo-cxx-driver/mongocxx-v3/installation/