Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Undefined errors when trying to compile hid-tmff2/deps/hid-tminit/hid-tminit-new.ko #117

Closed
mattmcadoo opened this issue Aug 25, 2024 · 11 comments

Comments

@mattmcadoo
Copy link

mattmcadoo commented Aug 25, 2024

$ 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
@Kimplul
Copy link
Owner

Kimplul commented Aug 25, 2024

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.

@mattmcadoo
Copy link
Author

Yes, it's a kernel configuration I've tailored to my system. Using the latest sys-kernel/gentoo-sources at 6.10.6.

@mattmcadoo
Copy link
Author

kernel config
kernel-config-6.10.6-gentoo-x86_64.gz

@Kimplul
Copy link
Owner

Kimplul commented Aug 26, 2024

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.

@mattmcadoo
Copy link
Author

Has GCC 14.2 been tested on compiling the module?

@Kimplul
Copy link
Owner

Kimplul commented Aug 27, 2024

Yep, at least Debian Testing's gcc (Debian 14.2.0-1) 14.2.0 works.

@Kimplul
Copy link
Owner

Kimplul commented Aug 27, 2024

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.

@Kimplul
Copy link
Owner

Kimplul commented Aug 27, 2024

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.

@mattmcadoo
Copy link
Author

Nice! I'm looking forward to trying it out when you get things pushed over.

@Kimplul
Copy link
Owner

Kimplul commented Aug 29, 2024

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.

@Kimplul
Copy link
Owner

Kimplul commented Nov 3, 2024

Doing some winter cleanup, I never got a confirmation that my suggestion worked but if it didn't, feel free to reopen.

@Kimplul Kimplul closed this as completed Nov 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants