conda-forge / rust-activation-feedstock

A conda-smithy repository for rust-activation.
BSD 3-Clause "New" or "Revised" License
0 stars 17 forks source link

Add `Rust_CARGO_TARGET` for CMake / Corrosion #54

Open wolfv opened 1 month ago

wolfv commented 1 month ago

We are building C++ bindings to resolvo, and when cross-compiling it chose the wrong architecture. Supposedly that can be overriden by Rust_CARGO_TARGET.

We could add that to the $CMAKE_ARGS?

isuruf commented 1 month ago

Please add more details for reproduction.

wolfv commented 1 month ago

You can find the PR & commit that made it work here: https://github.com/mamba-org/resolvo/pull/47/commits/b2fc48894a70f96df892d6f49ee779bfc4d7ad16#diff-ad6aed43f0cf479348ccccec8e7185c4b70582192329f11908dd22a731771702

isuruf commented 1 month ago

Can you produce a minimal reproducer?

isuruf commented 1 month ago

Looking at Corossion docs, they don't support the env var CARGO_BUILD_TARGET. I suggest that you raise an issue in their issue tracker.

wolfv commented 1 month ago

Here is a minimal reproducer (also found in the recipe folder in resolvo). I don't think I can produce anything more minimal than this.

package:
  name: resolvo-cpp
  version: 0.1.0

source: 
  url: https://github.com/mamba-org/resolvo/archive/refs/tags/resolvo-v0.6.2.tar.gz
  sha256: d5022e56ed9c3a588275e386fe15666395cf961f92a6e772a4b6c9a9bd042fda

build:
  number: 0
  script: |
    cmake ${CMAKE_ARGS} -GNinja $SRC_DIR # -DRust_CARGO_TARGET=${CARGO_BUILD_TARGET} # fails without this last argument
    ninja install

requirements: 
  build: 
    - ${{ compiler('cxx') }}
    - ${{ compiler('rust') }}
    - cmake
    - ninja

about:
  license: BSD-3-Clause
  summary: C++ bindings for resolvo, a universal package resolver.
  repository: https://github.com/mamba-org/resolvo

Variant config:

rust_compiler_version: ">=1.75"

Invoke with:

rattler-build build --recipe ./resolvo/recipe.yaml -m ./resolvo/variant_config.yaml