Multiple Undefined errors when trying to compile hid-tmff2/deps/hid-tminit/hid-tminit-new.ko
Closed this issue · 11 comments
$ make
make -C deps/hid-tminit KDIR="/lib/modules/6.10.6-gentoo-x86_64/build"
make[1]: Entering directory '/home/mcadoo/git/hid-tmff2/deps/hid-tminit'
make -C /lib/modules/6.10.6-gentoo-x86_64/build M=/home/mcadoo/git/hid-tmff2/deps/hid-tminit modules
make[2]: Entering directory '/usr/src/linux-6.10.6-gentoo'
CC [M] /home/mcadoo/git/hid-tmff2/deps/hid-tminit/hid-tminit.o
CC [M] /home/mcadoo/git/hid-tmff2/deps/hid-tminit/tminit.o
LD [M] /home/mcadoo/git/hid-tmff2/deps/hid-tminit/hid-tminit-new.o
CC [M] /home/mcadoo/git/hid-tmff2/deps/hid-tminit/usb-tminit.o
LD [M] /home/mcadoo/git/hid-tmff2/deps/hid-tminit/usb-tminit-new.o
MODPOST /home/mcadoo/git/hid-tmff2/deps/hid-tminit/Module.symvers
ERROR: modpost: "__hid_register_driver" [/home/mcadoo/git/hid-tmff2/deps/hid-tminit/hid-tminit-new.ko] undefined!
ERROR: modpost: "memcpy" [/home/mcadoo/git/hid-tmff2/deps/hid-tminit/hid-tminit-new.ko] undefined!
ERROR: modpost: "kfree" [/home/mcadoo/git/hid-tmff2/deps/hid-tminit/hid-tminit-new.ko] undefined!
ERROR: modpost: "usb_get_intf" [/home/mcadoo/git/hid-tmff2/deps/hid-tminit/hid-tminit-new.ko] undefined!
ERROR: modpost: "hid_hw_stop" [/home/mcadoo/git/hid-tmff2/deps/hid-tminit/hid-tminit-new.ko] undefined!
ERROR: modpost: "usb_interrupt_msg" [/home/mcadoo/git/hid-tmff2/deps/hid-tminit/hid-tminit-new.ko] undefined!
ERROR: modpost: "usb_put_dev" [/home/mcadoo/git/hid-tmff2/deps/hid-tminit/hid-tminit-new.ko] undefined!
ERROR: modpost: "__stack_chk_fail" [/home/mcadoo/git/hid-tmff2/deps/hid-tminit/hid-tminit-new.ko] undefined!
ERROR: modpost: "usb_get_dev" [/home/mcadoo/git/hid-tmff2/deps/hid-tminit/hid-tminit-new.ko] undefined!
ERROR: modpost: "usb_submit_urb" [/home/mcadoo/git/hid-tmff2/deps/hid-tminit/hid-tminit-new.ko] undefined!
WARNING: modpost: suppressed 35 unresolved symbol warnings because there were too many)
make[4]: *** [scripts/Makefile.modpost:145: /home/mcadoo/git/hid-tmff2/deps/hid-tminit/Module.symvers] Error 1
make[3]: *** [/usr/src/linux-6.10.6-gentoo/Makefile:1886: modpost] Error 2
make[2]: *** [Makefile:240: __sub-make] Error 2
make[2]: Leaving directory '/usr/src/linux-6.10.6-gentoo'
make[1]: *** [Makefile:4: all] Error 2
make[1]: Leaving directory '/home/mcadoo/git/hid-tmff2/deps/hid-tminit'
make: *** [Makefile:16: deps/hid-tminit] Error 2
commit 580cabe
6.10.6-gentoo-x86_64 kernel
$ gcc --version
gcc (Gentoo Hardened 14.2.1_p20240817 p4) 14.2.1 20240817
Did you configure your kernel yourself? I had a go at installing Gentoo, but the pre-configured gentoo-kernel
seems to be at version 6.6.47 and has a different suffix (-gentoo-dist
versus your -gentoo-x86_64
). gentoo-kernel
seems to build the module just fine.
Yes, it's a kernel configuration I've tailored to my system. Using the latest sys-kernel/gentoo-sources at 6.10.6.
kernel config
kernel-config-6.10.6-gentoo-x86_64.gz
Thanks, I can try playing around with the config and see if I can replicate. I'm assuming there's some parameter that's not set, possibly HID_something
or maybe something related to modules, not sure. I'm unfortunately a bit busy at the moment but I hope I can get to it by the end of the week. Of course, feel free to look around yourself if you feel like it.
Has GCC 14.2 been tested on compiling the module?
Yep, at least Debian Testing's gcc (Debian 14.2.0-1) 14.2.0
works.
Okay, I snooped around a little, as a treat. I noticed that Modules.symvers
in /usr/src/linux
(with your config + 6.10.6 sources eselected) was empty for whatever reason. Modules.symvers
is the file that modpost
uses to link external modules (if I understand it correctly). Running ./scripts/mod/modpost -M -o Module.symvers -T modules.order vmlinux.o
from /usr/src/linux
populates Module.symvers
and the module compilation succeeds, but it's still a bit unclear to me why this doesn't happen automatically.
EDIT: Fixed the ./scripts/mod/modpost
command. Apparently they differ between 6.6.47
vs 6.10.6
, with 6.6.47
being
./scripts/mod/modpost -M -o Module.symvers -T modules.order vmlinux.o
and 6.10.6
./scripts/mod/modpost -M -m -o Module.symvers -T modules.order -t vmlinux.o
with the newer version producing an empty file, and the older one populating Modules.symvers
as expected. At first I accidentally copied the newer command because I thought they would be identical, but I had actually used the older one.
Alright, TRIM_UNUSED_KSYMS
was =y
, switched it to be =n
, that seems to get the module compiling as it should. TRIM_UNUSED_KSYMS
just adds the -t
option to scripts/mod/modpost
, as the name suggests, trimming out unused exports. In this case I guess it trims out all exports.
Nice! I'm looking forward to trying it out when you get things pushed over.
TRIM_UNUSED_KSYMS
is in your kernel config. You should change it, recompile, reinstall, grub-mkconfig
, etc. Nothing I can really do about it. Guess I was a bit vague.
Doing some winter cleanup, I never got a confirmation that my suggestion worked but if it didn't, feel free to reopen.