Skip to content

find_cuda_helper assumes lib64 path, but can also be lib #135

@ralfbiedert

Description

@ralfbiedert
Contributor

Follow up for #92, just tested this again on NixOS.

The base path is now found when adding cudaPackages.cudatoolkit to the flake's build dependencies, but it then fails because find_cuda_helper's build.rs assumes the CUDA lib path is called lib64, while on Nix the folder inside cudatoolkit is just lib.

Activity

changed the title [-]find_cuda_helper assume `lib64` path, but can also be `lib`[/-] [+]find_cuda_helper assumes `lib64` path, but can also be `lib`[/+] on Jan 27, 2025
giantcow

giantcow commented on May 28, 2025

@giantcow
Contributor

I think this should be okay to close? At least I see some pretty extensive checking here:

fn find_cuda_library_dirs(
cuda_root: &path::Path,
) -> Result<Vec<path::PathBuf>, Box<dyn error::Error>> {
let (target, triple) = Self::parse_target_triple()?;
assert!(triple.len() >= 3, "Invalid target triple: {:?}", triple);
let search_dirs = match [triple[0].as_str(), triple[1].as_str(), triple[2].as_str()] {
["x86_64", "pc", "windows"] => {
vec![cuda_root.join("lib").join("x64")]
}
[_, _, "windows"] => {
panic!(
"Cannot support Windows architecture other than \
x86_64-pc-windows-*. target: {target}"
);
}
[_, _, "linux"] => {
vec![
cuda_root.join("lib"),
cuda_root.join("lib").join("stubs"),
cuda_root.join("lib64"),
cuda_root.join("lib64").join("stubs"),
cuda_root.join("targets").join("x86_64-linux").join("lib"),
]
}
[_, _, _] => {
panic!("Unsupported target triple: {target}");
}
};
let library_dirs = [Self::parse_cuda_library_path_env(), search_dirs].concat();
let library_dirs = Self::normalize_dirpaths(library_dirs);
Ok(library_dirs)
}

LegNeato

LegNeato commented on Jul 12, 2025

@LegNeato
Contributor

I think so.

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ralfbiedert@LegNeato@giantcow

        Issue actions

          find_cuda_helper assumes `lib64` path, but can also be `lib` · Issue #135 · Rust-GPU/Rust-CUDA