kuhnmi
September 17, 2010, 12:39pm
1
Hi,
according to the nvcc man-page, there is a optimization flag (–optimize or -O). My code compiles fine if I don’t use any optimization flags, or set them to --optimize 0. However, when I try to use the optimizer flags (–optimize 2), I get compile errors such as these below:
/usr/include/string.h:43: error: inline function ‘void* memcpy(void*, const void*, size_t)’ cannot be declared weak
/usr/include/bits/string3.h:49: error: inline function ‘void* memcpy(void*, const void*, size_t)’ cannot be declared weak
/usr/local/cuda/bin/…/include/math_functions.h:422: error: inline function ‘int __signbit(double)’ cannot be declared weak
/usr/include/bits/mathcalls.h:350: error: inline function ‘int __signbit(double)’ cannot be declared weak
My complete nvcc command looks as follows: nvcc -c -arch sm_13 --ptxas-options=-v -m64 --optimize 2
Any ideas what is causing these compilation errors, and how to get around them (while still using nvcc optimization)? Any help is greatly appreciated!
Thanks,
Michael
hufo
September 22, 2010, 6:15am
2
Hi,
These errors can appear when using gcc 4.4+
Adding the following option can help: --compiler-options -fno-inline
Jeremie.
hufo
September 22, 2010, 6:15am
3
Hi,
These errors can appear when using gcc 4.4+
Adding the following option can help: --compiler-options -fno-inline
Jeremie.
kuhnmi
September 22, 2010, 5:55pm
4
Thanks for your suggestions.
I’m using gcc-4.3 (i.e. < gcc-4.4). I also tried the suggested flags. They reduced the number of errors from
/usr/include/string.h:43: error: inline function ‘void* memcpy(void*, const void*, size_t)’ cannot be declared weak
/usr/include/string.h:64: error: inline function ‘void* memset(void*, int, size_t)’ cannot be declared weak
/usr/include/bits/string3.h:49: error: inline function ‘void* memcpy(void*, const void*, size_t)’ cannot be declared weak
/usr/include/bits/string3.h:78: error: inline function ‘void* memset(void*, int, size_t)’ cannot be declared weak
/usr/local/cuda/bin/…/include/common_functions.h:59: error: inline function ‘void* memset(void*, int, size_t)’ cannot be declared weak
/usr/local/cuda/bin/…/include/common_functions.h:62: error: inline function ‘void* memcpy(void*, const void*, size_t)’ cannot be declared weak
/usr/local/cuda/bin/…/include/math_functions.h:422: error: inline function ‘int __signbit(double)’ cannot be declared weak
/usr/local/cuda/bin/…/include/math_functions.h:427: error: inline function ‘int __signbitf(float)’ cannot be declared weak
/usr/local/cuda/bin/…/include/math_functions.h:440: error: inline function ‘int __signbitl(long double)’ cannot be declared weak
/usr/include/bits/mathcalls.h:350: error: inline function ‘int __signbit(double)’ cannot be declared weak
/usr/include/bits/mathcalls.h:350: error: inline function ‘int __signbitf(float)’ cannot be declared weak
/usr/include/bits/mathcalls.h:350: error: inline function ‘int __signbitl(long double)’ cannot be declared weak
/usr/include/bits/mathinline.h:38: error: inline function ‘int __signbitf(float)’ cannot be declared weak
/usr/include/bits/mathinline.h:50: error: inline function ‘int __signbit(double)’ cannot be declared weak
/usr/include/bits/mathinline.h:62: error: inline function ‘int __signbitl(long double)’ cannot be declared weak
to
/usr/include/string.h:43: error: inline function ‘void* memcpy(void*, const void*, size_t)’ cannot be declared weak
/usr/include/string.h:64: error: inline function ‘void* memset(void*, int, size_t)’ cannot be declared weak
/usr/include/bits/string3.h:49: error: inline function ‘void* memcpy(void*, const void*, size_t)’ cannot be declared weak
/usr/include/bits/string3.h:78: error: inline function ‘void* memset(void*, int, size_t)’ cannot be declared weak
/usr/local/cuda/bin/…/include/common_functions.h:59: error: inline function ‘void* memset(void*, int, size_t)’ cannot be declared weak
/usr/local/cuda/bin/…/include/common_functions.h:62: error: inline function ‘void* memcpy(void*, const void*, size_t)’ cannot be declared weak
Any ideas how I can get rid of these?? I don’t use memcpy or memset in my device code, and I also don’t use them in my .cu and .cuh files.
Thanks for any hints!
kuhnmi
September 22, 2010, 5:55pm
5
Thanks for your suggestions.
I’m using gcc-4.3 (i.e. < gcc-4.4). I also tried the suggested flags. They reduced the number of errors from
/usr/include/string.h:43: error: inline function ‘void* memcpy(void*, const void*, size_t)’ cannot be declared weak
/usr/include/string.h:64: error: inline function ‘void* memset(void*, int, size_t)’ cannot be declared weak
/usr/include/bits/string3.h:49: error: inline function ‘void* memcpy(void*, const void*, size_t)’ cannot be declared weak
/usr/include/bits/string3.h:78: error: inline function ‘void* memset(void*, int, size_t)’ cannot be declared weak
/usr/local/cuda/bin/…/include/common_functions.h:59: error: inline function ‘void* memset(void*, int, size_t)’ cannot be declared weak
/usr/local/cuda/bin/…/include/common_functions.h:62: error: inline function ‘void* memcpy(void*, const void*, size_t)’ cannot be declared weak
/usr/local/cuda/bin/…/include/math_functions.h:422: error: inline function ‘int __signbit(double)’ cannot be declared weak
/usr/local/cuda/bin/…/include/math_functions.h:427: error: inline function ‘int __signbitf(float)’ cannot be declared weak
/usr/local/cuda/bin/…/include/math_functions.h:440: error: inline function ‘int __signbitl(long double)’ cannot be declared weak
/usr/include/bits/mathcalls.h:350: error: inline function ‘int __signbit(double)’ cannot be declared weak
/usr/include/bits/mathcalls.h:350: error: inline function ‘int __signbitf(float)’ cannot be declared weak
/usr/include/bits/mathcalls.h:350: error: inline function ‘int __signbitl(long double)’ cannot be declared weak
/usr/include/bits/mathinline.h:38: error: inline function ‘int __signbitf(float)’ cannot be declared weak
/usr/include/bits/mathinline.h:50: error: inline function ‘int __signbit(double)’ cannot be declared weak
/usr/include/bits/mathinline.h:62: error: inline function ‘int __signbitl(long double)’ cannot be declared weak
to
/usr/include/string.h:43: error: inline function ‘void* memcpy(void*, const void*, size_t)’ cannot be declared weak
/usr/include/string.h:64: error: inline function ‘void* memset(void*, int, size_t)’ cannot be declared weak
/usr/include/bits/string3.h:49: error: inline function ‘void* memcpy(void*, const void*, size_t)’ cannot be declared weak
/usr/include/bits/string3.h:78: error: inline function ‘void* memset(void*, int, size_t)’ cannot be declared weak
/usr/local/cuda/bin/…/include/common_functions.h:59: error: inline function ‘void* memset(void*, int, size_t)’ cannot be declared weak
/usr/local/cuda/bin/…/include/common_functions.h:62: error: inline function ‘void* memcpy(void*, const void*, size_t)’ cannot be declared weak
Any ideas how I can get rid of these?? I don’t use memcpy or memset in my device code, and I also don’t use them in my .cu and .cuh files.
Thanks for any hints!