google / gasket-driver

GNU General Public License v2.0
47 stars 29 forks source link

Build started failing for OpenSUSE 15.5 #17

Open TheQue42 opened 10 months ago

TheQue42 commented 10 months ago

Hi,

I've been using this driver/lkm and building a module for my Opensuse Leap 15.4 system for a year or two, so that I can run frigate in a docker container, using the /dev/apex device.

I just now though, very stupidly, updated my host to Leap 15.5, and when I tried creating a new kernel module, I get:

WARNING: modpost: "module_layout" [drivers/staging/gasket/apex.ko] undefined! WARNING: modpost: "system_wq" [drivers/staging/gasket/apex.ko] undefined! WARNING: modpost: "kmalloc_caches" [drivers/staging/gasket/apex.ko] undefined! WARNING: modpost: "param_ops_int" [drivers/staging/gasket/apex.ko] undefined! WARNING: modpost: "pci_disable_device" [drivers/staging/gasket/apex.ko] undefined! WARNING: modpost: "delayed_work_timer_fn" [drivers/staging/gasket/apex.ko] undefined! WARNING: modpost: "param_ops_bool" [drivers/staging/gasket/apex.ko] undefined! WARNING: modpost: "init_timer_key" [drivers/staging/gasket/apex.ko] undefined! WARNING: modpost: "cancel_delayed_work_sync" [drivers/staging/gasket/apex.ko] undefined! WARNING: modpost: "mutex_unlock" [drivers/staging/gasket/apex.ko] undefined! WARNING: modpost: suppressed 125 unresolved symbol warnings because there were too many)

I think that maybe OpenSUSE simply isnt supported, but I would still kindly, and desperately, ask for any help or tips that might help solve this for me?

My suse system is running : Linux kernel 5.14.21-150500.55.19-default

robertzaage commented 10 months ago

Hmm, maybe you're missing kernel headers?

sudo zypper in kernel-devel

TheQue42 commented 10 months ago

Nope, already installed. There is something strange though, since I noticed the fix that was committed a few weeks ago, since I did get the ERROR: modpost: module gasket uses symbol dma_buf_detach from namespace DMA_BUF, but does not import it. errors... It's worth indicating that I am somewhat of a n00b when it comes to kernel && module building, and I am just now trying to learn to use DKMS, since I've been building the module manually via

make M=drivers/staging/gasket/

but the strange thing is that I sometimes STILL get the above "DMA_BUF" errors, despite the fact that I've got the fix in my code.

TheQue42 commented 10 months ago

I wouldn't mind an example of dkms.conf, since this will build two .ko modules not just one, so I am trying to make heads or tails out of how the dkms.conf should look.

robertzaage commented 10 months ago

but the strange thing is that I sometimes STILL get the above "DMA_BUF" errors, despite the fact that I've got the fix in my code.

This is really strange. I just looked into your versions tag in the OpenSUSE kernel repo, the include fix should work flawlessly.

Is this a fresh install or did you bumped your OS version by upgrade?

TheQue42 commented 10 months ago

I bumped, via zypper --releasever=15.5 dup, etc.

I've got a VM with 15.5, that I'll try some similar things with, and see. Its freshly installed.

TheQue42 commented 10 months ago

But since I cant really understand how to use a dkms on opensuse to build the module, my attempts are going veeery slowly.

I cant even find the original instructions I used on 15.4, where I simply copied the gasket-src into /usr/src/linux/drivers/staging/gasket, ran some make oldconfig, depend, prepare, etc" and then just make modules M=drivers/staging/gasket/, which build the .ko's.

Although I made a script of them, and its been working for years, every time I got a new kernel for 15.4.

TheQue42 commented 10 months ago

Well, isn't this annoying. I forgot, despite the fact that I've been banging my head against this earlier, opensuse 15.5, has GCC7.5 as default. And I think it doesn't support the __has_include preprocessor macro, (which is why I assume the preprocessor docs recommend using

#if defined __has_include
#  if __has_include (<stdatomic.h>)
#    include <stdatomic.h>
#  endif
#endif

But anyway, I first tried just forcefully using MODULE_IMPORT_NS(DMA_BUF); and that worked as well. Updating my system to gcc12, made it much simpler.

Some make oldconfig prepare in /usr/src/linux/ and then just

make -C /lib/modules/$(uname -r)/build M=$(pwd)

in the gasket src directory, and now I have my .ko's!

cyqsimon commented 9 months ago

Well, isn't this annoying. I forgot, despite the fact that I've been banging my head against this earlier, opensuse 15.5, has GCC7.5 as default. And I think it doesn't support the __has_include preprocessor macro, (which is why I assume the preprocessor docs recommend using

Yuck. That is seriously annoying, the fact __has_include is introduced as late as cpp17.

I don't think it's a good idea to revert #16, because backports seem to be even more common than I thought. And we can't really make any reasonable correlation between whether the compiler supports cpp17 (GCC >= 8 || Clang >=5) and whether the kernel needs MODULE_IMPORT_NS(DMA_BUF); either.

So what to do? Setting a minimum compiler version seems to be overkill but what else?

chrBrd commented 6 months ago

Sorry, very late to the party...

I'm the maintainer for this package on Tumbleweed, where installing it is as easy as using zypper. I attempted to get it included for Leap 15.5, but doing so is a bit more involved and life got in the way.

That said, the package builds just fine for Leap and therefore should run okay. This is the official 'development' repo: https://build.opensuse.org/package/show/hardware/gasket-driver

and this page shold allow you to install it: https://software.opensuse.org/package/gasket-driver

It's flagged as 'experimental' because it isn't in the official Leap repos, but it'll work just fine.