I am trying to compile a project in C++ coded by other persons (Orthanc for the people that knows a bit of medical imaging) on Ubuntu 22.04. One library needed is pugixml but CHECK_INCLUDE_FILE_CXX doesn't seem to find the header of that library
I have installed pugixml through apt-get and I also have downloaded the library and put it in /usr/lib/.
I also checked the source code and this is the function call that returns the error
CHECK_INCLUDE_FILE_CXX(pugixml.hpp HAVE_PUGIXML_H)
if (NOT HAVE_PUGIXML_H)
message(FATAL_ERROR "Please install the libpugixml-dev package")
endif()
link_libraries(pugixml)
and when we include that library with no set up (I'll put all the inclusions)
include(CMakePushCheckState)
include(CheckFunctionExists)
include(CheckIncludeFile)
include(CheckIncludeFileCXX)
include(CheckIncludeFiles)
include(CheckLibraryExists)
include(CheckStructHasMember)
include(CheckSymbolExists)
include(CheckTypeSize)
include(FindPythonInterp)
this is the command I use for the cmake (given by the documentation of orthanc) :
cmake -DCMAKE_BUILD_TYPE=Release -DUSE_SYSTEM_CIVETWEB=OFF -DALLOW_DOWNLOADS=ON path/to/Orthanc/orthanc/OrthancServer
Does someone know what I can do to resolve that problem? Rewriting the code isn't a possibility for me thus I'd prefer to use Pugixml.
EDIT : This is the complete logs that appear when I launch cmake --fresh
CMake Deprecation Warning at CMakeLists.txt:21 (cmake_minimum_required):
Compatibility with CMake < 3.5 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.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
CMake Warning (dev) at /home/ypollet/Numerisation/Orthanc/orthanc/OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake:46 (include):
Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
are removed. Run "cmake --help-policy CMP0148" for policy details. Use
the cmake_policy command to set the policy and suppress this warning.
Call Stack (most recent call first):
CMakeLists.txt:79 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Found PythonInterp: /usr/bin/python3.10 (found version "3.10.12")
-- Looking for sqlite3.h
-- Looking for sqlite3.h - found
SQLite include dir: /usr/include
Detected version of SQLite: 3037002
-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found version "3.0.2")
-- Found CURL: /usr/lib/x86_64-linux-gnu/libcurl.so (found version "7.81.0")
-- Looking for C++ include civetweb.h
-- Looking for C++ include civetweb.h - not found
CMake Error at /home/ypollet/Numerisation/Orthanc/orthanc/OrthancFramework/Resources/CMake/CivetwebConfiguration.cmake:108 (message):
Please install the libcivetweb-dev package
Call Stack (most recent call first):
/home/ypollet/Numerisation/Orthanc/orthanc/OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake:306 (include)
CMakeLists.txt:79 (include)
-- Configuring incomplete, errors occurred!
The warning is because the project ask for a cmake version of atleast 2.8 with CMP0058 :
cmake_minimum_required(VERSION 2.8)
cmake_policy(SET CMP0058 NEW)
my version is :
$ cmake --version
cmake version 3.27.0
CMake suite maintained and supported by Kitware (kitware.com/cmake).
CHECK_INCLUDE_FILE_CXX
will check the same include directories as the selected compiler would to confirm whether an include file is present.On the Ubuntu Package Search we can see that the file
/usr/include/pugixml.hpp
is part of the libpugixml-dev package. IfCHECK_INCLUDE_FILE_CXX
does not find that file, despite/usr/include
being part of the default compiler include paths on Ubuntu, I conclude that you do not have that package installed. Did you maybe just install thelibpugixml1v5
package and forgot the dev one? After you installed it, please don't forget to runcmake --fresh <src_directory>
in your build directory, to reset the build cache.For a minimum reproducable example, you could place the following in a
CMakeLists.txt
in an empty folder and typecmake .
into your console (in that folder), to see if you get an error: