CMake Error at C:/Program Files/CMake/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message) - yolo

I am trying to use cmake to compile darknet for YOLO V3. But I'm getting following error:
CMake Error at C:/Program
Files/CMake/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146
(message): Could NOT find PThreads_windows (missing:
PThreads_windows_LIBRARY PThreads_windows_INCLUDE_DIR) Call Stack
(most recent call first): C:/Program
Files/CMake/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393
(_FPHSA_FAILURE_MESSAGE) cmake/Modules/FindPThreads_windows.cmake:39
(find_package_handle_standard_args)
C:/Users/MSI/vcpkg/scripts/buildsystems/vcpkg.cmake:288
(_find_package) CMakeLists.txt:93 (find_package)
How can I fix this?

You have defined CMAKE_TOOLCHAIN_FILE as vcpkg. If this variable is defined, darknet will by default think that you have configured pthread_window in vcpkg (it happens at around 30 ~40 lines in CMakeLists.txt), but you actually not.
So you need to replace
if(WIN32 AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
set(USE_INTEGRATED_LIBS "TRUE" CACHE BOOL "Use libs distributed with this repo")
else()
set(USE_INTEGRATED_LIBS "FALSE" CACHE BOOL "Use libs distributed with this repo")
endif()
by
set(USE_INTEGRATED_LIBS "TRUE" CACHE BOOL "Use libs distributed with this repo")
It will allow darknet to use its own 3rdparty pthreads in the root directory.

Related

CMake can't find BLAS on MSYS2

I am trying to compile this software in the MSYS2 environment on Windows. This is the line looking for the packages:
FIND_PACKAGE(BLAS REQUIRED)
FIND_PACKAGE(LAPACK REQUIRED)
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES})
I have installed the BLAS/LAPACK dependencies using
pacman -S make msys/cmake msys/gcc-fortran mingw64/mingw-w64-x86_64-openblas64
but I get the error messages:
CMake Error at /usr/share/cmake-3.22.1/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find BLAS (missing: BLAS_LIBRARIES)
Call Stack (most recent call first):
/usr/share/cmake-3.22.1/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.22.1/Modules/FindBLAS.cmake:1337 (find_package_handle_standard_args)
CMakeLists.txt:403 (FIND_PACKAGE)
You may find the modified CMakeLists.txt file here (I have commented out all the MPI, MMG, MKL, and APPLE-related entries), and the complete output can be seen here.
I can probably specify the locations explicitly as described here and here
SET(BLAS_LIBRARIES /c/tools/msys64/mingw64/lib/libopenblas_64.a)
SET(LAPACK_LIBRARIES /c/tools/msys64/mingw64/lib/libopenblas_64.a)
but I want CMake to find these dependencies automatically. I would appreciate it if you could help me know what is the canonical way to get BLAS/LAPACK libraries installed under MSYS2 and get CMAKE to find them automatically with the FIND_PACKAGE() functions or otherwise.

CMake can not find Boost Python

I'm trying to build 3d party application using CMake 3.17.5.
I have boost installed by vcpkg (on Windows). I checked I have boost-python installed by vcpkg.
I got the following error in CMake GUI:
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:164 (message):
Could NOT find Boost (missing: python) (found version "1.75.0")
Call Stack (most recent call first):
C:/Program Files (x86)/CMake/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:445 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files (x86)/CMake/share/cmake-3.17/Modules/FindBoost.cmake:2166 (find_package_handle_standard_args)
cmake/modules/FindUSDMonolithic.cmake:71 (find_package)
cmake/defaults/Packages.cmake:34 (find_package)
CMakeLists.txt:11 (include)
I tried setting CMAKE_TOOLCHAIN_FILE to vcpkg.cmake but it didn't hepled.
NOTE: CMake DOES find boost after I set Boost_INCLUDE_DIR to vcpkg/installed/x64-windows/include/ but it still have this weird error. Without setting this variable CMake can not find boost at all and error is different
You should find Python first:
find_package(Python3 REQUIRED COMPONENTS Development)
target_include_directories(MyTarget SYSTEM PRIVATE ${Python3_INCLUDE_DIRS})
find_package(Boost REQUIRED COMPONENTS python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR})
target_link_libraries(MyTarget PRIVATE Boost::python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR})

CMake error - " Some (but not all) targets in this export set were already defined."

I am trying to build a library that is dependent on GDCM. So, I've installed GDCM following instructions that were provided in INSTAL.txt file and did not have any trouble doing it. But, when I tried to use cmake to build the library that is dependent on it, I am getting following message:
CMake Error at /usr/local/lib/gdcm-3.0/GDCMTargets.cmake:37 (message):
Some (but not all) targets in this export set were already defined.
Targets Defined:
gdcmjpeg8;gdcmjpeg12;gdcmjpeg16;gdcmuuid;gdcmCommon;gdcmDICT;gdcmDSED;gdcmIOD;gdcmMSFF
Targets not yet defined:
gdcmexpat;gdcmopenjp2;gdcmcharls;gdcmzlib;socketxx;gdcmMEXD
Call Stack (most recent call first):
/usr/local/lib/gdcm-3.0/GDCMConfig.cmake:39 (include)
CMakeLists.txt:109 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/stefan/Desktop/BioClinica/bdtk/CMakeFiles/CMakeOutput.log".
See also "/home/stefan/Desktop/BioClinica/bdtk/CMakeFiles/CMakeError.log
Here is a portion of the code (from reported line GDCMConfig.make:37) from /usr/local/lib/gdcm-3.8/GDCMConfig.make file:
if(EXISTS ${SELF_DIR}/GDCMTargets.cmake)
# This is an install tree
include(${SELF_DIR}/GDCMTargets.cmake)
get_filename_component(GDCM_INCLUDE_ROOT "${SELF_DIR}/../../include/gdcm-3.0" ABSOLUTE)
set(GDCM_INCLUDE_DIRS ${GDCM_INCLUDE_ROOT})
get_filename_component(GDCM_LIB_ROOT "${SELF_DIR}/../../lib" ABSOLUTE)
set(GDCM_LIBRARY_DIRS ${GDCM_LIB_ROOT})
else()
if(EXISTS ${SELF_DIR}/GDCMExports.cmake)
# This is a build tree
set( GDCM_INCLUDE_DIRS "/home/stefan/gdcm-3.0.7/gdcm/Source/Common;/home/stefan/gdcm-3.0.7/gdcmbin/Source/Common;/home/stefan/gdcm-3.0.7/gdcm/Source/DataStructureAndEncodingDefinition;/home/stefan/gdcm-3.0.7/gdcm/Source/MediaStorageAndFileFormat;/home/stefan/gdcm-3.0.7/gdcm/Source/MessageExchangeDefinition;/home/stefan/gdcm-3.0.7/gdcm/Source/DataDictionary;/home/stefan/gdcm-3.0.7/gdcm/Source/InformationObjectDefinition")
set(GDCM_LIBRARY_DIRS "/home/stefan/gdcm-3.0.7/gdcmbin/bin/.")
include(${SELF_DIR}/GDCMExports.cmake)
else()
message(FATAL_ERROR "ooops")
endif()
endif()

AWS SDK C++: cannot run S3 example

We are trying to build AWS SDK for C++ (only s3 module) on EC2 server, using setup and thread
It compiled fine, including s3 with tests
Next, I tried to compile the
example
But, CMake is throwing the errors (as the error message shows, the file /usr/local/lib/aws-c-event-stream/cmake/static/aws-c-event-stream-targets.cmake does not exist). How do I fix it?
ubuntu#ip:~/awslog$ mkdir sdk_example_builds
ubuntu#ip:~/awslog$ cd sdk_example_builds/
ubuntu#ip:~/awslog/sdk_example_builds$ mkdir s3 && cd s3
ubuntu#ip:~/awslog/sdk_example_builds/s3$ sudo cmake /home/ubuntu/awslog/aws-doc-sdk-examples/cpp/example_code/s3
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE
CMake Error at /usr/local/lib/aws-c-common/cmake/aws-c-common-config.cmake:7 (include):
include could not find load file:
/usr/local/lib/aws-c-common/cmake/static/aws-c-common-targets.cmake
Call Stack (most recent call first):
/usr/share/cmake-3.10/Modules/CMakeFindDependencyMacro.cmake:48 (find_package)
/usr/local/lib/aws-c-event-stream/cmake/aws-c-event-stream-config.cmake:2 (find_dependency)
/usr/share/cmake-3.10/Modules/CMakeFindDependencyMacro.cmake:48 (find_package)
/usr/local/lib/cmake/aws-cpp-sdk-core/aws-cpp-sdk-core-config.cmake:2 (find_dependency)
/usr/local/lib/cmake/AWSSDK/AWSSDKConfig.cmake:292 (find_package)
CMakeLists.txt:15 (find_package)
CMake Error at /usr/local/lib/aws-checksums/cmake/aws-checksums-config.cmake:4 (include):
include could not find load file:
/usr/local/lib/aws-checksums/cmake/static/aws-checksums-targets.cmake
Call Stack (most recent call first):
/usr/share/cmake-3.10/Modules/CMakeFindDependencyMacro.cmake:48 (find_package)
/usr/local/lib/aws-c-event-stream/cmake/aws-c-event-stream-config.cmake:3 (find_dependency)
/usr/share/cmake-3.10/Modules/CMakeFindDependencyMacro.cmake:48 (find_package)
/usr/local/lib/cmake/aws-cpp-sdk-core/aws-cpp-sdk-core-config.cmake:2 (find_dependency)
/usr/local/lib/cmake/AWSSDK/AWSSDKConfig.cmake:292 (find_package)
CMakeLists.txt:15 (find_package)
CMake Error at /usr/local/lib/aws-c-event-stream/cmake/aws-c-event-stream-config.cmake:8 (include):
include could not find load file:
/usr/local/lib/aws-c-event-stream/cmake/static/aws-c-event-stream-targets.cmake
Call Stack (most recent call first):
/usr/share/cmake-3.10/Modules/CMakeFindDependencyMacro.cmake:48 (find_package)
/usr/local/lib/cmake/aws-cpp-sdk-core/aws-cpp-sdk-core-config.cmake:2 (find_dependency)
/usr/local/lib/cmake/AWSSDK/AWSSDKConfig.cmake:292 (find_package)
CMakeLists.txt:15 (find_package)
-- Found aws-cpp-sdk-core
-- Try finding aws-cpp-sdk-s3
-- Found aws-cpp-sdk-s3
-- Configuring incomplete, errors occurred!
See also "/home/ubuntu/awslog/sdk_example_builds/s3/CMakeFiles/CMakeOutput.log".
See also "/home/ubuntu/awslog/sdk_example_builds/s3/CMakeFiles/CMakeError.log".
From your log it is quite clear that the error is related to the cmake type of library.
In your case cmake is being called with a default to the static library; you can see that by checking at the path it is looking for:
/usr/local/lib/aws-c-common/cmake/static/aws-c-common-targets.cmake
In order to be able to compile your examples, just run CMake telling it to link over shared libraries as follows:
sudo cmake /home/ubuntu/awslog/aws-doc-sdk-examples/cpp/example_code/s3 -DBUILD_SHARED_LIBS=ON
And then
cd /home/ubuntu/awslog/aws-doc-sdk-examples/cpp/example_code/s3
sudo make
You're done!
P.S.: it is not clear why the AWS SDK library does not include the static cmake files (probably something in your configuration is missing). However this way you can used the shared library version of the SDK and you will be able to work the same way.

Linking different versions of MPI with PETSc in CMAKE

I want to use PETSc 3.8.2 with different versions of MPI (i.e. mpich-3.2.1, openmpi-3.0.0). Everything went well when I complied petsc with different MPIs. However, when I was trying to use FindMPI.cmake to locate the MPI, error occured as following,
-- Could NOT find MPI_C (missing: MPI_C_WORKS)
-- Could NOT find MPI_CXX (missing: MPI_CXX_WORKS)
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find MPI (missing: MPI_C_FOUND MPI_CXX_FOUND)
Call Stack (most recent call first):
/usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake/Modules/FindMPI.cmake:1392 (find_package_handle_standard_args)
CMakeLists.txt:17 (FIND_PACKAGE)
And then I tried SET(MPI_DIR /opt/mpich-3.2.1), SET(MPI_ROOT /opt/mpich-3.2.1), and LIST(APPEND CMAKE_PREFIX_PATH /opt/mpich-3.2.1), similarly for openmpi. However, none of them can solve my problem. I configured both MPI package by ./configure --prefix=/opt/name-version., and then make and sudo make install.
Can anyone help me solve this problem ? Thanks in advance.