Skip to content

toolkit_target_dir() matches only the triple's architecture, so non-Linux targets probe Linux paths and Tegra is unreachable #698

Closed

Description

@nh13

Description

toolkit_target_dir in crates/cuda-bindings/build.rs matches only the first segment of the TARGET triple, so the architecture alone selects the CUDA targets/<dir> layout and the OS is never consulted. Every non-Linux target claims a Linux directory, and CUDA for Tegra is unreachable entirely.

Minimal reproducer

Build cuda-bindings for any non-Linux target:

aarch64-apple-darwin      -> probes {toolkit}/targets/sbsa-linux/include
x86_64-pc-windows-msvc    -> probes {toolkit}/targets/x86_64-linux/include

Expected behavior

Non-Linux targets should probe no targets/ tree. aarch64 Linux should be able to resolve a Tegra install, which lives at targets/aarch64-linux/.

Actual behavior

Both find_cuda_include_dir and collect_lib_paths are handed a path that cannot exist on those platforms. Separately, aarch64 hardcodes sbsa-linux — the ARM server tree — so CUDA for Tegra (Jetson, Drive) under targets/aarch64-linux/ is never probed. Both build natively as aarch64-unknown-linux-gnu, so the triple alone cannot tell them apart.

Environment

  • GPU: n/a (build-time only)
  • CUDA driver version: n/a
  • rustc --version --verbose: nightly-2026-04-03

Additional context

Selecting a single targets/ directory is deliberate — see the doc comment on find_cuda_include_dir and #172; globbing targets/* was proposed in #88 and rejected because sbsa-linux sorts before x86_64-linux on multi-target installs.

Activity

  1. added
    bug
    cuda-bindings
    build-related
    on Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugbuild-relatedcuda-bindings

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions