Open joseph-henry opened 3 years ago
A clue:
If I replace the dependency on my published crate in the test app from:
[dependencies]
my_lib = "0.1.0"
to
[dependencies]
my_lib = { path = "/my/local/crate/path" }
Everything works, compiling my crate will no longer complain about a missing cmake.
If this didn't work at all it would make more sense, but somehow pulling a crate and building it is different than building the original local copy?
Are you sure cmake
is in your PATH
when the build script is executed? That's basically what that error message is saying.
Also encountered this. cmake
is in /usr/bin
, and the directory is in PATH
It turns out some files in the cmake argument are missing. The "is cmake not installed?" error message is actually misleading in this case.
Same problem here. And I found that if comment out Config::out_dir()
then everything would be OK.
So I have found that using out_dir works, if the directory passed to out_dir
exists, and fails with the "is cmake not installed" error message otherwise.
So for the OP, in the build script change "target", passed to out_dir
, to an absolute path, and use std::fs::create_dir_all
to make sure the directory exists.
Oh, rereading what https://github.com/rust-lang/cmake-rs/issues/118#issuecomment-865958965 this comment says, I am echoing @NOBLES5E, but providing more information.
Providing more information, and a fix. https://github.com/rust-lang/cmake-rs/blob/00e6b220342a8b0ec4548071928ade38fd5f691b/src/lib.rs#L498 silently ignores an Err, Result if OUT_DIR or parents do not exist.
https://github.com/rust-lang/cmake-rs/blob/00e6b220342a8b0ec4548071928ade38fd5f691b/src/lib.rs#L524 a non-existent directory is passed to Command
current_dir
, which finally errors in run
https://github.com/rust-lang/cmake-rs/blob/00e6b220342a8b0ec4548071928ade38fd5f691b/src/lib.rs#L1019 printing "is cmake not installed".
I think the thing to do is use create_dir_all
to make sure the OUT_DIR parents exists. I'll have a PR up shortly.
I just got this error in GitHub Actions on Windows:
The strange thing is that according to https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md official Windows server 2022 runners do have CMake installed on them.
UPD: My apologies, it was a custom GitHub Actions runner.
UPD: My apologies, it was a custom GitHub Actions runner. @nazar-pc did you have success with the windows-2022 runner?
@nazar-pc did you have success with the windows-2022 runner?
Yes, with both official GitHub runner and self-hosted
Encountered the same issue. My workaround is:
// build.rs
use std::env;
// irrelevant - for better error message
extern crate miette;
fn main() -> miette::Result<()> {
env::set_var("CMAKE_aarch64_apple_darwin", "/opt/homebrew/bin/cmake"); // <-- add this line
// ...
}
Basically, this workaround allows cmake::Config::cmake_executable
to use a user-defined executable as cmake, and by specifying the full path to cmake, I managed to get rid of the is cmake not installed?
error. The source code tells us to use a format of CMAKE_{target.replace('-', "_")}
, so one can run this shell command to get a target triplet for cmake
:
# see-also: https://wiki.archlinux.org/title/Rust_package_guidelines
echo CMAKE_$(rustc -vV | sed -n 's/host: //p' | sed -e 's/-/_/g')
Side note:
cmake
installed globally by homebrewOUT_DIR
exists. Also tried create_dir_all
which doesn't workcargo clippy
manually in any shell (bash, zsh, sh) cannot trigger this error~/.zshrc
, /etc/profile
or /etc/paths
does not helpAre you sure
cmake
is in yourPATH
when the build script is executed? That's basically what that error message is saying.
I still encounter this issue on macOS 14.5 aarch64 with rustc 1.79.0 (129f3b996 2024-06-10)
The only cmake in my system is the dmg installed one from https://cmake.org/download/
cmake
was indeed in the PATH. but it didn't found it.
The fix I needed to do:
sudo ln -s /Applications/CMake.app/Contents/bin/cmake /usr/local/bin/cmake
Hello, I've tried to use the cmake crate as a dependency in my crate and while it works locally it fails when I add my crate as a dependency (pulled from crates.io) in a test program:
With
RUST_BACKTRACE=full
:My crate's
build.rs
:Any advice on how I should proceed?