I run my open C++ source code on github actions. I compile a color library called OpenColorIO. Since github.com updated their macOS 12 and now macOS 14 machines to cmake 3.29.1, I am getting the following errors with expat (notice the case issues):
CMake Warning (dev) at /opt/homebrew/Cellar/cmake/3.29.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
[29764](https://github.com/ggarra13/mrv2/actions/runs/8624544258/job/23639696799#step:15:29765) The package name passed to `find_package_handle_standard_args` (EXPAT) does
[29765](https://github.com/ggarra13/mrv2/actions/runs/8624544258/job/23639696799#step:15:29766) not match the name of the calling package (expat). This can lead to
[29766](https://github.com/ggarra13/mrv2/actions/runs/8624544258/job/23639696799#step:15:29767) problems in calling code that expects `find_package` result variables
[29767](https://github.com/ggarra13/mrv2/actions/runs/8624544258/job/23639696799#step:15:29768) (e.g., `_FOUND`) to follow a certain pattern.
[29768](https://github.com/ggarra13/mrv2/actions/runs/8624544258/job/23639696799#step:15:29769)Call Stack (most recent call first):
[29769](https://github.com/ggarra13/mrv2/actions/runs/8624544258/job/23639696799#step:15:29770) /opt/homebrew/Cellar/cmake/3.29.1/share/cmake/Modules/Findexpat.cmake:114 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
[29770](https://github.com/ggarra13/mrv2/actions/runs/8624544258/job/23639696799#step:15:29771) /opt/homebrew/Cellar/cmake/3.29.1/share/cmake/Modules/CMakeFindDependencyMacro.cmake:76 (find_package)
[29771](https://github.com/ggarra13/mrv2/actions/runs/8624544258/job/23639696799#step:15:29772) /Users/runner/work/mrv2/mrv2/BUILD-Darwin-arm64/Release/install/lib/cmake/OpenColorIO/OpenColorIOConfig.cmake:33 (find_dependency)
[29772](https://github.com/ggarra13/mrv2/actions/runs/8624544258/job/23639696799#step:15:29773) CMakeLists.txt:163 (find_package)
[29773] https://github.com/ggarra13/mrv2/actions/runs/8624544258/job/23639696799#step:15:29774)This warning is for project developers. Use -Wno-dev to suppress it.
[29774](https://github.com/ggarra13/mrv2/actions/runs/8624544258/job/23639696799#step:15:29775)
[29775](https://github.com/ggarra13/mrv2/actions/runs/8624544258/job/23639696799#step:15:29776)-- Found EXPAT: /Users/runner/work/mrv2/mrv2/BUILD-Darwin-arm64/Release/install/lib/libexpat.a (found version "2.5.0")
[29776](https://github.com/ggarra13/mrv2/actions/runs/8624544258/job/23639696799#step:15:29777)CMake Error at CMakeLists.txt:163 (find_package):
[29777](https://github.com/ggarra13/mrv2/actions/runs/8624544258/job/23639696799#step:15:29778) Found package configuration file:
[29778](https://github.com/ggarra13/mrv2/actions/runs/8624544258/job/23639696799#step:15:29779)
[29779](https://github.com/ggarra13/mrv2/actions/runs/8624544258/job/23639696799#step:15:29780) /Users/runner/work/mrv2/mrv2/BUILD-Darwin-arm64/Release/install/lib/cmake/OpenColorIO/OpenColorIOConfig.cmake
[29780](https://github.com/ggarra13/mrv2/actions/runs/8624544258/job/23639696799#step:15:29781)
[29781](https://github.com/ggarra13/mrv2/actions/runs/8624544258/job/23639696799#step:15:29782) but it set OpenColorIO_FOUND to FALSE so package "OpenColorIO" is
[29782](https://github.com/ggarra13/mrv2/actions/runs/8624544258/job/23639696799#step:15:29783) considered to be NOT FOUND. Reason given by package:
[29783](https://github.com/ggarra13/mrv2/actions/runs/8624544258/job/23639696799#step:15:29784)
[29784](https://github.com/ggarra13/mrv2/actions/runs/8624544258/job/23639696799#step:15:29785) OpenColorIO could not be found because dependency expat could not be found.
I am looking for guidance. Is this a cmake 3.29.1, an OpenColorIO or a Github issue?
It seems to be a cmake issue. Github macOS machines reverted to cmake 3.29 and all is fine again with them. However, linux machines are still running on 3.29.1 and in the case of OpenColorIO, the error is not about expat but about pystring (which I build as part of the process). Here’s the logs:
CMake Error at /usr/local/share/cmake-3.29/Modules/CMakeFindDependencyMacro.cmake:76 (find_package):
By not providing "Findpystring.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "pystring",
but CMake did not find one.
Could not find a package configuration file provided by "pystring" with any
of the following names:
pystringConfig.cmake
pystring-config.cmake
Add the installation prefix of "pystring" to CMAKE_PREFIX_PATH or set
"pystring_DIR" to a directory containing one of the above files. If
"pystring" provides a separate development package or SDK, be sure it has
been installed.
Call Stack (most recent call first):
/home/runner/work/mrv2/mrv2/BUILD-Linux-amd64/Release/install/lib/cmake/OpenColorIO/OpenColorIOConfig.cmake:41 (find_dependency)
CMakeLists.txt:163 (find_package)
Linux machines fail similarly on finding OpenColorIO but the error is about the “pystring” which is built and installed previously as part of the build process. The problem also seems to be a case issue:
Notice how “modules” is lowercase, which is not the standard in cmake. I checked the CMAKE_MODULE_PATH in the OpenColorIOConfig.cmake that is appended and it is lowercase. Could it be cmake 3.29.1 turns it into uppercase? Has handling of case changed in cmake 3.29.1?
This is not a CMake problem.
The GitHub images are not up to date!
With brew on my MACOS it works file:
bash-5.2$ cmake -B build -S . -G Ninja
-- The CXX compiler identification is Clang 17.0.6
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/local/opt/llvm/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenColorIO: /usr/local/lib/cmake/OpenColorIO/OpenColorIOConfig.cmake (found version "2.3.2")
-- Configuring done (3.9s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/clausklein/Workspace/cpp/cxx20/test/build
bash-5.2$
Actually, I WAS RIGHT. My simple test FAILED! I had forgotten to say:
find_package(OpenColorIO REQUIRED)
I am attaching .tar.gz file with a self-contained (not so simple I’ll admit) project of OpenColorIO failing (at least on Linux). It fails just as in GitHub Actions.
CMake Warning (dev) at /usr/local/share/cmake-3.29/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (EXPAT) does
not match the name of the calling package (expat). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
/usr/local/share/cmake-3.29/Modules/Findexpat.cmake:117 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
/usr/local/share/cmake-3.29/Modules/CMakeFindDependencyMacro.cmake:76 (find_package)
build/install/lib/cmake/OpenColorIO/OpenColorIOConfig.cmake:33 (find_dependency)
CMakeLists.txt:5 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Found EXPAT: /Users/clausklein/Downloads/build_ocio/build/install/lib/libexpat.a (found version "2.5.0")
CMake Error at CMakeLists.txt:5 (find_package):
Found package configuration file:
/Users/clausklein/Downloads/build_ocio/build/install/lib/cmake/OpenColorIO/OpenColorIOConfig.cmake
but it set OpenColorIO_FOUND to FALSE so package "OpenColorIO" is
considered to be NOT FOUND. Reason given by package:
OpenColorIO could not be found because dependency expat could not be found.
-- Configuring incomplete, errors occurred!
OpenColorIo is wrong:
find_dependency(expat 2.5.0) must be find_dependency(EXPAT 2.5.0)
cmake_minimum_required(VERSION 3.29)
project(dummy-project LANGUAGES CXX)
find_package(expat 2.5.0 REQUIRED)
find_package(OpenColorIO REQUIRED)
I get the warning too:
bash-5.2$ rm -rf build/
bash-5.2$ cmake -G Ninja -B build -S .
-- The CXX compiler identification is Clang 17.0.6
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/local/opt/llvm/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning (dev) at /usr/local/share/cmake-3.29/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (EXPAT) does
not match the name of the calling package (expat). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
/usr/local/share/cmake-3.29/Modules/Findexpat.cmake:117 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:5 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Found EXPAT: /usr/local/Cellar/expat/2.6.2/lib/libexpat.dylib (found version "2.6.2")
-- Found OpenColorIO: /usr/local/lib/cmake/OpenColorIO/OpenColorIOConfig.cmake (found version "2.3.2")
-- Configuring done (1.7s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/clausklein/Downloads/build_ocio/build
bash-5.2$
I have multiple dependencies, some of which overlap (for example, pystring is used by OpenTimelineIO and OpenColorIO, IIRC). Building it independently saves time, makes the version consistant across libraries, etc.
Correct. But find_package(expat) should work as it is there in the OpenColorIO package dependency, and int its CMAKE_MODULE_PATH, without going to pick up EXPAT again manually. On Linux I also get pystring failing besides EXPAT.
I posted to the developer forum and the cmake developers acknowledged there was a change in behavior in cmake between v3.29 and v3.29.1 that broke backwards compatibility. I will continue the thread over there to see what’s the next step (change back of cmake, change of projects that use the v3.29 behavior, or something else?).