-
Notifications
You must be signed in to change notification settings - Fork 182
Error compiling example: couldn't load codegen backend symbol #163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hello! Thanks for trying the project. We are still in the process of cleaning it up after rebooting it (#130), I apologize for you hitting this issue! We haven't taken a look a the prebuilt yet, as it was disabled in the past due to weirdness and I am not sure what that was or if it still matters. That could be what you are experiencing (or not!). As of now the best way that works with |
I suppose my LLVM20 is a bit too new then. How do I specify which LLVM to use? |
There are a few environment variables you'll want to set to point to LLVM v7 for this project. The main one LLVM_CONFIG, and that'll be the full path to the llvm_config executable from LLVM v7 that you build. The other one if you're trying to build some of the optix examples is LIBCLANG_PATH. That will point to a directory where libclang can be found. That one can be a newer version though, at least I haven't run into issues using the latest version of clang for that. Hope this helps! |
Why do we depend on an old llvm? Is it due to nvvm?On Mar 16, 2025 17:10, Alex Eisenschmied ***@***.***> wrote:
|
Yeah, it has to do with nvvm. see this issue here for a bit more info and discussion. #154 The long and short of it is that we need llvm 7 because that's what libnvvm version 1 expects. Version 2, which is available, only supports Blackwell+ cards. There also doesn't seem to be a good way to get prebuilt llvm 7 automatically, since it needs to target the nvptx component as well |
Well, I compiled LLVM7 and set the LLVM_CONFIG variable and got further to this error:
Do I need to install nvvm or is it packaged with rust_cuda? |
It might help to look at what CI does, as it installs / gets everything on stock ubuntu images: Rust-CUDA/.github/workflows/rust.yml Line 30 in 1083480
nvvm comes with the CUDA install, but note CI installs CUDA 11.2.2. From this CI job: Run Jimver/[email protected]
with:
cuda: 11.2.2
sub-packages: []
non-cuda-sub-packages: []
method: local
linux-local-args: ["--toolkit", "--samples"]
use-github-cache: true
use-local-cache: true
log-file-suffix: log.txt
env: If you are using the latest CUDA toolkit, you are probably hitting #100 (comment). Are you using nix? If so you may be hitting #135. Here is how nvidia's sample code finds nvvm with cmake fwiw. |
(apologies for the jankiness, we are still digging out / rebooting the project!) |
Are you using CUDA 12.8? If so, I think I see the issue. In the find_cuda_helper crate, where we check the version of libnvvm, it'll fail if the minor version is below 6. CUDA 12.8 ships libnvvm version 2.0, which fails that check and gives the error message you're seeing. I'll send a fix for that in a couple minutes. The relevant place is in rustc_codegen_nvvm/src/nvvm.rs line 66 |
Thank you for the detailed responses. No worries about the jankiness! Thank you for the work you all are putting into this! |
@igor-semyonov can you try |
Wow. It worked. This is just like magic! The add example worked! By the way, this are my driver and CUDA versions. |
Hi,
I am trying to compile the cpu add example using cargo build.
First I had to uncomment this line:
Rust-CUDA/crates/rustc_codegen_nvvm/build.rs
Line 57 in 1083480
This fixed the error of no prebuilt supported LLVM target.
rustc_codegen_nvvm now builds successfully.
Then I did cargo build again on the cpu add example.
I got the following error:
Then I checked that so file for that symbol:
I am not that familiar with elf or so files, but it seems like the symbol is, in fact, present.
My OS: Gentoo Linux
I am on the latest commit, as of writing, on the main branch.
The text was updated successfully, but these errors were encountered: