Failed to recompile dependent libraries

Hi,
I tried to recompile dependent libraries, as shown here: ROCK Pi 4 > Develoment > Comple a kernel module on ROCK Pi 4, but it fails with an error:

CC scripts/mod/empty.o
gcc: error: unrecognized command line option ‘-mgeneral-regs-only’
scripts/Makefile.build:277: recipe for target ‘scripts/mod/empty.o’ failed
make[2]: *** [scripts/mod/empty.o] Error 1
scripts/Makefile.build:484: recipe for target ‘scripts/mod’ failed
make[1]: *** [scripts/mod] Error 2
Makefile:584: recipe for target ‘scripts’ failed
make: *** [scripts] Error 2

Any idea what could still be missing in the preparation in order to succeed? I am directly working on the ROCK Pi 4 and not trying to cross-compile.
Thanks a lot!

Then you will need to waste time and adjust sources to match the compiler which comes with a distribution. If you don’t know how to do that, go and CC.

From your suggestion I conclude that the How-To (https://wiki.radxa.com/Rockpi4/dev/compile-a-kernel-module-on-rockpi4) is not correct? For me, the statement at the beginning on that page says that the compilation of the module is done on the ROCK Pi itself… no?

It is correct. Just sometimes it will not work without adjusting sources or changing compiler.