cmake-conan
cmake-conan copied to clipboard
[bug] bzip2/1.0.8: Error in build() method on MAC M2
Environment details
- Operating System+version: macOS Sonoma 14.0 on Apple Silicon M2 Pro
- Compiler+version: GCC-11 & Apple-Clang 15
- Conan version: 2.0.13
- Python version: 3.11.4
Steps to reproduce
- Require a dependency that requires bzip2/1.0.8 or require bzip2 directly.
- Build missing dependencies
- The build step of bzip2 fails upon calling
cmake.configure(...)
More precisely, I am using the conan CLion plugin to call conan.
Logs
/Users/maichmueller/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=/Users/maichmueller/Applications/CLion.app/Contents/bin/ninja/mac/ninja -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=conan_provider.cmake -G Ninja -S /Users/maichmueller/GitHub/Relational-Neural-Network -B /Users/maichmueller/GitHub/Relational-Neural-Network/cmake-build-debug -- CPM: Adding package microtar@27076 (27076e1) -- CMake-Conan: first find_package() found. Installing dependencies with Conan -- CMake-Conan: Checking if a default profile exists /Users/maichmueller/.conan2/profiles/default -- CMake-Conan: cmake_system_name=Darwin -- CMake-Conan: cmake_osx_deployment_target= -- CMake-Conan: cmake_system_processor=armv8 -- CMake-Conan: CMake compiler=AppleClang -- CMake-Conan: CMake compiler version=15.0.0.15000040 -- CMake-Conan: [settings] compiler=apple-clang -- CMake-Conan: [settings] compiler.version=15 -- CMake-Conan: Creating profile /Users/maichmueller/GitHub/Relational-Neural-Network/cmake-build-debug/conan_host_profile -- CMake-Conan: Profile: [settings] arch=armv8 os=Macos compiler=apple-clang compiler.version=15 compiler.libcxx=libc++ build_type=Debug [conf] tools.cmake.cmaketoolchain:generator=Ninja tools.build:compiler_executables={"c":"/Library/Developer/CommandLineTools/usr/bin/cc","cpp":"/Library/Developer/CommandLineTools/usr/bin/c++"}
-- CMake-Conan: Installing single configuration Debug -- CMake-Conan: conan install /Users/maichmueller/GitHub/Relational-Neural-Network -of=/Users/maichmueller/GitHub/Relational-Neural-Network/cmake-build-debug/conan --profile:host=default;--profile:host=/Users/maichmueller/GitHub/Relational-Neural-Network/cmake-build-debug/conan_host_profile;--profile:build=default;--build=missing;-g;CMakeDeps
======== Input profiles ======== Profile host: [settings] arch=armv8 build_type=Debug compiler=apple-clang compiler.cppstd=gnu17 compiler.libcxx=libc++ compiler.version=15 os=Macos [conf] tools.cmake.cmaketoolchain:generator=Ninja tools.build:compiler_executables={'c': '/Library/Developer/CommandLineTools/usr/bin/cc', 'cpp': '/Library/Developer/CommandLineTools/usr/bin/c++'}
Profile build: [settings] arch=armv8 build_type=Release compiler=apple-clang compiler.cppstd=gnu17 compiler.libcxx=libc++ compiler.version=15 os=Macos
======== Computing dependency graph ======== Graph root conanfile.py: /Users/maichmueller/GitHub/Relational-Neural-Network/conanfile.py Requirements bzip2/1.0.8#411fc05e80d47a89045edc1ee6f23c1d - Cache
======== Computing necessary packages ======== Requirements bzip2/1.0.8#411fc05e80d47a89045edc1ee6f23c1d:1f07abb3911ca15c6e79abd0bef81abb1e9b67ec - Build
======== Installing packages ========
-------- Installing package bzip2/1.0.8 (1 of 1) -------- bzip2/1.0.8: Building from source bzip2/1.0.8: Package bzip2/1.0.8:1f07abb3911ca15c6e79abd0bef81abb1e9b67ec bzip2/1.0.8: Copying sources to build folder bzip2/1.0.8: Building your package in /Users/maichmueller/.conan2/p/b/bzip249b2cedfb5e7c/b bzip2/1.0.8: Calling generate() bzip2/1.0.8: Generators folder: /Users/maichmueller/.conan2/p/b/bzip249b2cedfb5e7c/b/build/Debug/generators bzip2/1.0.8: CMakeToolchain generated: conan_toolchain.cmake bzip2/1.0.8: CMakeToolchain generated: CMakePresets.json bzip2/1.0.8: Generating aggregated env files bzip2/1.0.8: Generated aggregated env files: ['conanbuild.sh', 'conanrun.sh'] bzip2/1.0.8: Calling build() bzip2/1.0.8: apply_conandata_patches(): No patches defined in conandata bzip2/1.0.8: Running CMake.configure() bzip2/1.0.8: RUN: cmake -G "Ninja" -DCMAKE_TOOLCHAIN_FILE="/Users/maichmueller/.conan2/p/b/bzip249b2cedfb5e7c/b/build/Debug/generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="/Users/maichmueller/.conan2/p/b/bzip249b2cedfb5e7c/p" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Debug" "/Users/maichmueller/.conan2/p/b/bzip249b2cedfb5e7c/b/src/.." /bin/sh: cmake: command not found
bzip2/1.0.8: ERROR: Package '1f07abb3911ca15c6e79abd0bef81abb1e9b67ec' build failed bzip2/1.0.8: WARN: Build folder /Users/maichmueller/.conan2/p/b/bzip249b2cedfb5e7c/b/build/Debug
Recipe 'bzip2/1.0.8' cannot build its binary It is possible that this recipe is not Conan 2.0 ready If the recipe comes from ConanCenter, report it at https://github.com/conan-io/conan-center-index/issues If it is your recipe, check if it is updated to 2.0
ERROR: bzip2/1.0.8: Error in build() method, line 63 cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) ConanException: Error 127 while executing CMake Error at conan_provider.cmake:386 (message): Conan install failed='1' Call Stack (most recent call first): conan_provider.cmake:477 (conan_install) /Users/maichmueller/Applications/CLion.app/Contents/bin/cmake/mac/share/cmake-3.26/Modules/FetchContent.cmake:1580 (find_package) /Users/maichmueller/Applications/CLion.app/Contents/bin/cmake/mac/share/cmake-3.26/Modules/FetchContent.cmake:1762:EVAL:2 (__FetchContent_directPopulate) /Users/maichmueller/Applications/CLion.app/Contents/bin/cmake/mac/share/cmake-3.26/Modules/FetchContent.cmake:1762 (cmake_language) cmake-build-debug/cmake/CPM_0.38.2.cmake:1005 (FetchContent_Populate) cmake-build-debug/cmake/CPM_0.38.2.cmake:799 (cpm_fetch_package) deps/CPM_deps.cmake:1 (CPMAddPackage) CMakeLists.txt:47 (include)
-- Configuring incomplete, errors occurred!
The same problem with bzip2 is occuring in this stackoverflow post.
Hi @maichmueller
I think this is the issue:
/bin/sh: cmake: command not found
It seems you don't have cmake installed in the system. The CMake that you are using is the one in CLion, but when the dependency needs to build from source, it doesn't have a CMake in the system to build. The fact that conan install is called from CMake doesn't immediately make CMake available in the environment.
If you can please try to install a CMake in the system, to check if that works, and let us know.
Then we might want to discuss possible alternatives, maybe we want to automatically add the current CMake to the PATH env-var?
Adding @jcar87, probably this is a cmake-conan issue, not specific to CLion, but any CMake not in the system PATH should still be added to the PATH for dependencies?
Hi @maichmueller
I think this is the issue:
/bin/sh: cmake: command not found
It seems you don't have
cmakeinstalled in the system. The CMake that you are using is the one in CLion, but when the dependency needs to build from source, it doesn't have a CMake in the system to build. The fact thatconan installis called from CMake doesn't immediately make CMake available in the environment.If you can please try to install a CMake in the system, to check if that works, and let us know.
Then we might want to discuss possible alternatives, maybe we want to automatically add the current CMake to the PATH env-var?
Hi @memsharded
thanks a lot for your help! That line was indeed the reason. I discarded it as false alarm, since I ran the entire example from within cmake so could not imagine that cmake would not be known. Adding cmake to the system path resolved this issue!
From a user's perspective it arguably is quite surprising when cmake-conan does not forward the exe path. Up until now i wasn't even aware that I was always running my project and the conan-deps-build stage with 2 different cmake versions. I would imagine it to be clearer to
- take the currently running cmake exe, unless
- an overwrite of the cmake executable for the dependency builds is explicitly specified in the build profile.
Again, thanks for the kind help!
No prob, thanks for your feedback!
I'll move this to the cmake-conan repo, and see if we can automatically add the current exe location to the PATH for dependencies.
@jcar87 I have managed to use the current cmake with:
cmake_minimum_required(VERSION 3.19)
project(myproj)
set(INITIAL_PATH $ENV{PATH})
set(CURRENT_CMAKE_FOLDER ${CMAKE_COMMAND})
cmake_path(GET CURRENT_CMAKE_FOLDER PARENT_PATH CURRENT_CMAKE_FOLDER)
set(FINAL_PATH ${INITIAL_PATH} ${CURRENT_CMAKE_FOLDER})
set(ENV{PATH} "${FINAL_PATH}")
execute_process(COMMAND python build.py)
I am not fully sure if it should append (prioritize system over current) or pre-pend (to prioritize current over system)