Don't hardcode path to libcudart #319
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch fixes cuda builds on Debian bullseye (testing) with the
nvidia-cuda-toolkitandlibcudart10.2packages installed.Cmake sees
/usr/bin/nvccand decides that cuda is installed in/usr. Taco then assumeslibcudart.sois in/usr/lib64/, but Debian puts it in/usr/lib/x86_64-linux-gnu/, instead. So the build fails with the following errors:Cmake sets
CUDA_LIBRARIESto the cuda RT library, so we can use that instead of hardcoding paths. With this, thelibtaco.solibrary links fine.However, the executables (
bin/taco,bin/taco-test, etc) failed to build with the following error:It seems
libtaco.sois using symbols fromlibcudart.sowithout linking against it, but the executable useslibcudart_static.a, and they don't mix.I was able to fix this by having
libtaco.solink tolibcudart.sodirectly, by changing INTERFACE to PUBLIC. In this case,libtaco.sopulls inlibcudart.sodirectly, and the applications get it for free. Sincelibtaco.sodepends onlibcudart.soanyway, I don't think there's a downside to this.With this, it works properly for me with both nvidia's "cuda*.run" installation script (/usr/local/cuda/lib64) and debian's cuda packages (/usr/lib/x86_64-linux-gnu).