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

build error #20

Open
Osmanyasal opened this issue Apr 27, 2024 · 1 comment
Open

build error #20

Osmanyasal opened this issue Apr 27, 2024 · 1 comment

Comments

@Osmanyasal
Copy link

make
[ 9%] Generating kernel_module/driver/x86_adapt_driver.ko
warning: the compiler differs from the one used to build the kernel
The kernel was built by: x86_64-linux-gnu-gcc-12 (Ubuntu 12.3.0-1ubuntu122.04) 12.3.0
You are using: gcc-12 (Ubuntu 12.3.0-1ubuntu1
22.04) 12.3.0
/home/rt7/Desktop/x86_adapt/build/kernel_module/driver/x86_adapt_driver.c: In function ‘get_current_task_cpu’:
/home/rt7/Desktop/x86_adapt/build/kernel_module/driver/x86_adapt_driver.c:702:19: error: ‘struct task_struct’ has no member named ‘cpu’
702 | return current->cpu;
| ^~
/home/rt7/Desktop/x86_adapt/build/kernel_module/driver/x86_adapt_driver.c: In function ‘x86_adapt_init’:
/home/rt7/Desktop/x86_adapt/build/kernel_module/driver/x86_adapt_driver.c:1553:5: error: implicit declaration of function ‘get_online_cpus’; did you mean ‘get_online_mems’? [-Werror=implicit-function-declaration]
1553 | get_online_cpus();
| ^~~~~~~~~~~~~~~
| get_online_mems
In file included from ./include/linux/linkage.h:7,
from ./arch/x86/include/asm/cache.h:5,
from ./include/linux/cache.h:6,
from ./include/linux/time.h:5,
from ./include/linux/stat.h:19,
from ./include/linux/module.h:13,
from /home/rt7/Desktop/x86_adapt/build/kernel_module/driver/x86_adapt_driver.c:2:
./include/linux/export.h:29:22: error: passing argument 1 of ‘class_create’ from incompatible pointer type [-Werror=incompatible-pointer-types]
29 | #define THIS_MODULE (&__this_module)
| ~^~~~~~~~~~~~~~~
| |
| struct module *
/home/rt7/Desktop/x86_adapt/build/kernel_module/driver/x86_adapt_driver.c:1562:41: note: in expansion of macro ‘THIS_MODULE’
1562 | if ((x86_adapt_class = class_create(THIS_MODULE, "x86_adapt")) == NULL) {
| ^~~~~~~~~~~
In file included from ./include/linux/device.h:31,
from ./include/linux/cdev.h:8,
from /home/rt7/Desktop/x86_adapt/build/kernel_module/driver/x86_adapt_driver.c:4:
./include/linux/device/class.h:230:54: note: expected ‘const char *’ but argument is of type ‘struct module *’
230 | struct class * __must_check class_create(const char *name);
| ~~~~~~~~~~~~^~~~
/home/rt7/Desktop/x86_adapt/build/kernel_module/driver/x86_adapt_driver.c:1562:28: error: too many arguments to function ‘class_create’
1562 | if ((x86_adapt_class = class_create(THIS_MODULE, "x86_adapt")) == NULL) {
| ^~~~~~~~~~~~
./include/linux/device/class.h:230:29: note: declared here
230 | struct class * __must_check class_create(const char name);
| ^~~~~~~~~~~~
/home/rt7/Desktop/x86_adapt/build/kernel_module/driver/x86_adapt_driver.c:1567:30: error: assignment to ‘char * (
)(const struct device *, umode_t )’ {aka ‘char * ()(const struct device *, short unsigned int )’} from incompatible pointer type ‘char * ()(struct device *, umode_t )’ {aka ‘char * ()(struct device *, short unsigned int *)’} [-Werror=incompatible-pointer-types]
1567 | x86_adapt_class->devnode = x86_adapt_devnode;
| ^
/home/rt7/Desktop/x86_adapt/build/kernel_module/driver/x86_adapt_driver.c:1632:5: error: implicit declaration of function ‘put_online_cpus’; did you mean ‘num_online_cpus’? [-Werror=implicit-function-declaration]
1632 | put_online_cpus();
| ^~~~~~~~~~~~~~~
| num_online_cpus
/home/rt7/Desktop/x86_adapt/build/kernel_module/driver/x86_adapt_driver.c: In function ‘get_current_task_cpu’:
/home/rt7/Desktop/x86_adapt/build/kernel_module/driver/x86_adapt_driver.c:707:1: error: control reaches end of non-void function [-Werror=return-type]
707 | }
| ^
cc1: some warnings being treated as errors
make[6]: *** [scripts/Makefile.build:251: /home/rt7/Desktop/x86_adapt/build/kernel_module/driver/x86_adapt_driver.o] Error 1
make[5]: *** [scripts/Makefile.build:488: /home/rt7/Desktop/x86_adapt/build/kernel_module/driver] Error 2
make[4]: *** [/usr/src/linux-headers-6.5.0-28-generic/Makefile:2039: /home/rt7/Desktop/x86_adapt/build/kernel_module] Error 2
make[3]: *** [Makefile:234: __sub-make] Error 2
make[2]: *** [CMakeFiles/x86_adapt_driver.dir/build.make:76: kernel_module/driver/x86_adapt_driver.ko] Error 2
make[1]: *** [CMakeFiles/Makefile2:90: CMakeFiles/x86_adapt_driver.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

@cvonelm
Copy link
Member

cvonelm commented Dec 11, 2024

The interface to class_create changed to `class_create(const char *name); in Linux 6.4, resulting in this build error.

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