I have a CUDA-8 program which compiled (nvcc) well 7 months ago on Ubuntu 22.04, following this procedure, the underlying compiler being gcc (Ubuntu 5.3.1-14ubuntu2) 5.3.1 20160413.
After (not sure when) I upgraded some packages on Ubuntu 22, the program now only compiles if the optimization flag is set to -O0.
The minimal reproducer with file test.cpp:
int
main(int argc, char* argv[]) {
return 1;
}
And then run:
/opt/cuda-8.0/bin/nvcc -w --use_fast_math -Wno-deprecated-gpu-targets -O0 -x cu -c test.cpp
Compiles fine!
/opt/cuda-8.0/bin/nvcc -w --use_fast_math -Wno-deprecated-gpu-targets -O1 -x cu -c test.cpp
/usr/include/x86_64-linux-gnu/bits/string_fortified.h(104): error: identifier "__builtin___stpncpy_chk" is undefined
7 months ago, both variants worked fine.
I wanted to ask if there is something that can be done to fix this issue by amending the file string_fortified.h.
Based on the hint in this bug report comment (thanks Siddesh!), I came up with the following modification of the string_fortified.h header that solves the problem (you need to re-edit by hand every time this header is updated by your package manager):