_ASM_EXTABLE_HANDLE virtualization compilation failure - c

I'm trying to compile this project from github but I am running into the following error:
make -C /lib/modules/5.15.0-53-generic/build M=/home/jr/Documents/ProtoVirt modules EXTRA_CFLAGS="-g -DDEBUG"
make[1]: Entering directory '/usr/src/linux-headers-5.15.0-53-generic'
warning: the compiler differs from the one used to build the kernel
The kernel was built by: gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0
You are using: gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
CC [M] /home/jr/Documents/ProtoVirt/protovirt.o
In file included from /home/jr/Documents/ProtoVirt/protovirt.c:23:
/home/jr/Documents/ProtoVirt/protovirt.h: In function ‘__rdmsr1’:
/home/jr/Documents/ProtoVirt/protovirt.h:25:22: error: expected ‘:’ or ‘)’ before ‘_ASM_EXTABLE_HANDLE’
25 | _ASM_EXTABLE_HANDLE(1b, 2b, ex_handler_rdmsr_unsafe)
| ^~~~~~~~~~~~~~~~~~~
/home/jr/Documents/ProtoVirt/protovirt.h:25:42: error: invalid suffix "b" on integer constant
25 | _ASM_EXTABLE_HANDLE(1b, 2b, ex_handler_rdmsr_unsafe)
| ^~
/home/jr/Documents/ProtoVirt/protovirt.h:25:46: error: invalid suffix "b" on integer constant
25 | _ASM_EXTABLE_HANDLE(1b, 2b, ex_handler_rdmsr_unsafe)
| ^~
/home/jr/Documents/ProtoVirt/protovirt.c: In function ‘initVmcsControlField’:
/home/jr/Documents/ProtoVirt/protovirt.c:282:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
282 | void *costum_rip;
| ^~~~
make[2]: *** [scripts/Makefile.build:297: /home/jr/Documents/ProtoVirt/protovirt.o] Error 1
make[1]: *** [Makefile:1903: /home/jr/Documents/ProtoVirt] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.15.0-53-generic'
make: *** [Makefile:12: modules] Error 2
The command I'm running is make. Can anyone explain to me what I'm doing wrong?

The _ASM_EXTABLE_HANDLE macro is replaced by _ASM_EXTABLE_TYPE in the newest kernel versions.

Related

ROS Melodic Install dkms error in Ubuntu 18.04 - Error! Bad return status for module build on kernel: 5.4.0-89-generic (x86_64)

I was trying to install ROS Melodic, and got this error:-
(ROSMelodic) (system) t#tsd:~/git/ROSMelodic$ sudo apt install ros-melodic-desktop-full
Reading package lists... Done
Building dependency tree
Reading state information... Done
ros-melodic-desktop-full is already the newest version (1.4.1-0bionic.20211216.192238).
The following packages were automatically installed and are no longer required:
golang-docker-credential-helpers gyp libjs-async libjs-inherits <etc. etc. long list of installed packages...>
Use 'sudo apt autoremove' to remove them.
0 to upgrade, 0 to newly install, 0 to remove and 87 not to upgrade.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up darling-dkms (0.1.20200331~testing) ...
>>> DKMS: Module add, build, and install....................................................................................................................................................................................]
darling-mach, 0.1: added
Kernel preparation unnecessary for this kernel. Skipping...
Building module:
cleaning build area...
'make' -C lkm/ MIGDIR=/usr/src/darling-mach-0.1/miggen MIGDIR_REL=../miggen KERNELVERSION=5.4.0-89-generic.........(bad exit status: 2)
Error! Bad return status for module build on kernel: 5.4.0-89-generic (x86_64)
Consult /var/lib/dkms/darling-mach/0.1/build/make.log for more information.
dpkg: error processing package darling-dkms (--configure):
installed darling-dkms package post-installation script subprocess returned error exit status 10
Errors were encountered while processing:
darling-dkms
E: Sub-process /usr/bin/dpkg returned an error code (1)
This is what is in the make.log :-
(ROSMelodic) (system) t#tsd:~/git/ROSMelodic$ cat /var/lib/dkms/darling-mach/0.1/build/make.log
DKMS make.log for darling-mach-0.1 for kernel 5.4.0-89-generic (x86_64)
Mon 17 Jan 01:19:25 GMT 2022
make: Entering directory '/var/lib/dkms/darling-mach/0.1/build/lkm'
Running kernel version is 5.4.0-89-generic
rm -f darling-mach.mod.o
make -C /lib/modules/5.4.0-89-generic/build M=/var/lib/dkms/darling-mach/0.1/build/lkm modules
make[1]: Entering directory '/usr/src/linux-headers-5.4.0-89-generic'
Running kernel version is 5.4.0-89-generic
Invoked by kernel build system, building for 5.4.0-89-generic
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/ipc_entry.o
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/ipc_hash.o
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/ipc_space.o
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/ipc_kmsg.o
In file included from /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/ipc_kmsg.c:140:0:
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/ipc_kmsg.c: In function ‘ipc_kmsg_get’:
/var/lib/dkms/darling-mach/0.1/build/lkm/darling/debug_print.h:29:55: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 5 has type ‘mach_port_t {aka struct ipc_port *}’ [-Wformat=]
not sure what this is about ?
# define debug_msg(fmt, ...) if (debug_output) printk("\0015Darling Mach: <%d> " fmt, linux_current->pid, ##__VA_ARGS__)
^
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/ipc_kmsg.c:1597:5: note: in expansion of macro ‘debug_msg’
debug_msg( "- ikm_header->msgh_size: %d, bits: 0x%x rport: 0x%x, lport: 0x%x, reserved: 0x%x, id: %d\n",
^~~~~~~~~
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/ipc_kmsg.c:1597:67: note: format string is defined here
debug_msg( "- ikm_header->msgh_size: %d, bits: 0x%x rport: 0x%x, lport: 0x%x, reserved: 0x%x, id: %d\n",
what is this about ?
~^
In file included from /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/ipc_kmsg.c:140:0:
/var/lib/dkms/darling-mach/0.1/build/lkm/darling/debug_print.h:29:55: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 6 has type ‘mach_port_t {aka struct ipc_port *}’ [-Wformat=]
# define debug_msg(fmt, ...) if (debug_output) printk("\0015Darling Mach: <%d> " fmt, linux_current->pid, ##__VA_ARGS__)
^
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/ipc_kmsg.c:1597:5: note: in expansion of macro ‘debug_msg’
debug_msg( "- ikm_header->msgh_size: %d, bits: 0x%x rport: 0x%x, lport: 0x%x, reserved: 0x%x, id: %d\n",
^~~~~~~~~
hmmm not sure about this
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/ipc_kmsg.c:1597:80: note: format string is defined here
debug_msg( "- ikm_header->msgh_size: %d, bits: 0x%x rport: 0x%x, lport: 0x%x, reserved: 0x%x, id: %d\n",
~^
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/ipc_kmsg.c: In function ‘ipc_kmsg_copyin’:
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/ipc_kmsg.c:3228:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
if ((kmsg->ikm_header->msgh_bits & MACH_MSGH_BITS_COMPLEX) == 0)
^~
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/ipc_kmsg.c:3231:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
mr = ipc_kmsg_copyin_body( kmsg, space, map);
^~
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/ipc_notify.o
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/ipc_object.o
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/ipc_pset.o
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/ipc_table.o
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/ipc_voucher.o
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/ipc_voucher.c: In function ‘ipc_get_pthpriority_from_kmsg_voucher’:
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/ipc_voucher.c:2636:2: warning: ISO C90 forbids variable length array ‘content_data’ [-Wvla]
uint8_t content_data[content_size];
^~~~~~~
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/ipc_voucher.c: In function ‘ipc_execute_voucher_recipe_command’:
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/ipc_voucher.c:1509:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (MACH_VOUCHER_ATTR_KEY_ALL == key) {
^
what is this about ?
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/ipc_voucher.c:1550:2: note: here
default:
^~~~~~~
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/ipc_voucher.c: In function ‘iv_dedup’:
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/ipc_voucher.c:1760:1: warning: the frame size of 1056 bytes is larger than 1024 bytes [-Wframe-larger-than=]
}
^
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/mig_log.o
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/mach_port.o
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/mach_msg.o
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/mach_debug.o
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/mach_kernelrpc.o
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/mach_kernelrpc.c: In function ‘host_create_mach_voucher_trap’:
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/mach_kernelrpc.c:446:3: warning: ISO C90 forbids variable length array ‘krecipes’ [-Wvla]
uint8_t krecipes[args->recipes_size];
^~~~~~~
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/mach_kernelrpc.c: In function ‘mach_voucher_extract_attr_recipe_trap’:
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/mach_kernelrpc.c:501:3: warning: ISO C90 forbids variable length array ‘krecipe’ [-Wvla]
uint8_t krecipe[sz];
^~~~~~~
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/ipc_init.o
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/ipc_right.o
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/ipc_mqueue.o
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/ipc/ipc_port.o
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/kern/sync_sema.o
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/darling/down_interruptible.o
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/darling/traps.o
In file included from /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/duct/duct.h:112:0,
from /var/lib/dkms/darling-mach/0.1/build/lkm/darling/traps.c:20:
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/duct/duct__pre_xnu_types.h:101:33: warning: ‘struct xnu_rlimit’ declared inside parameter list will not be visible outside of this definition or declaration
#define rlimit xnu_rlimit
^
./include/linux/sched/mm.h:137:14: note: in expansion of macro ‘rlimit’
struct rlimit *rlim_stack);
^~~~~~
not sure about this
/var/lib/dkms/darling-mach/0.1/build/lkm/darling/traps.c: In function ‘handle_to_path_entry’:
/var/lib/dkms/darling-mach/0.1/build/lkm/darling/traps.c:1779:10: warning: return makes integer from pointer without a cast [-Wint-conversion]
return ERR_PTR(-LINUX_EBADF);
^~~~~~~~~~~~~~~~~~~~~
/var/lib/dkms/darling-mach/0.1/build/lkm/darling/traps.c:1842:1: warning: the frame size of 4208 bytes is larger than 1024 bytes [-Wframe-larger-than=]
}
^
CC [M] /var/lib/dkms/darling- etc...
/var/lib/dkms/darling-mach/0.1/build/lkm/darling/evpsetfd.c: In function ‘evpsetfd_read’:
/var/lib/dkms/darling-mach/0.1/build/lkm/darling/evpsetfd.c:202:9: warning: assignment makes integer from pointer without a cast [-Wint-conversion]
addr = process_data;
^
interesting
In file included from /var/lib/dkms/darling-mach/0.1/build/lkm/darling/evpsetfd.c:37:0:
/var/lib/dkms/darling-mach/0.1/build/lkm/darling/evpsetfd.c: In function ‘knote’:
/var/lib/dkms/darling-mach/0.1/build/lkm/darling/debug_print.h:29:55: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘struct xnu_klist *’ [-Wformat=]
# define debug_msg(fmt, ...) if (debug_output) printk("\0015Darling Mach: <%d> " fmt, linux_current->pid, ##__VA_ARGS__)
^
/var/lib/dkms/darling-mach/0.1/build/lkm/darling/evpsetfd.c:359:5: note: in expansion of macro ‘debug_msg’
debug_msg("knote() on list 0x%x called with hint=0x%x\n", list, hint);
^~~~~~~~~
/var/lib/dkms/darling-mach/0.1/build/lkm/darling/evpsetfd.c:359:35: note: format string is defined here
debug_msg("knote() on list 0x%x called with hint=0x%x\n", list, hint);
~^
In file included from /var/lib/dkms/darling-mach/0.1/build/lkm/darling/evpsetfd.c:37:0:
/var/lib/dkms/darling-mach/0.1/build/lkm/darling/debug_print.h:29:55: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘long int’ [-Wformat=]
# define debug_msg(fmt, ...) if (debug_output) printk("\0015Darling Mach: <%d> " fmt, linux_current->pid, ##__VA_ARGS__)
^
/var/lib/dkms/darling-mach/0.1/build/lkm/darling/evpsetfd.c:359:5: note: in expansion of macro ‘debug_msg’
debug_msg("knote() on list 0x%x called with hint=0x%x\n", list, hint);
^~~~~~~~~
/var/lib/dkms/darling-mach/0.1/build/lkm/darling/evpsetfd.c:359:57: note: format string is defined here
debug_msg("knote() on list 0x%x called with hint=0x%x\n", list, hint);
~^
i
%lx
In file included from /var/lib/dkms/darling-mach/0.1/build/lkm/darling/evpsetfd.c:37:0:
/var/lib/dkms/darling-mach/0.1/build/lkm/darling/debug_print.h:29:55: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘wait_queue_head_t * {aka struct wait_queue_head *}’ [-Wformat=]
# define debug_msg(fmt, ...) if (debug_output) printk("\0015Darling Mach: <%d> " fmt, linux_current->pid, ##__VA_ARGS__)
^
/var/lib/dkms/darling-mach/0.1/build/lkm/darling/evpsetfd.c:368:3: note: in expansion of macro ‘debug_msg’
debug_msg("knote() is waking up a Linux wait queue 0x%x\n", &kn->wait_queue);
^~~~~~~~~
/var/lib/dkms/darling-mach/0.1/build/lkm/darling/evpsetfd.c:368:57: note: format string is defined here
debug_msg("knote() is waking up a Linux wait queue 0x%x\n", &kn->wait_queue);
~^
In file included from /var/lib/dkms/darling-mach/0.1/build/lkm/darling/evpsetfd.c:37:0:
/var/lib/dkms/darling-mach/0.1/build/lkm/darling/evpsetfd.c: In function ‘knote_attach_evpset’:
/var/lib/dkms/darling-mach/0.1/build/lkm/darling/debug_print.h:29:55: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘struct xnu_klist *’ [-Wformat=]
# define debug_msg(fmt, ...) if (debug_output) printk("\0015Darling Mach: <%d> " fmt, linux_current->pid, ##__VA_ARGS__)
^
/var/lib/dkms/darling-mach/0.1/build/lkm/darling/evpsetfd.c:381:2: note: in expansion of macro ‘debug_msg’
debug_msg("Attaching to klist 0x%x\n", list);
^~~~~~~~~
/var/lib/dkms/darling-mach/0.1/build/lkm/darling/evpsetfd.c:381:35: note: format string is defined here
debug_msg("Attaching to klist 0x%x\n", list);
~^
wrote
In file included from /var/lib/dkms/darling-mach/0.1/build/lkm/darling/evpsetfd.c:37:0:
/var/lib/dkms/darling-mach/0.1/build/lkm/darling/evpsetfd.c: In function ‘knote_detach_evpset’:
/var/lib/dkms/darling-mach/0.1/build/lkm/darling/debug_print.h:29:55: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘struct xnu_klist *’ [-Wformat=]
# define debug_msg(fmt, ...) if (debug_output) printk("\0015Darling Mach: <%d> " fmt, linux_current->pid, ##__VA_ARGS__)
^
/var/lib/dkms/darling-mach/0.1/build/lkm/darling/evpsetfd.c:388:2: note: in expansion of macro ‘debug_msg’
debug_msg("Detaching from klist 0x%x\n", list);
^~~~~~~~~
/var/lib/dkms/darling-mach/0.1/build/lkm/darling/evpsetfd.c:388:37: note: format string is defined here
debug_msg("Detaching from klist 0x%x\n", list);
~^
these
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/darling/pthread_kill.o
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/darling/psynch_support.o
/var/lib/dkms/darling-mach/0.1/build/lkm/darling/psynch_support.c: In function ‘kwq_handle_unlock’:
/var/lib/dkms/darling-mach/0.1/build/lkm/darling/psynch_support.c:3510:16: warning: this statement may fall through [-Wimplicit-fallthrough=]
longreadset = 1;
~~~~~~~~~~~~^~~
/var/lib/dkms/darling-mach/0.1/build/lkm/darling/psynch_support.c:3512:3: note: here
case PTH_RW_TYPE_READ: {
^~~~
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/darling/foreign_mm.o
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/darling/continuation.o
AS [M] /var/lib/dkms/darling-mach/0.1/build/lkm/darling/continuation-asm.o
/var/lib/dkms/darling-mach/0.1/build/lkm/darling/continuation-asm.S:6:16: warning: extra tokens at end of #ifndef directive
#ifndef ENDPROC(name)
^
words
/var/lib/dkms/darling-mach/0.1/build/lkm/darling/continuation-asm.o: warning: objtool: cont_setjmp()+0x23: indirect jump found in RETPOLINE build
/var/lib/dkms/darling-mach/0.1/build/lkm/darling/continuation-asm.o: warning: objtool: cont_longjmp()+0x2a: indirect jump found in RETPOLINE build
/var/lib/dkms/darling-mach/0.1/build/lkm/darling/continuation-asm.o: warning: objtool: cont_setjmp()+0x23: sibling call from callable instruction with modified stack frame
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/duct/darling_xnu_init.o
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/duct/duct_atomic.o
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/duct/duct_ipc_pset.o
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/duct/duct_kern_clock.o
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/duct/duct_kern_debug.o
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/duct/duct_kern_kalloc.o
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/duct/duct_kern_printf.o
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/duct/duct_kern_startup.o
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/duct/duct_kern_sysctl.o
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/duct/duct_kern_task.o
In file included from /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/duct/duct.h:112:0,
from /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/duct/duct_kern_task.c:36:
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/duct/duct__pre_xnu_types.h:101:33: warning: ‘struct xnu_rlimit’ declared inside parameter list will not be visible outside of this definition or declaration
#define rlimit xnu_rlimit
^
to
./include/linux/sched/mm.h:137:14: note: in expansion of macro ‘rlimit’
struct rlimit *rlim_stack);
^~~~~~
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/duct/duct_kern_thread_act.o
In file included from /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/duct/duct.h:112:0,
from /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/duct/duct_kern_thread_act.c:36:
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/duct/duct__pre_xnu_types.h:101:33: warning: ‘struct xnu_rlimit’ declared inside parameter list will not be visible outside of this definition or declaration
#define rlimit xnu_rlimit
^
break
./include/linux/sched/mm.h:137:14: note: in expansion of macro ‘rlimit’
struct rlimit *rlim_stack);
^~~~~~
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/duct/duct_kern_thread.o
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/duct/duct_kern_thread.c: In function ‘duct_thread_bootstrap’:
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/duct/duct_kern_thread.c:207:2: warning: #warning Init thread initialization disabled! [-Wcpp]
#warning Init thread initialization disabled!
^~~~~~~
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/duct/duct_kern_thread.c: In function ‘duct_thread_create_internal’:
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/duct/duct_kern_thread.c:273:2: warning: #warning compat_uthread disabled [-Wcpp]
#warning compat_uthread disabled
^~~~~~~
up
etc...
In file included from /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/duct/duct.h:112:0,
from /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/duct/duct_vm_user.c:35:
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/duct/duct__pre_xnu_types.h:101:33: warning: ‘struct xnu_rlimit’ declared inside parameter list will not be visible outside of this definition or declaration
#define rlimit xnu_rlimit
^
the
./include/linux/sched/mm.h:137:14: note: in expansion of macro ‘rlimit’
struct rlimit *rlim_stack);
^~~~~~
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/duct/duct_arm_locks_arm.o
In file included from /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/duct/duct_arm_locks_arm.h:44:0,
from /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/duct/duct_arm_locks_arm.c:36:
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/i386/lock.h:72:2: warning: #warning This header is deprecated. Use <kern/locks.h> instead. [-Wcpp]
#warning This header is deprecated. Use <kern/locks.h> instead.
^~~~~~~
log
etc...
mach/0.1/build/lkm/osfmk/kern/host.o
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/kern/host.c: In function ‘host_statistics64’:
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/kern/host.c:562:23: warning: assignment makes integer from pointer without a cast [-Wint-conversion]
stat->active_count = totalram_pages - stat->free_count;
^
so
etc...
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/kern/locks.o
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/kern/locks.c:801:1: warning: ‘lck_mtx_clear_promoted’ defined but not used [-Wunused-function]
lck_mtx_clear_promoted (
^~~~~~~~~~~~~~~~~~~~~~
it
etc...
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/kern/waitq.o
In file included from /var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/kern/waitq.c:63:0:
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/kern/backtrace.h:51:2: warning: ‘not_tail_called’ attribute directive ignored [-Wattributes]
__attribute__((noinline,not_tail_called));
^~~~~~~~~~~~~
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/kern/waitq.c: In function ‘wq_prepost_alloc’:
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/kern/waitq.c:829:1: warning: label ‘out’ defined but not used [-Wunused-label]
out:
^~~
passes
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/kern/waitq.c: In function ‘waitq_alloc_prepost_reservation’:
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/kern/waitq.c:4452:1: warning: label ‘do_alloc’ defined but not used [-Wunused-label]
do_alloc:
^~~~~~~~
At top level:
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/kern/waitq.c:692:13: warning: ‘wq_prepost_refill_cpu_cache’ defined but not used [-Wunused-function]
static void wq_prepost_refill_cpu_cache(uint32_t nalloc)
^~~~~~~~~~~~~~~~~~~~~~~~~~~
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/duct/osfmk/dummy-locks.o
In file included from /var/lib/dkms/darling-mach/0.1/build/lkm/duct/osfmk/dummy-locks.c:76:0:
/var/lib/dkms/darling-mach/0.1/build/lkm/osfmk/kern/lock.h:71:2: warning: #warning This header is deprecated. Use <kern/locks.h> instead. [-Wcpp]
#warning This header is deprecated. Use <kern/locks.h> instead.
^~~~~~~
/var/lib/dkms/darling-mach/0.1/build/lkm/duct/osfmk/dummy-locks.c:113:2: warning: #warning Implement locks? [-Wcpp]
#warning Implement locks?
^~~~~~~
for
CC [M] /var/lib/dkms/darling-mach/0.1/build/lkm/duct/osfmk/dummy-misc.o
/var/lib/dkms/darling-mach/0.1/build/lkm/duct/osfmk/dummy-misc.c: In function ‘mach_memory_info’:
/var/lib/dkms/darling-mach/0.1/build/lkm/duct/osfmk/dummy-misc.c:234:1: error: control reaches end of non-void function [-Werror=return-type]
}
^
stack overflow submission
cc1: some warnings being treated as errors
scripts/Makefile.build:270: recipe for target '/var/lib/dkms/darling-mach/0.1/build/lkm/duct/osfmk/dummy-misc.o' failed
make[2]: *** [/var/lib/dkms/darling-mach/0.1/build/lkm/duct/osfmk/dummy-misc.o] Error 1
Makefile:1762: recipe for target '/var/lib/dkms/darling-mach/0.1/build/lkm' failed
make[1]: *** [/var/lib/dkms/darling-mach/0.1/build/lkm] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.4.0-89-generic'
Makefile:325: recipe for target 'default' failed
make: *** [default] Error 2
make: Leaving directory '/var/lib/dkms/darling-mach/0.1/build/lkm'
(ROSMelodic) (system) t#tsd:~/git/ROSMelodic$
Wondering what I need to do to get the install of ROS Melodic working on my Ubuntu 18.04 machine
Trying Pedros suggestions:-
(ROSMelodic) (system) t#tsd:~/git/ROSMelodic$ sudo apt remove darling-dkms # remove faulty package
[sudo] password for t:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
golang-docker-credential-helpers ... etc...
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED
darling-dkms
0 to upgrade, 0 to newly install, 1 to remove and 85 not to upgrade.
1 not fully installed or removed.
After this operation, 63.5 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 426334 files and directories currently installed.)...]
Removing darling-dkms (0.1.20200331~testing) ...
>>> DKMS: Module uninstall
darling-mach, 0.1: added
------------------------------
Deleting module version: 0.1
completely from the DKMS tree.
------------------------------
Done.
(ROSMelodic) (system) timur#tsd:~/git/ROSMelodic$ sudo apt update && sudo apt upgrade
etc.
Hit:38 https://nvidia.github.io/nvidia-docker/ubuntu18.04/amd64 InRelease
Err:39 https://dl.bintray.com/rabbitmq-erlang/debian bionic InRelease
502 Bad Gateway [IP: 52.39.229.247 443]
Get:40 http://gb.archive.ubuntu.com/ubuntu bionic-updates/main amd64 DEP-11 Metadata [294 kB]
Err:41 https://dl.bintray.com/rabbitmq/debian bionic InRelease
502 Bad Gateway [IP: 52.39.229.247 443]
Get:42 http://gb.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 DEP-11 Metadata [300 kB]
Get:43 http://gb.archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 DEP-11 Metadata [2,468 B]
Get:44 http://gb.archive.ubuntu.com/ubuntu bionic-backports/universe amd64 DEP-11 Metadata [9,272 B]
Reading package lists... Done
E: The repository 'http://ppa.launchpad.net/nemonein/ksnip/ubuntu bionic Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: Target Packages (stable/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:56 and /etc/apt/sources.list.d/docker.list:1
W: Target Packages (stable/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:56 and /etc/apt/sources.list.d/docker.list:1
W: Target Translations (stable/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:56 and /etc/apt/sources.list.d/docker.list:1
W: Target Translations (stable/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:56 and /etc/apt/sources.list.d/docker.list:1
W: Target DEP-11 (stable/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:56 and /etc/apt/sources.list.d/docker.list:1
sudo apt install darling-dkms
E: Unable to locate package darling-dkms
The first problem probably made all the other errors message to appear, probably check darling-dkms.
sudo apt remove darling-dkms # remove faulty package
sudo apt update && sudo apt upgrade # update & upgrade packages. This should also upgrade your kernel to a newer version (for me, this was 5.10.0-1051-oem)
sudo apt install darling-dkms
Which one do you have installed and what is the required version?
Also, did you check installation guide:
http://wiki.ros.org/melodic/Installation/Ubuntu
There are some pre-installation steps:
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
And:
sudo apt install curl # if you haven't already installed curl
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
Downloading and installing the Debian of darling from this website
https://github.com/darlinghq/darling/releases
https://github.com/darlinghq/darling/releases/download/v0.1.20210224/darling-dkms_0.1.20210224.testing_amd64.deb
solved this darling-dkms error
From following the instructions in the ROS website, I also had to do this
sudo pip install rosdep==0.21.0

make CC=other_cc in windows

maybe this question is stupid but i really am not able to get a way to fix this i am trying to make a file in Cygwin64 i have all the dependency files installed, but when i make the file it throws me this
$ make
x86_64-w64-mingw32-gcc -D OS_WINDOWS_NT -ansi -Wall -O2 -Wno-long-long -I /usr/include -c -o main.o main.c
In file included from /usr/include/sys/_pthreadtypes.h:12,
from /usr/include/sys/types.h:223,
from /usr/include/stdio.h:61,
from main.c:5:
/usr/include/sys/cpuset.h:17:30: error: expected expression before ‘/’ token
17 | #define __CPU_SETSIZE 1024 // maximum number of logical processors tracked
| ^
/usr/include/sys/cpuset.h:19:25: note: in expansion of macro ‘__CPU_SETSIZE’
19 | #define __CPU_GROUPMAX (__CPU_SETSIZE / __NCPUBITS) // maximum group number
| ^~~~~~~~~~~~~
/usr/include/sys/cpuset.h:26:21: note: in expansion of macro ‘__CPU_GROUPMAX’
26 | __cpu_mask __bits[__CPU_GROUPMAX];
| ^~~~~~~~~~~~~~
/usr/include/sys/cpuset.h:19:55: error: expected expression before ‘/’ token
19 | #define __CPU_GROUPMAX (__CPU_SETSIZE / __NCPUBITS) // maximum group number
| ^
/usr/include/sys/cpuset.h:26:21: note: in expansion of macro ‘__CPU_GROUPMAX’
26 | __cpu_mask __bits[__CPU_GROUPMAX];
| ^~~~~~~~~~~~~~
/usr/include/sys/cpuset.h:27:1: warning: no semicolon at end of struct or union
27 | } cpu_set_t;
| ^
In file included from /usr/include/errno.h:9,
from main.c:8:
/usr/include/sys/errno.h:14: warning: "errno" redefined
14 | #define errno (*__errno())
|
In file included from /usr/lib/gcc/x86_64-w64-mingw32/10/include/stddef.h:1,
from /usr/include/sys/cdefs.h:47,
from /usr/include/stdio.h:35,
from main.c:5:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/stddef.h:19: note: this is the location of the previous definition
19 | #define errno (*_errno())
|
make: *** [<builtin>: main.o] Error 1
Your problem is that you've added the -ansi option to your compile line:
x86_64-w64-mingw32-gcc -D OS_WINDOWS_NT -ansi ...
The -ansi option tells the compiler to compile your code as if it were ANSI C 89 standard code. That version of the standard did not support the // single-line comment delimiter: it only supports the traditional /* ... */ comments.
However the header file you're including clearly expects to be able to use // comments. So you cannot use the -ansi flag when you compile with these header files.

How to read a text file from Linux Kernel Module (Linux Kernel 5.11.0)

I want to read a txt file and write another txt file in kernel module
How should I do ?
I have seen many website.
It seems like it has many ways to solve this question
ex : filp_read() or kernel_read() or vfs_read()
[Sloved] But I have tried many times, it couldn't makefile.
[Answer] Use mv make Makefile
reverse.c
#include <linux/module.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/uaccess.h>
static char buf[] ="It's from linux kernel\n";
static char buf1[32];
int __init test_init(void)
{
struct file *fp;
mm_segment_t fs;
loff_t pos;
printk("test enter\n");
fp =filp_open("/home/j0000/Desktop/file/kernel_file",O_RDWR | O_CREAT,0644);
if (IS_ERR(fp)){
printk("create file error\n");
return -1;
}
fs =get_fs();
set_fs(KERNEL_DS);
pos =0;
vfs_write(fp,buf, sizeof(buf), &pos);
pos =0;
vfs_read(fp,buf1, sizeof(buf), &pos);
printk("Write contet=%s\n",buf1);
filp_close(fp,NULL);
set_fs(fs);
return 0;
}
void __exit test_exit(void)
{
printk("test exit\n");
}
module_init(test_init);
module_exit(test_exit);
MODULE_LICENSE("GPL");
makefile
obj-m :=reverse.o
read_userspace-objs:= read_userspace_file.o
KVERSION := $(shell uname -r)
KDIR := /usr/src/linux-headers-$(KVERSION)/
PWD := $(shell pwd)
default:
make -C $(KDIR) M=$(PWD) modules
clean:
rm -rf *.o *.cmd *.ko *.mod.c .tmp_versions Module.symvers modules.order
error message
j0000#ubuntu:~/Desktop/file$ make
make -C /usr/src/linux-headers-5.11.0-37-generic/ M=/home/j0000/Desktop/file modules
make[1]: Entering directory '/usr/src/linux-headers-5.11.0-37-generic'
scripts/Makefile.build:44: /home/j0000/Desktop/file/Makefile: No such file or directory
make[2]: *** No rule to make target '/home/j0000/Desktop/file/Makefile'. Stop.
make[1]: *** [Makefile:1849: /home/j0000/Desktop/file] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.11.0-37-generic'
make: *** [makefile:8: default] Error 2
j0000#ubuntu:~/Desktop/file$
updated error message
I have seen these error many times~
So may I ask why it can't use get_fs & set_fs in this situation
j0000#ubuntu:~/Desktop/file$ make
make -C /usr/src/linux-headers-5.11.0-37-generic/ M=/home/j0000/Desktop/file modules
make[1]: Entering directory '/usr/src/linux-headers-5.11.0-37-generic'
CC [M] /home/j0000/Desktop/file/reverse.o
/home/j0000/Desktop/file/reverse.c: In function ‘test_init’:
/home/j0000/Desktop/file/reverse.c:20:9: error: implicit declaration of function ‘get_fs’; did you mean ‘sget_fc’? [-Werror=implicit-function-declaration]
20 | fs =get_fs();
| ^~~~~~
| sget_fc
/home/j0000/Desktop/file/reverse.c:20:9: error: incompatible types when assigning to type ‘mm_segment_t’ {aka ‘struct <anonymous>’} from type ‘int’
/home/j0000/Desktop/file/reverse.c:21:5: error: implicit declaration of function ‘set_fs’; did you mean ‘sget_fc’? [-Werror=implicit-function-declaration]
21 | set_fs(KERNEL_DS);
| ^~~~~~
| sget_fc
/home/j0000/Desktop/file/reverse.c:21:12: error: ‘KERNEL_DS’ undeclared (first use in this function); did you mean ‘KERNFS_NS’?
21 | set_fs(KERNEL_DS);
| ^~~~~~~~~
| KERNFS_NS
/home/j0000/Desktop/file/reverse.c:21:12: note: each undeclared identifier is reported only once for each function it appears in
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:288: /home/j0000/Desktop/file/reverse.o] Error 1
make[1]: *** [Makefile:1849: /home/j0000/Desktop/file] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.11.0-37-generic'
make: *** [Makefile:8: default] Error 2
Actually I use this website for tutorial
https://www.cnblogs.com/arnoldlu/p/8879800.html
After all, I will use kernel_read & kernel_write to fix my bug.
Thanks for answering my question :)

Error no member named 'reqevents'; did you mean 'events' when building Redis on AIX

I'm upgrading from Redis 6.0.13 to 6.2.5 on AIX.
On 6.2.5, the build fails with this error:
MAKE hdr_histogram
cd hdr_histogram && make
make[3]: Entering directory '/home/jenkins/redis/deps/hdr_histogram'
/opt/atc-2.0/opt/gcc/bin/gcc -Wall -Os -g -DLUA_USE_POSIX -DLUA_USE_DLOPEN -include stdint-gcc.h -c hdr_histogram.c
make[3]: Leaving directory '/home/jenkins/redis/deps/hdr_histogram'
make[2]: Leaving directory '/home/jenkins/redis/deps'
CC adlist.o
CC quicklist.o
CC ae.o
In file included from ae.c:60:
ae_select.c: In function 'aeApiResize':
ae_select.c:52:37: warning: unused parameter 'eventLoop' [-Wunused-parameter]
52 | static int aeApiResize(aeEventLoop *eventLoop, int setsize) {
| ~~~~~~~~~~~~~^~~~~~~~~
In file included from /usr/include/poll.h:30,
from ae.c:41:
ae_select.c: In function 'aeApiPoll':
ae_select.c:89:43: error: 'aeEventLoop' has no member named 'reqevents'; did you mean 'events'?
89 | aeFileEvent *fe = &eventLoop->events[j];
| ^~~~~~
ae.c: In function 'aeCreateEventLoop':
ae.c:73:16: error: 'aeEventLoop' has no member named 'reqevents'; did you mean 'events'?
73 | eventLoop->events = zmalloc(sizeof(aeFileEvent)*setsize);
| ^~~~~~
...
I checked the eventLoop struct, and it does indeed contain events, but I see the build failing because it's trying to access reqevents. I can't find reqevents anywhere in the project (with grep -R 'reqevents' .)
This error only happens on AIX 7.1 - Linux and macOS both work fine.
Do you know why req would be prepended to the struct members on AIX, and how I might solve the error?

"Static declaration of ‘memfd_create’ follows non-static declaration" Error while building Linux image using Yocto

I am building Linux Image using Yoctobuild system on Ubuntu 18.04 host machine. I am following steps provided over here. I am building for Colibri iMX6ULL computer-on-module. However, my build has failed and it is showing errors given below
declaration of ‘memfd_create’ follows non-static declaration
| static int memfd_create(const char *name, unsigned int flags)
| ^~~~~~~~~~~~
| In file included from /usr/include/x86_64-linux-gnu/bits/mman-linux.h:115:0,
| from /usr/include/x86_64-linux-gnu/bits/mman.h:45,
| from /usr/include/x86_64-linux-gnu/sys/mman.h:41,
| from /home/abhiarora/iohertz/gateway_os/yocto/build/tmp-glibc/work/x86_64-linux/qemu-native/2.10.0-r0/qemu-2.10.0/include/sysemu/os-posix.h:29,
| from /home/abhiarora/iohertz/gateway_os/yocto/build/tmp-glibc/work/x86_64-linux/qemu-native/2.10.0-r0/qemu-2.10.0/include/qemu/osdep.h:104,
| from /home/abhiarora/iohertz/gateway_os/yocto/build/tmp-glibc/work/x86_64-linux/qemu-native/2.10.0-r0/qemu-2.10.0/util/memfd.c:28:
| /usr/include/x86_64-linux-gnu/bits/mman-shared.h:46:5: note: previous declaration of ‘memfd_create’ was here
| int memfd_create (const char *__name, unsigned int __flags) __THROW;
| ^~~~~~~~~~~~
| /home/abhiarora/iohertz/gateway_os/yocto/build/tmp-glibc/work/x86_64-linux/qemu-native/2.10.0-r0/qemu-2.10.0/rules.mak:66: recipe for target 'util/memfd.o' failed
And this error:
| gcc -c -I. -I../lib -I../../git/lib -isystem/home/abhiarora/iohertz/gateway_os/yocto/build/tmp-glibc/work/x86_64-linux/e2fsprogs-native/1.43.5-r0/recipe-sysroot-native/usr/include -isystem/home/abhiarora/iohertz/gateway_os/yocto/build/tmp-glibc/work/x86_64-linux/e2fsprogs-native/1.43.5-r0/recipe-sysroot-native/usr/include -O2 -pipe -DHAVE_CONFIG_H -I../../git/debugfs/../e2fsck -DDEBUGFS ../../git/debugfs/quota.c -o quota.o
| ../../git/debugfs/../misc/create_inode.c:406:18: error: conflicting types for ‘copy_file_range’
| static errcode_t copy_file_range(ext2_filsys fs, int fd, ext2_file_t e2_file,
| ^~~~~~~~~~~~~~~
| In file included from ../../git/debugfs/../misc/create_inode.c:19:0:
| /usr/include/unistd.h:1110:9: note: previous declaration of ‘copy_file_range’ was here
| ssize_t copy_file_range (int __infd, __off64_t *__pinoff,
| ^~~~~~~~~~~~~~~
| gcc -c -I. -I../lib -I../../git/lib -isystem/home/abhiarora/iohertz/gateway_os/yocto/build/tmp-glibc/work/x86_64-linux/e2fsprogs-native/1.43.5-r0/recipe-sysroot-native/usr/include -isystem/home/abhiarora/iohertz/gateway_os/yocto/build/tmp-glibc/work/x86_64-linux/e2fsprogs-native/1.43.5-r0/recipe-sysroot-native/usr/include -O2 -pipe -DHAVE_CONFIG_H -I../../git/debugfs/../e2fsck -DDEBUGFS ../../git/debugfs/xattrs.c -o xattrs.o
| Makefile:422: recipe for target 'create_inode.o' failed
| make[2]: *** [create_inode.o] Error 1
| make[2]: *** Waiting for unfinished jobs....
The packages/tasks that were failed:
e2fsprogs_1.43.5
qemu_2.10.0
Can someone help me? I can't switch to ubuntu 16.04 but I think it should be working with my system as well.
This is a known issue at Toradex and is on the Roadmap, see issue #36657.
Fixes are already in the upstream layers, and we have updated our BSP repo. You can try this branch by using the LinuxImageV2.7-integration branch.

Resources