-
Notifications
You must be signed in to change notification settings - Fork 120
hello-world
fails to build
#152
Comments
Ugh, that looks like your kernel is built with the structleak GCC plugin, and being a GCC plugin it won't run on clang, which we use to parse the header files. I think that structleak doesn't change the ABI, so you ought to be able to filter out the argument and have things work. Can you try modifying build.rs (or kernel-cflags-finder itself) to skip it? It might be as simple as adding an |
Same happens on arch linux (kernel version 5.3.5-arch1-1-ARCH) with clang 9. Problem is that the kernel-cflags-finder uses clang to compile a dummy module but clang doesn't support this feature. I worked around it by modifying /lib/modules/5.3.5-arch1-1-ARCH/build/scripts/Makefile.gcc-plugins to not add GCC_PLUGINS_CFLAGS to KBUILD_CFLAGS. |
Changing the flag finder make call to Added benefit, no need to modify kernel sources. |
Hi, how to filter CLANG: 9, 10 |
For plugins in general, I think the challenge is that randstruct does change the ABI and we need to break the build if you have it (or at least tell you to find a version of clang that supports randstruct), so we can't just set GCC_PLUGINS_CFLAGS to empty for everyone. I suspect none of the other plugins change the ABI, but we should check that carefully, and have a positive list of known safe plugins. I'm going to try to tackle this after some build system work - I'm trying to revive the change from #185 to move the logic of kernel-cflags-finder into build.rs, and I have that almost working. Once that's done, we can write this filtering logic in Rust instead of in make. |
randstruct is the only one that adds itself to modversions. But, I looked through them all to confirm:
|
Sigh. So I have a fix for the plugin issue, but it turns out you can't actually compile it after last night's refactoring to drive the build with CC=clang because clang as called by Kbuild to link the .ko gets thrown the -fplugin arguments. So I have a Rust .o that built fine because I filtered them out in build.rs, but I can't turn that into a kernel module. :( We'll need to figure out some Kbuild magic somehow. Also, note that this is going to require LLVM/Clang 11 (currently release candidate) because Manjaro is on a new enough kernel that it's using |
For the sake of pushing my work-in-progress somewhere, 68ad09b does compile on Manjaro's 5.6 kernel, but there are some definite Makefile crimes in there :) |
Trying to build
hello-world
as described here, but I'm getting this error:I'm on Manjaro Linux 18.0.4, with Linux kernel 5.2.8-1.
The text was updated successfully, but these errors were encountered: