Skip to content
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

Linker fails on Windows #17

Closed
bheisler opened this issue Aug 21, 2018 · 8 comments
Closed

Linker fails on Windows #17

bheisler opened this issue Aug 21, 2018 · 8 comments

Comments

@bheisler
Copy link

I tried to compile some of the code from rust-inline-cuda-tutorial on Windows, and encountered this error:

error: failed to run custom build command for `chapter-1 v0.1.0 (file:///C:/Users/Brook/workspace/rust-inline-cuda-tutorial/chapter-1/host)`
process didn't exit successfully: `C:\Users\Brook\workspace\rust-inline-cuda-tutorial\target\release\build\chapter-1-f350df76ca927b39\build-script-build` (exit code: 1)
--- stderr
[PTX] Unable to build a PTX crate!
[PTX]    Compiling proxy v0.0.0 (file:///C:/Users/Brook/AppData/Local/Temp/ptx-builder/chapter_1_kernel/2777747bd38bda2e)
[PTX] error: linking with `ptx-linker` failed: exit code: 101
[PTX]   |
[PTX]   = note: "ptx-linker" "-L" "C:\\Users\\Brook\\.xargo\\lib\\rustlib\\nvptx64-nvidia-cuda\\lib" "C:\\Users\\Brook\\AppData\\Local\\Temp\\ptx-builder\\chapter_1_kernel\\2777747bd38bda2e\\target\\nvptx64-nvidia-cuda\\release\\deps\\proxy.3rg6oty3sxxix4x5.rcgu.o" "-o" "C:\\Users\\Brook\\AppData\\Local\\Temp\\ptx-builder\\chapter_1_kernel\\2777747bd38bda2e\\target\\nvptx64-nvidia-cuda\\release\\deps\\proxy.ptx" "C:\\Users\\Brook\\AppData\\Local\\Temp\\ptx-builder\\chapter_1_kernel\\2777747bd38bda2e\\target\\nvptx64-nvidia-cuda\\release\\deps\\proxy.crate.metadata.rcgu.o" "-O1" "-L" "C:\\Users\\Brook\\AppData\\Local\\Temp\\ptx-builder\\chapter_1_kernel\\2777747bd38bda2e\\target\\nvptx64-nvidia-cuda\\release\\deps" "-L" "C:\\Users\\Brook\\AppData\\Local\\Temp\\ptx-builder\\chapter_1_kernel\\2777747bd38bda2e\\target\\release\\deps" "-L" "C:\\Users\\Brook\\.xargo\\lib\\rustlib\\nvptx64-nvidia-cuda\\lib" "-Bstatic" "--whole-archive" "C:\\Users\\Brook\\AppData\\Local\\Temp\\rustcD6eN9t\\libchapter_1_kernel-f74b1c8db75e0ae3.rlib" "--no-whole-archive" "--whole-archive" "C:\\Users\\Brook\\AppData\\Local\\Temp\\rustcD6eN9t\\libmath-86f691a12c8816dd.rlib" "--no-whole-archive" "--whole-archive" "C:\\Users\\Brook\\AppData\\Local\\Temp\\rustcD6eN9t\\libcty-77e4626992983622.rlib" "--no-whole-archive" "--whole-archive" "C:\\Users\\Brook\\AppData\\Local\\Temp\\rustcD6eN9t\\libnvptx_builtins-80d5f762aa9da22c.rlib" "--no-whole-archive" "--whole-archive" "C:\\Users\\Brook\\AppData\\Local\\Temp\\rustcD6eN9t\\libcore-e6982899dc4034c4.rlib" "--no-whole-archive" "C:\\Users\\Brook\\AppData\\Local\\Temp\\rustcD6eN9t\\libcompiler_builtins-663e743ee2409b7f.rlib" "-shared" "-Bdynamic"
[PTX]   = note: Unable to find symbol 'LLVMContextCreate' in the LLVM shared lib
[PTX]           thread 'main' panicked at 'explicit panic', C:\Users\Brook\AppData\Local\Temp\cargo-installaOfHDV\release\build\rustc-llvm-proxy-8b11c485c2cc7120\out/llvm_gen.rs:4:1
[PTX]           note: Run with `RUST_BACKTRACE=1` for a backtrace.
[PTX]
[PTX]
[PTX] error: aborting due to previous error
[PTX]
[PTX] error: Could not compile `proxy`.
[PTX]
[PTX] To learn more, run the command again with --verbose.

I think this is the important bit:
Unable to find symbol 'LLVMContextCreate' in the LLVM shared lib

@denzp
Copy link
Owner

denzp commented Aug 21, 2018

Unfortunately, it's known limitation of *-pc-windows-msvc Rustc targets. Can you please try *-pc-windows-gnu?

The problem originates in rustc-llvm-proxy and I created a ticket there: denzp/rustc-llvm-proxy#1

@bheisler
Copy link
Author

Tried using nightly-x86_64-pc-windows-gnu - that causes it to fail in a different way:

error: failed to run custom build command for `chapter-1 v0.1.0 (file:///C:/Users/Brook/workspace/rust-inline-cuda-tutorial/chapter-1/host)`
process didn't exit successfully: `C:\Users\Brook\workspace\rust-inline-cuda-tutorial\target\debug\build\chapter-1-11d782cbdb9b9a40\build-script-build` (exit code: 1)
--- stdout
cargo:rustc-env=KERNEL_PTX_PATH=C:\Users\Brook\AppData\Local\Temp\ptx-builder\chapter_1_kernel\2777747bd38bda2e\target\nvptx64-nvidia-cuda/release/proxy.ptx

--- stderr
[PTX] Internal error: Paths misalignment in deps file

@denzp
Copy link
Owner

denzp commented Aug 29, 2018

Sorry, it took me a while to fix this and pass all test without access to the real Windows environment.

I published ptx-builder version 0.4.0 with x86_64-pc-windows-gnu support.

@TuckerBMorgan
Copy link

It would be nice if this was listed in the README, the issue is hidden and you have to search for the error message to find it.

@TuckerBMorgan
Copy link

also @bheisler how did you handle the error "note: ld: cannot find -lcuda" for windows?

@bheisler
Copy link
Author

bheisler commented Oct 5, 2018

@TuckerBMorgan I'm using git-bash(/MinGW) as my shell, so I just used export LIBRARY_PATH="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1\lib\x64". Of course, you'll need to install the CUDA toolkit. If you're using Powershell or something you'll need to adapt this to however you set environment variables.

@TuckerBMorgan
Copy link

@bheisler Thanks!, I am trying to run your code and I will get "LaunchFailure", or "LaunchTimeout" after it runs for a little bit, and I never get a output image.

@bheisler
Copy link
Author

bheisler commented Oct 8, 2018

That sounds like the watchdog timer killing the CUDA kernel. If you're running a kernel on the same GPU as your display, most operating systems will reset the card and kill the kernel if it runs longer than a few seconds. The screen can't update while the kernel is running, so this helps ensure that a long-running (or infinite-looping) kernel doesn't lock up the machine.

If you're using my path tracer code, you might have to play around with the complexity of the scene or the ROUND_COUNT/RAY_COUNT constants in the kernel to find a workload that your card can complete without hitting the timeout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants