c++ubuntucmakegithub-actionspugixml

Cmake and PugiXML in Github Actions


i try to get pugixml running in github actions. And i would be happy with any solution that is working...

I added the download to the cmake.yml

      run: sudo apt-get update && sudo apt-get install libsystemd-dev libpugixml-dev

Ubuntu inside github action is installing 1.10-1:

Get:1 http://azure.archive.ubuntu.com/ubuntu focal/universe amd64 libpugixml1v5 amd64 1.10-1 [89.9 kB]
Get:2 http://azure.archive.ubuntu.com/ubuntu focal/universe amd64 libpugixml-dev amd64 1.10-1 [105 kB]
Get:3 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 libsystemd-dev amd64 245.4-4ubuntu3.11 [246 kB]

On my private machine i use Debian testing, where Version: 1.11.4-1 of pugixml is installed.

CMake now tells, that it could not find version 1.10 or higher. It looks like ubuntu's version tag is not correct (?). Is there a way to debug inside these github-actions?

CMake Deprecation Warning at plog/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 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.


-- 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  
-- Checking for module 'libsystemd'
--   Found libsystemd, version 245
CMake Error at CMakeLists.txt:20 (find_package):
  Could not find a configuration file for package "pugixml" that is
-- Configuring incomplete, errors occurred!
  compatible with requested version "1.10".
See also "/home/runner/work/sdbus_for_dummies/sdbus_for_dummies/build/CMakeFiles/CMakeOutput.log".

See also "/home/runner/work/sdbus_for_dummies/sdbus_for_dummies/build/CMakeFiles/CMakeError.log".
  The following configuration files were considered but not accepted:

    /usr/lib/x86_64-linux-gnu/cmake/pugixml/pugixml-config.cmake, version: unknown
    /lib/x86_64-linux-gnu/cmake/pugixml/pugixml-config.cmake, version: unknown

Solution

  • I solved it by using vcpkg to install pugixml:

        - name: Install pugixml via vcpkg
          run: sudo vcpkg install pugixml && sudo vcpkg integrate install
      
        - name: Configure CMake
          # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
          # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
          run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake
        - name: Build
          # Build your program with the given configuration
          run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}