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

Samuel Thibault sthibault at debian.org
Fri May 5 09:59:19 UTC 2017


Package: nvidia-cuda-toolkit
Version: 8.0.44-3
Severity: serious
Justification: breaks basic use of nvcc

Hello,

Now that gcc has defaulted to building with pie, we're getting issues
with the binaries produced by nvcc:

cc    -c -o test.o test.c
nvcc -ccbin clang-3.8 -c test-cuda.cu -o test-cuda.o
cc   test.o test-cuda.o  -lcudart -o test
/usr/bin/ld: test-cuda.o: relocation R_X86_64_32S against `.bss' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output

The attached archive shows this testcase: it just builds a test.o with
nvcc, and tries to link it with gcc, and that fails with the message
above.  This can be fixed by passing --compiler-options -fpie to nvcc,
but that's something that users will have a hard time understanding,
while it will be basically always needed in Stretch. So I'd tend to
think /usr/bin/nvcc should actually do

exec /usr/lib/nvidia-cuda-toolkit/bin/nvcc --compiler-options -fpie "$@"

to save users big headaches.

Samuel

-- System Information:
Debian Release: 9.0
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable-debug'), (500, 'testing-debug'), (500, 'buildd-unstable'), (500, 'unstable'), (500, 'stable'), (500, 'oldstable'), (1, 'experimental-debug'), (1, 'buildd-experimental'), (1, 'experimental')
Architecture: amd64
 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.11.0 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages nvidia-cuda-toolkit depends on:
ii  clang                            1:3.8-36
ii  clang-3.8                        1:3.8.1-23
ii  g++-5                            5.4.1-8
ii  gcc-5                            5.4.1-8
ii  libc6                            2.24-10
ii  libgcc1                          1:7-20170407-1
ii  libnvvm3                         8.0.44-3
ii  libstdc++6                       7-20170407-1
ii  nvidia-cuda-dev                  8.0.44-3
ii  nvidia-profiler                  8.0.44-3
ii  ocl-icd-opencl-dev [opencl-dev]  2.2.11-1

Versions of packages nvidia-cuda-toolkit recommends:
pn  nvidia-cuda-doc         <none>
ii  nvidia-cuda-gdb         8.0.44-3
ii  nvidia-visual-profiler  8.0.44-3

Versions of packages nvidia-cuda-toolkit suggests:
ii  libcupti-dev   8.0.44-3
pn  nvidia-driver  <none>

-- no debconf information

-- 
Samuel
Fatal Error: Found [MS-Windows] System -> Repartitioning Disk for Linux...
(By cbbrown at io.org, Christopher Browne)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.tgz
Type: application/x-gtar-compressed
Size: 1173 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-nvidia-devel/attachments/20170505/14776303/attachment.tgz>


More information about the pkg-nvidia-devel mailing list