Description
With version 1.1.32, it now is not possible to build a project on MacOS using the cmake crate enabling c++11. I'm not sure whether to make this issue here or in cmake-rs but i'll make it here because its specifically a release of cc that broke it.
See this example
Cargo.toml
[package]
name = "cmake_example"
version = "0.1.0"
edition = "2021"
[build-dependencies]
cmake = "0.1.51"
build.rs
fn main() {
cmake::Config::new("src").uses_cxx11().build();
}
"src"
is irrelevant here.
This fails to build with
% cargo build
Compiling cmake_example v0.1.0 (/Users/andrew/cmake_example)
error: failed to run custom build command for `cmake_example v0.1.0 (/Users/andrew/cmake_example)`
Caused by:
process didn't exit successfully: `/Users/andrew/cmake_example/target/debug/build/cmake_example-066fd92fa2dd9dd8/build-script-build` (exit status: 1)
--- stdout
CMAKE_TOOLCHAIN_FILE_aarch64-apple-darwin = None
CMAKE_TOOLCHAIN_FILE_aarch64_apple_darwin = None
HOST_CMAKE_TOOLCHAIN_FILE = None
CMAKE_TOOLCHAIN_FILE = None
CMAKE_GENERATOR_aarch64-apple-darwin = None
CMAKE_GENERATOR_aarch64_apple_darwin = None
HOST_CMAKE_GENERATOR = None
CMAKE_GENERATOR = None
--- stderr
error occurred: unknown target `aarch64-apple-darwin11`
Looking at cmake code, it appends 11 as the target for C++11. My understanding is that darwin11
here is the MacOS clang way of specifying the minimum target MacOS version. In the cmake
crate, the TARGET
env var is set with that aarch64-apple-darwin11
which then causes cc
to fail when trying to parse the target to a target triple.
After having typed this out, I'm guessing i can in all likelihood just stop setting uses_cxx11
from cmake
because any toolchains i'd be compiling with likely have C++11 available. I also wonder if instead cmake
could use a different mechanism to ensure a minimum toolchain version, but I don't know enough about how that works to have an immediate answer there. However, I'll leave this ticket here to call out the issue (and in case others run into the same thing).