CUDA 11.5 samples throw multiple ... error: attribute "__malloc__" does not take arguments

Hi,
After updating the Ubuntu distribution (from 20.04 to 21.10), compiling the examples throws errors …

cd /usr/local/cuda/samples

make

make[1]: Entering directory ‘/usr/local/cuda-11.5/samples/0_Simple/vectorAdd_nvrtc’

GCC Version is greater or equal to 5.1.0 <<<
make[1]: Nothing to be done for ‘all’.
make[1]: Leaving directory ‘/usr/local/cuda-11.5/samples/0_Simple/vectorAdd_nvrtc’
make[1]: Entering directory ‘/usr/local/cuda-11.5/samples/0_Simple/template’
/usr/local/cuda-11.5/bin/nvcc -ccbin g++ -I…/…/common/inc -m64 --threads 0 --std=c++11 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_86,code=compute_86 -o template.o -c template.cu
nvcc warning : The ‘compute_35’, ‘compute_37’, ‘compute_50’, ‘sm_35’, ‘sm_37’ and ‘sm_50’ architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
/usr/include/stdio.h(183): error: attribute “malloc” does not take arguments

/usr/include/stdio.h(195): error: attribute “malloc” does not take arguments

/usr/include/stdio.h(217): error: attribute “malloc” does not take arguments

/usr/include/stdio.h(254): error: attribute “malloc” does not take arguments

/usr/include/stdio.h(279): error: attribute “malloc” does not take arguments

/usr/include/stdio.h(288): error: attribute “malloc” does not take arguments

/usr/include/stdio.h(297): error: attribute “malloc” does not take arguments

/usr/include/stdio.h(303): error: attribute “malloc” does not take arguments

/usr/include/stdio.h(309): error: attribute “malloc” does not take arguments

/usr/include/stdio.h(824): error: attribute “malloc” does not take arguments

/usr/include/stdlib.h(565): error: attribute “malloc” does not take arguments

/usr/include/stdlib.h(569): error: attribute “malloc” does not take arguments

/usr/include/stdlib.h(797): error: attribute “malloc” does not take arguments

/usr/include/wchar.h(155): error: attribute “malloc” does not take arguments

/usr/include/wchar.h(582): error: attribute “malloc” does not take arguments

15 errors detected in the compilation of “template.cu”.
make[1]: *** [Makefile:322: template.o] Error 255
make[1]: Leaving directory ‘/usr/local/cuda-11.5/samples/0_Simple/template’
make: *** [Makefile:51: 0_Simple/template/Makefile.ph_build] Error 2

I would like to compile GPUStressTest and I get the same:
Cloning into ‘GPUStressTest’…
remote: Enumerating objects: 207, done.
remote: Counting objects: 100% (207/207), done.
remote: Compressing objects: 100% (84/84), done.
remote: Total 207 (delta 126), reused 192 (delta 116), pack-reused 0
Receiving objects: 100% (207/207), 62.95 KiB | 153.00 KiB/s, done.
Resolving deltas: 100% (126/126), done.
– The CXX compiler identification is GNU 11.2.0
– The CUDA compiler identification is unknown
– The C compiler identification is GNU 11.2.0
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Check for working CXX compiler: /usr/bin/c++ - skipped
– Detecting CXX compile features
– Detecting CXX compile features - done
– Detecting CUDA compiler ABI info
– Detecting CUDA compiler ABI info - failed
– Check for working CUDA compiler: /etc/alternatives/cuda/bin/nvcc
– Check for working CUDA compiler: /etc/alternatives/cuda/bin/nvcc - broken
CMake Error at /usr/share/cmake-3.18/Modules/CMakeTestCUDACompiler.cmake:52 (message):
The CUDA compiler

"/etc/alternatives/cuda/bin/nvcc"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: /root/spec.env/src/GPUStressTest/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/gmake cmTC_28ce6/fast && /usr/bin/gmake  -f CMakeFiles/cmTC_28ce6.dir/build.make CMakeFiles/cmTC_28ce6.dir/build
gmake[1]: Entering directory '/root/spec.env/src/GPUStressTest/CMakeFiles/CMakeTmp'
Building CUDA object CMakeFiles/cmTC_28ce6.dir/main.cu.o
/etc/alternatives/cuda/bin/nvcc      -c /root/spec.env/src/GPUStressTest/CMakeFiles/CMakeTmp/main.cu -o CMakeFiles/cmTC_28ce6.dir/main.cu.o
/usr/include/stdio.h(183): error: attribute "__malloc__" does not take arguments

/usr/include/stdio.h(195): error: attribute "__malloc__" does not take arguments

/usr/include/stdio.h(217): error: attribute "__malloc__" does not take arguments

/usr/include/stdio.h(254): error: attribute "__malloc__" does not take arguments

/usr/include/stdio.h(279): error: attribute "__malloc__" does not take arguments

/usr/include/stdio.h(288): error: attribute "__malloc__" does not take arguments

/usr/include/stdio.h(297): error: attribute "__malloc__" does not take arguments

/usr/include/stdio.h(303): error: attribute "__malloc__" does not take arguments

/usr/include/stdio.h(309): error: attribute "__malloc__" does not take arguments

/usr/include/stdio.h(824): error: attribute "__malloc__" does not take arguments

/usr/include/stdlib.h(565): error: attribute "__malloc__" does not take arguments

/usr/include/stdlib.h(569): error: attribute "__malloc__" does not take arguments

/usr/include/stdlib.h(797): error: attribute "__malloc__" does not take arguments

13 errors detected in the compilation of "/root/spec.env/src/GPUStressTest/CMakeFiles/CMakeTmp/main.cu".
gmake[1]: *** [CMakeFiles/cmTC_28ce6.dir/build.make:85: CMakeFiles/cmTC_28ce6.dir/main.cu.o] Error 1
gmake[1]: Leaving directory '/root/spec.env/src/GPUStressTest/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:140: cmTC_28ce6/fast] Error 2

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:8 (project)

– Configuring incomplete, errors occurred!
See also “/root/spec.env/src/GPUStressTest/CMakeFiles/CMakeOutput.log”.
See also “/root/spec.env/src/GPUStressTest/CMakeFiles/CMakeError.log”.
make: *** No targets specified and no makefile found. Stop.

What is problematic is that the download of the Toolkit 11.5 does not offer Ubuntu version 21.10 (max 20.04 → https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=20.04&target_type=deb_local)

Is this the real problem ?

Matéo

Which glibc and gcc version did you use ?
Could you please report a ticket to us including this Forum link , referring to Getting Help with CUDA NVCC Compiler

gcc --version
gcc (Ubuntu 11.2.0-7ubuntu2) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

dpkg -l libc6
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
++±==============-=============-============-=================================
ii libc6:amd64 2.34-0ubuntu3 amd64 GNU C Library: Shared libraries
ii libc6:i386 2.34-0ubuntu3 i386 GNU C Library: Shared libraries

1 Like

Thanks , please file a ticket to us . It looks like an issue specific to glibc 2.34 .Getting Help with CUDA NVCC Compiler

I guess that it’s the right url to raise a ticket …
[https://developer.nvidia.com/nvidia_bug/add ]
… if so, I cant access it :

Membership Required

You are not authorized to access this page.

Press the top right ‘Join’ button to follow the guide to join NVIDIA Developer Program . The reason you are suggested to add a ticket is that we can keep you informed about the ticket progress .

Sorry but I don’t see any ‘join’ button at https://developer.nvidia.com/nvidia_bug/add
Bring me to the right url
Today, It’s the first time I reach this site

https://developer.nvidia.com/


Any update to this issue. I am facing the same exactly. as per below logs

root [ /opt/cuda/samples ]# gcc --version
gcc (GCC) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

root [ /opt/cuda/samples ]# nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Sun_Aug_15_21:14:11_PDT_2021
Cuda compilation tools, release 11.4, V11.4.120
Build cuda_11.4.r11.4/compiler.30300941_0
root [ /opt/cuda/samples ]# make
make[1]: Entering directory ‘/opt/cuda/samples/0_Simple/simpleAssert’

GCC Version is greater or equal to 5.1.0 <<<
/opt/cuda/bin/nvcc -ccbin g++ -I…/…/common/inc -m64 --threads 0 --std=c++11 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_86,code=compute_86 -o simpleAssert.o -c simpleAssert.cu
nvcc warning : The ‘compute_35’, ‘compute_37’, ‘compute_50’, ‘sm_35’, ‘sm_37’ and ‘sm_50’ architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
/usr/include/stdio.h(183): error: attribute “malloc” does not take arguments

/usr/include/stdio.h(195): error: attribute “malloc” does not take arguments

/usr/include/stdio.h(217): error: attribute “malloc” does not take arguments

/usr/include/stdio.h(254): error: attribute “malloc” does not take arguments

/usr/include/stdio.h(279): error: attribute “malloc” does not take arguments

/usr/include/stdio.h(288): error: attribute “malloc” does not take arguments

/usr/include/stdio.h(297): error: attribute “malloc” does not take arguments

/usr/include/stdio.h(303): error: attribute “malloc” does not take arguments

/usr/include/stdio.h(309): error: attribute “malloc” does not take arguments

/usr/include/stdio.h(824): error: attribute “malloc” does not take arguments

/usr/include/stdlib.h(565): error: attribute “malloc” does not take arguments

/usr/include/stdlib.h(569): error: attribute “malloc” does not take arguments

/usr/include/stdlib.h(797): error: attribute “malloc” does not take arguments

/usr/include/wchar.h(155): error: attribute “malloc” does not take arguments

/usr/include/wchar.h(582): error: attribute “malloc” does not take arguments

15 errors detected in the compilation of “simpleAssert.cu”.
make[1]: *** [Makefile:353: simpleAssert.o] Error 255
make[1]: Leaving directory ‘/opt/cuda/samples/0_Simple/simpleAssert’
make: *** [Makefile:51: 0_Simple/simpleAssert/Makefile.ph_build] Error 2
root [ /opt/cuda/samples ]#

Same here …

I am getting the same error trying to compile the examples I got from the cuda SDK. I tried also to use different versions of gcc but nothing changes. Gcc works fine, what is worrying is that seems having troubles with C std library. I also tried to compile simple “Hello, World” codes but the same error occurs.

We have submitted a fix for the issue and internally verified it on glibc 2.34. The fix will be soon to public in next 11.5 minor release .

For now as a workaround , please use gcc-10, g+±10 , which I tried should work for ubuntu 21.10 .

root@c172b78442e3:~/yni# /usr/local/cuda-11.5/bin/nvcc -o out asyncAPI.cu -I ~/NVIDIA_CUDA-11.5_Samples/common/inc/
root@c172b78442e3:~/yni#
root@c172b78442e3:~/yni# gcc --version
gcc (Ubuntu 10.3.0-11ubuntu1) 10.3.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

root@c172b78442e3:~/yni#  strings /lib/x86_64-linux-gnu/libc.so.6 | grep GLIBC_
GLIBC_2.2.5
GLIBC_2.2.6
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
GLIBC_2.9
GLIBC_2.10
GLIBC_2.11
GLIBC_2.12
GLIBC_2.13
GLIBC_2.14
GLIBC_2.15
GLIBC_2.16
GLIBC_2.17
GLIBC_2.18
GLIBC_2.22
GLIBC_2.23
GLIBC_2.24
GLIBC_2.25
GLIBC_2.26
GLIBC_2.27
GLIBC_2.28
GLIBC_2.29
GLIBC_2.30
GLIBC_2.31
GLIBC_2.32
GLIBC_2.33
GLIBC_2.34
GLIBC_PRIVATE
root@c172b78442e3:~/yni#
root@c172b78442e3:~/yni#
root@c172b78442e3:~/yni# ^C
root@c172b78442e3:~/yni#
root@c172b78442e3:~/yni#
root@c172b78442e3:~/yni# cd /usr/bin/
root@c172b78442e3:/usr/bin# ln -snf gcc-11 gcc
root@c172b78442e3:/usr/bin# ln -snf g++-11 g++
root@c172b78442e3:/usr/bin#
root@c172b78442e3:/usr/bin#
root@c172b78442e3:/usr/bin#
root@c172b78442e3:/usr/bin# cd ~
root@c172b78442e3:~#  cd yni/
root@c172b78442e3:~/yni#
root@c172b78442e3:~/yni# ll
total 824
drwxr-xr-x 4 root root   4096 Oct 26 06:57 ./
drwx------ 1 root root   4096 Oct 26 06:48 ../
drwxr-xr-x 2 root root   4096 Oct 26 06:45 CUDA11.5/
-rw-r--r-- 1 root root   3999 Oct 26 06:50 asyncAPI.cu
-rwxr-xr-x 1 root root 823232 Oct 26 06:57 out*
drwxr-xr-x 5 root root   4096 Oct 26 06:49 relCompiler/
root@c172b78442e3:~/yni#
root@c172b78442e3:~/yni#
root@c172b78442e3:~/yni#
root@c172b78442e3:~/yni# /usr/local/cuda-11.5/bin/nvcc -o out asyncAPI.cu -I ~/NVIDIA_CUDA-11.5_Samples/common/inc/
/usr/include/stdio.h(183): error: attribute "__malloc__" does not take arguments

/usr/include/stdio.h(195): error: attribute "__malloc__" does not take arguments

/usr/include/stdio.h(217): error: attribute "__malloc__" does not take arguments

/usr/include/stdio.h(254): error: attribute "__malloc__" does not take arguments

/usr/include/stdio.h(279): error: attribute "__malloc__" does not take arguments

/usr/include/stdio.h(288): error: attribute "__malloc__" does not take arguments

/usr/include/stdio.h(297): error: attribute "__malloc__" does not take arguments

/usr/include/stdio.h(303): error: attribute "__malloc__" does not take arguments

/usr/include/stdio.h(309): error: attribute "__malloc__" does not take arguments

/usr/include/stdio.h(824): error: attribute "__malloc__" does not take arguments

/usr/include/stdlib.h(565): error: attribute "__malloc__" does not take arguments

/usr/include/stdlib.h(569): error: attribute "__malloc__" does not take arguments

/usr/include/stdlib.h(797): error: attribute "__malloc__" does not take arguments

/usr/include/wchar.h(155): error: attribute "__malloc__" does not take arguments

/usr/include/wchar.h(582): error: attribute "__malloc__" does not take arguments

15 errors detected in the compilation of "asyncAPI.cu".
root@c172b78442e3:~/yni# gcc --version
gcc (Ubuntu 11.2.0-7ubuntu2) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

root@c172b78442e3:~/yni#
2 Likes

Thank you for your reply. last 2 weeks just working for this particular issue.
I was suspecting Nvidia kernel modules, somewhere cuda unable to communicate with Nvidia drivers.
However, since it is now official by Nvidia then looking forward to have fix for this.
One more question, how we know which kernel module Nvidia drivers works?. as you already know that sometimes we have to build our own kernel in order to support more device drivers, most distribution are very slow in updating to latest kernel.

many thanks.

Do you mean Linux kernel version ? Please refer to Installation Guide Linux :: CUDA Toolkit Documentation

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.