CUDA and gcc 4.4

It is a common issue when you are using gcc 4.4 to compile CUDA SDK. Since all CUDA SDK codes were built using the lower version of gcc, you’ll see following error message:

/usr/local/cuda/bin/../include/math_functions.h:442: error: inline function ‘int __signbitl(long double)’ cannot be declared weak make: *** [obj/release/] Error 255

To solve this, what you need to do is simply edit common/ file. In the line 126, it should be
NVCCFLAGS += --compiler-options -fno-strict-aliasing --compiler-options -fno-inline

You may also get the following error when compiling one of the examples in SDK (e.g BlackScholes):

error: ‘__builtin_stdarg_start’ was not declared in this scope

then you need to add another option to the NVCCFLAGS and it would look like this

NVCCFLAGS += --compiler-options -fno-strict-aliasing --compiler-options -fno-inline -Xcompiler -D__builtin_stdarg_start=__builtin_va_start

Below part is an optional. It’s just a suggestion to avoid leaked memory when you do make clean.

Add two more lines in C/Makefile :

clean: tidy $(addsuffix .ph_clean,$(PROJECTS))
@make -C common clean
@make -C common -f Makefile_paramgl clean
@make -C common -f Makefile_rendercheckgl clean