Bug#861878: nvidia-cuda-toolkit: nvcc needs to pass -fpie to compiler

Samuel Thibault sthibault at debian.org
Sun May 7 09:07:18 UTC 2017


Hello,

Lumin, on dim. 07 mai 2017 02:29:46 +0000, wrote:
> I'm not sure whether this bug should be marked as serious. Since your test
> cases are mixing the default cc (GCC-6) and clang-3.8 together.

Well, there is no choice about this: not doing so leads to:

cc    -c -o test.o test.c
nvcc  -c test-cuda.cu -o test-cuda.o
ERROR: No supported gcc/g++ host compiler found, but clang-3.8 is available.
       Use 'nvcc -ccbin clang-3.8' to use that instead.

This was documented in NEWS.Debian.gz. Having to use "--compiler-options
-fPIC" was however not documented in NEW.Debian.gz, at least that should
be done.

> I reproduced the failure you reported, but there is a simpler solution
> to the issue as shown below.
> 
> test$ CC=clang-3.8 make
> clang-3.8    -c -o test.o test.c
> nvcc -ccbin clang-3.8 -c test-cuda.cu -o test-cuda.o
> clang-3.8   test.o test-cuda.o  -lcudart -o test

Ok, but that's still something difficult to the user to work out, while
it is needed for basically any use of nvcc. Currently NEWS.Debian.gz
only advises to use -ccbin clang-3.8.

> Maybe this is a bug about GCC's linking process on a set of GCC-6 and
> clang-3.8 produced objects.

> Clang-3.8 is able to link a set of mixed object files while GCC-6
> fails to do so. I guess
> this bug is a GCC-6 bug and not related to CUDA?

Well, AIUI it's not considered a bug to require PIE, but a toolchain
goal...

> On the other hand, for instance, cuda application package
> "caffe-contrib" was thoroughly
> and finely compiled by clang-3.8 .

Sure, but application Makefiles are not ready for that, we had to
tinker them to use clang-3.8, and NEWS.Debian.gz only talks about the
invokation of nvcc, not the eventual linking issue.

Samuel



More information about the pkg-nvidia-devel mailing list