Warnings from system-header with "--compiler-options -Wall" since CUDA 3.0

Hi all,

today I installed CUDA toolkit 3.0. I’m using the nvcc option –compiler-options -Wall and now I’m getting a lot of warnings from a system-header:

nvcc call:

/usr/local/cuda/bin/nvcc -arch sm_13 --compiler-options -Wall -m32 -I../libs -O3 -isystem /usr/local/cuda/include -o .objs/cuda/correlation.cu.o -c cuda/correlation.cu


/usr/include/c++/4.3/x86_64-linux-gnu/32/bits/gthr-default.h:100: warning: 'int __gthrw_pthread_once(pthread_once_t*, void (*)())' declared 'static' but never defined

/usr/include/c++/4.3/x86_64-linux-gnu/32/bits/gthr-default.h:101: warning: 'void* __gthrw_pthread_getspecific(pthread_key_t) throw ()' declared 'static' but never defined

/usr/include/c++/4.3/x86_64-linux-gnu/32/bits/gthr-default.h:102: warning: 'int __gthrw_pthread_setspecific(pthread_key_t, const void*) throw ()' declared 'static' but never defined

/usr/include/c++/4.3/x86_64-linux-gnu/32/bits/gthr-default.h:103: warning: 'int __gthrw_pthread_create(pthread_t*, const pthread_attr_t*, void* (*)(void*), void*) throw ()' declared 'static' but never defined


... and so on

Why is nvcc complaining about system-headers, afaik most compiler don’t display warnings from system headers?!

Those warnings aren’t generated by nvcc, they are generated by the host compiler (g++ in this case). nvcc isn’t a compiler, it just does a bit of pre-processing and relies on the host c++ compiler and nvopencc to compile host and device code.

Of course it doesn’t explain why. Do you have a self-contained piece of code that generates those warning you could post? And which compiler and distribution is this?

You’re right, I wasn’t thinking before writing that topic. Sorry :)

This short example generates the warnings:


#include <iostream>

int main() {

	return 0;


compiled with

/usr/local/cuda/bin/nvcc --compiler-options -Wall -o test.cu.o -c test.cu

The iostream-header is the problem, it includes gthr-default.h indirectly. Is there an option for nvcc which prints the host-compiler-calls with all arguments?? This would be very helpful.

nvcc --dryrun will print out the complete trajectory for whatever compilation phases you ask for.

My guess is that some definitions from iostream are interacting with the nvcc front end and causing the emitted code to generate warnings. Which compiler it is, I am not sure. If you try renaming that test.cu to test.cc and compile it will nvcc, it generates no errors

Thank you for your help. Unfortunately I got no helpful information with --dryrun. I will simply suppress the warnings with the appropriate -WnoXXX flag.

-Wall enables -Wunused-function which causes these warnings. Unfortunately there is no -Wnounused-function flag for gcc.

I tried to turn off the warning with #pragma GCC diagnostic ignored “-Wunused-function” at the beginning of the .cu file, but some compiler behind nvcc states “warning: unrecognized GCC pragma” and the warnings still apear. The pragma seems to be removed before the code is processed by gcc.

I have no further idea how to remove/suppress the warnings with an enabled -Wall flag…

For everyone who also runs into this: I opened a bug report which was accepted (status “to fix”, bug id 668859). So hopefully the next release won’t bother one anymore with these warnings.

Was this bug (#668859) solved? I’m compiling and getting a ton of warnings what makes stdout useless when compiling.

Built on Thu_Jul_17_21:41:27_CDT_2014
Cuda compilation tools, release 6.5, V6.5.12

I can compile many codes with -Xcompiler -Wall on CUDA 6.5 with no issues (including ).

I think the general issue raised 4 years ago concerning -Wall with has probably been fixed. You would probably need to identify more specifics about what you are doing (compile command line, OS, gcc version, and a sample code to compile). Reduce your code down to the specific headers that are creating the problem.