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

error: Linking globals named 'memcpy': symbol multiply defined! #8

Closed
gnzlbg opened this issue Oct 3, 2018 · 5 comments
Closed

error: Linking globals named 'memcpy': symbol multiply defined! #8

gnzlbg opened this issue Oct 3, 2018 · 5 comments

Comments

@gnzlbg
Copy link
Contributor

gnzlbg commented Oct 3, 2018

I am getting that linker error when trying to use the coresimd library from a cuda kernel :/

Compiling host v0.1.0 (/stdsimd/crates/nvptx-test)                                                                                                                                          
error: failed to run custom build command for `host v0.1.0 (/Users/gnzlbg/projects/sideprojects/stdsimd/crates/nvptx-test)`                                                                                                       
process didn't exit successfully: `/stdsimd/crates/nvptx-test/target/debug/build/host-5b9ca8737382a47e/build-script-build` (exit code: 1)
--- stderr
[PTX] Unable to build a PTX crate!
[PTX]    Compiling kernel v0.1.0 (/stdsimd/crates/nvptx-test/kernel)
[PTX]    Compiling proxy v0.0.0 (/private/var/folders/mm/y444qqwd0kn52fycyz6nsph40000gn/T/ptx-builder-0.5/kernel/c4e147d83c46a030)
[PTX] error: linking with `ptx-linker` failed: exit code: 1
[PTX]   |
[PTX]   = note: "ptx-linker" "-L" "/Users/gnzlbg/.xargo/lib/rustlib/nvptx64-nvidia-cuda/lib" "/var/folders/mm/y444qqwd0kn52fycyz6nsph40000gn/T/ptx-builder-0.5/kernel/c4e147d83c46a030/target/nvptx64-nvidia-cuda/release/deps/proxy.proxy.43qsgff7-cgu.0.rcgu.o" "-o" "/var/folders/mm/y444qqwd0kn52fycyz6nsph40000gn/T/ptx-builder-0.5/kernel/c4e147d83c46a030/target/nvptx64-nvidia-cuda/release/deps/proxy.ptx" "/var/folders/mm/y444qqwd0kn52fycyz6nsph40000gn/T/ptx-builder-0.5/kernel/c4e147d83c46a030/target/nvptx64-nvidia-cuda/release/deps/proxy.37oceufmlocs4b5j.rcgu.o" "-O1" "-L" "/var/folders/mm/y444qqwd0kn52fycyz6nsph40000gn/T/ptx-builder-0.5/kernel/c4e147d83c46a030/target/nvptx64-nvidia-cuda/release/deps" "-L" "/var/folders/mm/y444qqwd0kn52fycyz6nsph40000gn/T/ptx-builder-0.5/kernel/c4e147d83c46a030/target/release/deps" "-L" "/Users/gnzlbg/.xargo/lib/rustlib/nvptx64-nvidia-cuda/lib" "--start-group" "-Bstatic" "--whole-archive" "/var/folders/mm/y444qqwd0kn52fycyz6nsph40000gn/T/rustcNH6EGz/libkernel-ad470a324c1962cc.rlib" "--no-whole-archive" "--whole-archive" "/var/folders/mm/y444qqwd0kn52fycyz6nsph40000gn/T/rustcNH6EGz/libcoresimd-9761acf5e343c1f3.rlib" "--no-whole-archive" "--whole-archive" "/var/folders/mm/y444qqwd0kn52fycyz6nsph40000gn/T/rustcNH6EGz/libcore-58de11be20fe5a04.rlib" "--no-whole-archive" "--end-group" "/var/folders/mm/y444qqwd0kn52fycyz6nsph40000gn/T/rustcNH6EGz/libcompiler_builtins-20af736248a5f37a.rlib" "-shared" "-Bdynamic"
[PTX]   = note:  [INFO] Going to link 2 bitcode modules and 4 rlibs...
[PTX]                   
[PTX]           error: Linking globals named 'memcpy': symbol multiply defined!
[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.

to reproduce the issue:

git clone https://github.com/gnzlbg/stdsimd
cd stdsimd
git checkout nvptx_ci
cd crates/nvptx-test
cargo build
@gnzlbg
Copy link
Contributor Author

gnzlbg commented Oct 5, 2018

any ideas ?

@denzp
Copy link
Owner

denzp commented Oct 5, 2018

The error message is coming directly from LLVM... And it definitely has something to do about kernel function name.

I suppose we are getting the symbol first from compiler-builtins and the second time from the kernel crate.

Technically we can try to toggle some features of the compiler-builtins crate (enabling mangled-names or disabling mem that is set by xargo) but I'm not sure whether it will have consequences on dependent crates.

@gnzlbg
Copy link
Contributor Author

gnzlbg commented Oct 5, 2018

Indeed, renaming the symbol from memcpy to something else solves the issue. I'm trying to get CI running for the NVPTX intrinsics of core::arch and it isn't as trivial as I expected.

@denzp
Copy link
Owner

denzp commented Oct 5, 2018

Yes, that can be :) Some time ago, I tried to find CI platform that has CUDA compatible hardware, but didn't have a luck. The best we can do right now is to test build process and verify output PTX assembly.

@gnzlbg
Copy link
Contributor Author

gnzlbg commented Nov 10, 2018

I'm closing this, since renaming the function to something else solved the issue.

@gnzlbg gnzlbg closed this as completed Nov 10, 2018
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

2 participants