corrosion
corrosion copied to clipboard
[Bug]: "multiple rules generate" with Ninja Multiconfig in CROSS_CONFIG mode
Current Behavior
Building a simple project which imports a rust static lib fails to build when invoking ninja.
Expected Behavior
The build works.
Steps To Reproduce
> cmake .. -G "Ninja Multi-Config" -DCMAKE_CROSS_CONFIGS="Debug;Release" -DCMAKE_DEFAULT_CONFIGS="Debug;Release"
> ninja
ninja: error: CMakeFiles/impl-Debug.ninja:122: multiple rules generate libthe_rust_lib.a
Environment
- OS: Ubuntu 23.10
- CMake: 3.27.4
- CMake Generator: Ninja Multi-Config
CMake configure log with Debug log-level
-- The C compiler identification is GNU 13.2.0
-- The CXX compiler identification is GNU 13.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using Corrosion 0.4.99.99 with CMake 3.27.4 and the Ninja Multi-Config
Generator
-- Rust Toolchain: nightly-x86_64-unknown-linux-gnu
-- Rust toolchain nightly-x86_64-unknown-linux-gnu
-- Rust toolchain path /home/x/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu
-- Rust Target: x86_64-unknown-linux-gnu
-- Parsed Target triple: arch: x86_64, vendor: unknown, OS: linux, env: gnu
-- Parsed Target triple: arch: x86_64, vendor: unknown, OS: linux, env: gnu
-- Determining required link libraries for target x86_64-unknown-linux-gnu
-- Required static libs for target x86_64-unknown-linux-gnu: gcc_s;util;rt;pthread;m;dl;c
-- Found Rust: /home/x/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc (found version "1.74.0")
-- Cargo target x86_64-unknown-linux-gnu is an official target-triple
-- Installed targets: aarch64-apple-darwin;aarch64-unknown-linux-gnu;arm-unknown-linux-gnueabi;armv7-unknown-linux-gnueabihf;i586-unknown-linux-gnu;i686-pc-windows-gnu;i686-pc-windows-msvc;i686-unknown-linux-gnu;powerpc64-unknown-linux-gnu;riscv64gc-unknown-linux-gnu;wasm32-unknown-unknown;x86_64-pc-windows-msvc;x86_64-unknown-linux-gnu
-- Note: the following keywords passed to corrosion_import_crate had no associated value(s): FLAGS
-- Found 1 targets in package the_rust_lib
-- TARGET the_rust_lib produces byproducts libthe_rust_lib.a;;
-- Corrosion created the following CMake targets: the_rust_lib
-- Output directory property (target the_rust_lib): ARCHIVE_OUTPUT_DIRECTORY dir: output_directory-NOTFOUND
-- Setting IMPORTED_LOCATION_DEBUG for target the_rust_lib-static to /home/x/y/repos/mytest/build/libthe_rust_lib.a
.
-- Setting IMPORTED_LOCATION_RELEASE for target the_rust_lib-static to /home/x/y/repos/mytest/build/libthe_rust_lib.a
.
-- Setting IMPORTED_LOCATION_RELWITHDEBINFO for target the_rust_lib-static to /home/x/y/repos/mytest/build/libthe_rust_lib.a
.
-- Setting IMPORTED_LOCATION for target the_rust_lib-static to /home/x/y/repos/mytest/build/libthe_rust_lib.a
.
-- Adding command to copy byproducts libthe_rust_lib.a
to $<$CONFIG:Debug:/home/x/y/repos/mytest/build>$<$CONFIG:Release:/home/x/y/repos/mytest/build>$<$CONFIG:RelWithDebInfo:/home/x/y/repos/mytest/build>/libthe_rust_lib.a
-- Configuring done (0.5s)
-- Generating done (0.0s)
-- Build files have been written to: /home/x/y/repos/mytest/build
CMake Build step log
Change Dir: '/home/x/y/repos/mytest/build'
Run Build Command(s): /usr/bin/ninja -v ninja: error: CMakeFiles/impl-Debug.ninja:128: multiple rules generate libthe_rust_lib.a