Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[BUG]: `cargo oxide setup` in a standalone project builds the project instead of the backend

Open Beginner friendly
#1,688 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-2 days
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
backend, cli

Research direction

Read commands/setup_update.rs's setup and update paths, then follow the referenced context and backend functions in commands/context.rs and backend.rs. Reproduce with cargo oxide new setupdemo followed by cargo oxide setup outside the workspace. Done means setup builds and publishes the backend for the standalone project and exits successfully.

Written by the indexing model from the issue text.

Description

Description

Outside the cuda-oxide workspace, cargo oxide setup runs the backend build in the user's own crate. A cargo oxide new project fails with no library targets found in package; a library crate builds, then fails with Cargo reported no librustc_codegen_cuda.so artifact. Both exit non-zero. The backend cache is fine: resolve_context already built or validated it before setup runs, and run/build work.

Error / actual behavior

Project from cargo oxide new setupdemo (binary only):

$ cargo oxide setup
Building cuda-oxide codegen backend...

Building rustc-codegen-cuda backend...
error: no library targets found in package `setupdemo`
Failed to build rustc-codegen-cuda
$ echo $?
101

A standalone no_std kernel library (a [lib] with only cuda-device as a dependency) compiles itself, then:

   Compiling t03-fmax v0.0.0 (/…/repros/t03-fmax)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 3.42s
Backend build succeeded, but Cargo reported no `librustc_codegen_cuda.so` artifact for rustc_codegen_cuda
$ echo $?
1
Expected behavior

setup builds (or rebuilds) and publishes the backend for this project, as cargo oxide update does outside the workspace, and exits 0. cargo oxide doctor tells a standalone user with no cached backend to "run cargo oxide setup" (cuda-oxide-book/gpu-programming/error-handling-and-debugging.md:516), so this is the command new users reach for.

Minimal reproduction example
cargo oxide new setupdemo
cd setupdemo
cargo oxide setup   # exits 101
Cause
  • commands/context.rs:91-100: for a directory with a Cargo.toml outside the workspace, resolve_context sets codegen_crate: cwd.clone(), after backend::find_or_build_backend(&cwd, …) (context.rs:93) has already resolved the cache from the project's cuda-device checkout.
  • commands/setup_update.rs:24: setup calls backend::build_backend_from_source(&ctx.codegen_crate), so the backend build command runs in the user's crate (backend.rs:977), and backend_artifact_from_cargo_output finds no rustc_codegen_cuda dylib (backend.rs:994-997).

Suggested fix: when !ctx.is_workspace, have setup take update's RefreshCache route (backend::refresh_cached_backend(&ctx.workspace_root), setup_update.rs:145-155), which already builds from the dependency checkout and publishes to the cache.

Environment
  • cuda-rust main at 88e52d11707ac66cb263e7c1fdf7bb15ad68e6fc (cargo-oxide 0.3.0); the same code is at least as old as 7d9c19405
  • rustc 1.99.1 (58cf8f9c3 2026-10-13), LLVM 23.1.1 (toolchain llvm-tools llc)
  • CUDA 13.2 (V13.2.86), driver 595.99.02
  • Ubuntu 26.04.1 LTS, x86_64
  • GPU: GeForce RTX 5090 (sm_120); no GPU is needed to reproduce

cargo oxide doctor: every check passes, backend "cache built from 88e52d1170, matching this project's dependency".

Dominant language
Rust
Stars
3.9k
Forks
349
Avg merge
3d 20h
Merged PRs (30d)
81

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from NVIDIA/cuda-rust

All issues in NVIDIA/cuda-rust

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.