bazel-contrib / bazel-contrib/rules_foreign_cc
`CMAKE_MAKE_PROGRAM` issue in rust example
- Dominant language
- Starlark
- Stars
- 737
- Forks
- 270
- PR merge metrics
- No merged PRs in 30d
Description
In my project I'm using the following trick from the examples in this repo: https://github.com/bazel-contrib/rules_foreign_cc/blob/2eca712c15301c1f4e71ceec21e6271f373501e2/examples/MODULE.bazel#L46-L57
This works fine on machines without `cmake`, but when I try to run the build from a machine without regular `make` installed however, I get the following error:
```
INFO: Invocation ID: 3a52c595-3d4a-411e-96d9-358185586e64
INFO: Streaming build results to: https://axadelta.buildbuddy.io/invocation/3a52c595-3d4a-411e-96d9-358185586e64
INFO: Analyzed 210 targets (772 packages loaded, 49187 targets configured).
ERROR: /home/mg/.cache/bazel/_bazel_mg/e0890c4bddef48fe519e71582abd3fc5/external/rules_rust++crate+crates__libz-ng-sys-1.1.23/BUILD.bazel:77:19: Running Cargo build script libz-ng-sys failed: (Exit 1): runner failed: error executing CargoBuildScriptRun command (from target @@rules_rust++crate+crates__libz-ng-sys-1.1.23//:_bs) bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/rules_rust+/cargo/private/cargo_build_script_runner/runner ... (remaining 10 arguments skipped)
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
Build script process failed with exit code 101
--stdout:
CMAKE_TOOLCHAIN_FILE_x86_64-unknown-linux-gnu = None
CMAKE_TOOLCHAIN_FILE_x86_64_unknown_linux_gnu = None
HOST_CMAKE_TOOLCHAIN_FILE = None
CMAKE_TOOLCHAIN_FILE = None
CMAKE_GENERATOR_x86_64-unknown-linux-gnu = None
CMAKE_GENERATOR_x86_64_unknown_linux_gnu = None
HOST_CMAKE_GENERATOR = None
CMAKE_GENERATOR = None
CMAKE_PREFIX_PATH_x86_64-unknown-linux-gnu = None
CMAKE_PREFIX_PATH_x86_64_unknown_linux_gnu = None
HOST_CMAKE_PREFIX_PATH = None
CMAKE_PREFIX_PATH = None
CMAKE_x86_64-unknown-linux-gnu = None
CMAKE_x86_64_unknown_linux_gnu = None
HOST_CMAKE = None
CMAKE = Some("/home/mg/.cache/bazel/_bazel_mg/e0890c4bddef48fe519e71582abd3fc5/sandbox/linux-sandbox/2599/execroot/_main/external/rules_foreign_cc++tools+cmake-3.31.8-linux-x86_64/bin/cmake")
-- Using CMake version 3.31.8
-- ZLIB_HEADER_VERSION: 1.3.1
-- ZLIBNG_HEADER_VERSION: 2.2.5
-- Configuring incomplete, errors occurred!
--stderr:
running: cd "/home/mg/.cache/bazel/_bazel_mg/e0890c4bddef48fe519e71582abd3fc5/sandbox/linux-sandbox/2599/execroot/_main/bazel-out/k8-fastbuild/bin/external/rules_rust++crate+crates__libz-ng-sys-1.1.23/_bs.out_dir/build" && CMAKE_PREFIX_PATH="" LC_ALL="C" "/home/mg/.cache/bazel/_bazel_mg/e0890c4bddef48fe519e71582abd3fc5/sandbox/linux-sandbox/2599/execroot/_main/external/rules_foreign_cc++tools+cmake-3.31.8-linux-x86_64/bin/cmake" "/home/mg/.cache/bazel/_bazel_mg/e0890c4bddef48fe519e71582abd3fc5/sandbox/linux-sandbox/2599/execroot/_main/bazel-out/k8-fastbuild/bin/external/rules_rust++crate+crates__libz-ng-sys-1.1.23/_bs.cargo_runfiles/rules_rust++crate+crates__libz-ng-sys-1.1.23/src/zlib-ng" "-B" "/home/mg/.cache/bazel/_bazel_mg/e0890c4bddef48fe519e71582abd3fc5/sandbox/linux-sandbox/2599/execroot/_main/bazel-out/k8-fastbuild/bin/external/rules_rust++crate+crates__libz-ng-sys-1.1.23/_bs.out_dir/build" "-DBUILD_SHARED_LIBS=OFF" "-DZLIB_COMPAT=OFF" "-DZLIB_ENABLE_TESTS=OFF" "-DWITH_GZFILEOP=ON" "-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_INSTALL_PREFIX=/home/mg/.cache/bazel/_bazel_mg/e0890c4bddef48fe519e71582abd3fc5/sandbox/linux-sandbox/2599/execroot/_main/bazel-out/k8-fastbuild/bin/external/rules_rust++crate+crates__libz-ng-sys-1.1.23/_bs.out_dir" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 -w -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -fno-canonical-system-headers -Wno-builtin-macro-redefined -D__DATE__=\"redacted\" -D__TIMESTAMP__=\"redacted\" -D__TIME__=\"redacted\"" "-DCMAKE_C_COMPILER=/usr/bin/gcc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 -w -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -std=c++17 -fno-canonical-system-headers -Wno-builtin-macro-redefined -D__DATE__=\"redacted\" -D__TIMESTAMP__=\"redacted\" -D__TIME__=\"redacted\"" "-DCMAKE_CXX_COMPILER=/usr/bin/gcc" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 -w -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -fno-canonical-system-headers -Wno-builtin-macro-redefined -D__DATE__=\"redacted\" -D__TIMESTAMP__=\"redacted\" -D__TIME__=\"redacted\"" "-DCMAKE_ASM_COMPILER=/usr/bin/gcc" "-DCMAKE_BUILD_TYPE=Debug"
CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
thread 'main' (7) panicked at external/rules_rust++crate+crates__cmake-0.1.57/src/lib.rs:1132:5:
command did not execute successfully, got: exit status: 1
build script failed, must exit now
...
```
Is there some way to get `make` from `rules_foreign_cc` to be used here too?
Contributor guide
Research direction
Start with examples/MODULE.bazel, especially lines 46-57, and reproduce the Rust example on a machine without regular make installed. Trace how the CMake tool is supplied and verify the build completes using the make tool from rules_foreign_cc rather than requiring a host installation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, rust
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100