From 88ca30842872370546922b5e4d0dd91ea64e9b4d Mon Sep 17 00:00:00 2001 From: Maurice Date: Sat, 8 Aug 2026 17:09:36 +0700 Subject: [PATCH 1/2] Add macOS clang-scan-deps support --- vinca/main.py | 35 +++++++++++++++++++++---- vinca/templates/build_ament_cmake.sh.in | 13 +++++++++ vinca/templates/build_catkin.sh.in | 13 +++++++++ 3 files changed, 56 insertions(+), 5 deletions(-) diff --git a/vinca/main.py b/vinca/main.py index aab193b..6428c9e 100644 --- a/vinca/main.py +++ b/vinca/main.py @@ -424,27 +424,41 @@ def generate_output(pkg_shortname, vinca_conf, distro, version, all_pkgs=None): output["requirements"]["run"].extend(resolved_python) output["requirements"]["host"].extend(resolved_python) - if is_dummy_metapackage(pkg_shortname, vinca_conf): + is_dummy_package = is_dummy_metapackage(pkg_shortname, vinca_conf) + build_type = pkg.get_build_type() + + if is_dummy_package: # Dummy recipes do not actually build anything, so we set the script to empty output["build"]["script"] = "" - elif pkg.get_build_type() in ["cmake", "catkin"]: + elif build_type in ["cmake", "catkin"]: output["build"]["script"] = ( "${{ '$RECIPE_DIR/build_catkin.sh' if unix or wasm32 else '%RECIPE_DIR%\\\\bld_catkin.bat' }}" ) - elif pkg.get_build_type() in ["ament_cmake"]: + elif build_type in ["ament_cmake"]: output["build"]["script"] = ( "${{ '$RECIPE_DIR/build_ament_cmake.sh' if unix or wasm32 else '%RECIPE_DIR%\\\\bld_ament_cmake.bat' }}" ) - elif pkg.get_build_type() in ["ament_python"]: + elif build_type in ["ament_python"]: output["build"]["script"] = ( "${{ '$RECIPE_DIR/build_ament_python.sh' if unix or wasm32 else '%RECIPE_DIR%\\\\bld_ament_python.bat' }}" ) resolved_setuptools = resolve_pkgname("python-setuptools", vinca_conf, distro) output["requirements"]["host"].extend(resolved_setuptools) else: - print(f"Unknown build type for {pkg_shortname}: {pkg.get_build_type()}") + print(f"Unknown build type for {pkg_shortname}: {build_type}") return None + if not is_dummy_package and build_type in ["cmake", "catkin", "ament_cmake"]: + output["requirements"]["build"].append( + { + "if": "osx", + "then": [ + "clang-tools ${{ (cxx_compiler_version ~ '.*') if " + "cxx_compiler_version is defined else '*' }}" + ], + } + ) + if vinca_conf.get("mutex_package"): mutex_dep = get_mutex_package_dependency(vinca_conf, distro) if mutex_dep: @@ -1152,6 +1166,17 @@ def parse_package(pkg, distro, vinca_conf, path): "${{ '$RECIPE_DIR/build_catkin.sh' if unix or wasm32 else '%RECIPE_DIR%\\\\bld_catkin.bat' }}" ) + if pkg.get_build_type() in ["cmake", "catkin", "ament_cmake"]: + recipe["requirements"]["build"].append( + { + "if": "osx", + "then": [ + "clang-tools ${{ (cxx_compiler_version ~ '.*') if " + "cxx_compiler_version is defined else '*' }}" + ], + } + ) + return recipe diff --git a/vinca/templates/build_ament_cmake.sh.in b/vinca/templates/build_ament_cmake.sh.in index cc25a25..4b9e7cd 100644 --- a/vinca/templates/build_ament_cmake.sh.in +++ b/vinca/templates/build_ament_cmake.sh.in @@ -100,6 +100,18 @@ else export CMAKE_BLD="cmake" fi; +CMAKE_CLANG_SCAN_DEPS_ARGS=() +if [[ $target_platform =~ osx.* ]]; then + CLANG_SCAN_DEPS="$BUILD_PREFIX/bin/clang-scan-deps" + if [[ ! -x "$CLANG_SCAN_DEPS" ]]; then + echo "Missing executable clang-scan-deps at $CLANG_SCAN_DEPS" >&2 + exit 1 + fi + CMAKE_CLANG_SCAN_DEPS_ARGS+=( + "-DCMAKE_CXX_COMPILER_CLANG_SCAN_DEPS=$CLANG_SCAN_DEPS" + ) +fi + if [ "${PKG_NAME}" == "@(ros_package_prefix)-rmw-wasm-cpp" ]; then WORK_DIR=$SRC_DIR/$PKG_NAME/src/work/rmw_wasm_cpp elif [ "${PKG_NAME}" == "@(ros_package_prefix)-wasm-cpp" ]; then @@ -132,6 +144,7 @@ $CMAKE_GEN \ -DCMAKE_OSX_DEPLOYMENT_TARGET=$OSX_DEPLOYMENT_TARGET \ --compile-no-warning-as-error \ $EXTRA_CMAKE_ARGS \ + "${CMAKE_CLANG_SCAN_DEPS_ARGS[@@]}" \ @(additional_cmake_args) \ $WORK_DIR diff --git a/vinca/templates/build_catkin.sh.in b/vinca/templates/build_catkin.sh.in index 157fccf..a6a75e6 100644 --- a/vinca/templates/build_catkin.sh.in +++ b/vinca/templates/build_catkin.sh.in @@ -81,6 +81,18 @@ if [[ $target_platform =~ emscripten.* ]]; then " fi +CMAKE_CLANG_SCAN_DEPS_ARGS=() +if [[ $target_platform =~ osx.* ]]; then + CLANG_SCAN_DEPS="$BUILD_PREFIX/bin/clang-scan-deps" + if [[ ! -x "$CLANG_SCAN_DEPS" ]]; then + echo "Missing executable clang-scan-deps at $CLANG_SCAN_DEPS" >&2 + exit 1 + fi + CMAKE_CLANG_SCAN_DEPS_ARGS+=( + "-DCMAKE_CXX_COMPILER_CLANG_SCAN_DEPS=$CLANG_SCAN_DEPS" + ) +fi + export SKIP_TESTING=@(skip_testing) if [ "${PKG_NAME}" == "@(ros_package_prefix)-euslisp" ] || [ "${PKG_NAME}" = "@(ros_package_prefix)-jskeus" ] || [ "${PKG_NAME}" = "@(ros_package_prefix)-roseus" ]; then @@ -109,6 +121,7 @@ cmake ${CMAKE_ARGS} --compile-no-warning-as-error \ -DCATKIN_BUILD_BINARY_PACKAGE=$CATKIN_BUILD_BINARY_PACKAGE \ -DCMAKE_OSX_DEPLOYMENT_TARGET=$OSX_DEPLOYMENT_TARGET \ $EXTRA_CMAKE_ARGS \ + "${CMAKE_CLANG_SCAN_DEPS_ARGS[@@]}" \ @(additional_cmake_args) \ -G "$GENERATOR" \ $SRC_DIR/$PKG_NAME/src/work/@(additional_folder) From 37f709127b4b830593cf981452369b972be2be55 Mon Sep 17 00:00:00 2001 From: Maurice Date: Sat, 8 Aug 2026 17:12:07 +0700 Subject: [PATCH 2/2] Explain macOS clang scanner lookup --- vinca/templates/build_ament_cmake.sh.in | 2 ++ vinca/templates/build_catkin.sh.in | 2 ++ 2 files changed, 4 insertions(+) diff --git a/vinca/templates/build_ament_cmake.sh.in b/vinca/templates/build_ament_cmake.sh.in index 4b9e7cd..549e89b 100644 --- a/vinca/templates/build_ament_cmake.sh.in +++ b/vinca/templates/build_ament_cmake.sh.in @@ -100,6 +100,8 @@ else export CMAKE_BLD="cmake" fi; +# CMake tries to find arm64-apple-darwin20.0.0-clang-scan-deps but only clang-scan-deps (without prefix) +# are found if using clang < 22.*, so we need to manually specify the path CMAKE_CLANG_SCAN_DEPS_ARGS=() if [[ $target_platform =~ osx.* ]]; then CLANG_SCAN_DEPS="$BUILD_PREFIX/bin/clang-scan-deps" diff --git a/vinca/templates/build_catkin.sh.in b/vinca/templates/build_catkin.sh.in index a6a75e6..9a5c43c 100644 --- a/vinca/templates/build_catkin.sh.in +++ b/vinca/templates/build_catkin.sh.in @@ -81,6 +81,8 @@ if [[ $target_platform =~ emscripten.* ]]; then " fi +# CMake tries to find arm64-apple-darwin20.0.0-clang-scan-deps but only clang-scan-deps (without prefix) +# are found if using clang < 22.*, so we need to manually specify the path CMAKE_CLANG_SCAN_DEPS_ARGS=() if [[ $target_platform =~ osx.* ]]; then CLANG_SCAN_DEPS="$BUILD_PREFIX/bin/clang-scan-deps"