wireguard dkms raspberry segfault (solved)

- Posted in Linux by

Today, after updating wireguard to the latest version on my raspberry, the dkms kernel module failed to build with the following error: cc1: internal compiler error: Segmentation fault

My fix:

install older gcc (gcc 4.9 in my case): apt install gcc-4.9
link gcc to gcc-4.9: ln -sf /usr/bin/gcc-4.9 /usr/bin/gcc

Problem solved. It looks like gcc-8.3 (the one from buster) can't handle wireguard compiling, or wireguard is not gcc-8 compatible...didn't find anything conclusive about that, but my change fixed the problem. Please remember that you did this. Otherwise it might bite you in a year. :-)