De acordo com a resposta , preciso incluir -lbsd no comando gcc. Mas não tenho ideia de onde devo inseri-lo aqui.
Estou usando Ubuntu 24.04, Linux vivobook16-m1605xa-mb089 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
.
Aqui está o Makefile que preciso compilar:
SHELL := /bin/bash
TARGET = ax_usb_nic
KDIR = /lib/modules/$(shell uname -r)/build
PWD = $(shell pwd)
CFILES = ax_main.c \
ax88179_178a.c \
ax88179a_772d.c
EXTRA_CFLAGS = -DEXPORT_SYMTAB -fno-pie
ifneq (,$(filter $(SUBLEVEL),14 15 16 17 18 19 20 21))
MDIR = kernel/drivers/usb/net
else
MDIR = kernel/drivers/net/usb
endif
$(TARGET)-objs := $(CFILES:.c=.o)
obj-m := $(TARGET).o
all:
make -C $(KDIR) M=$(PWD) modules
$(CC) ax88179_programmer.c -o ax88179_programmer
$(CC) ax88179a_programmer.c -o ax88179a_programmer
#$(CC) ax_ioctl.c -o ax_ioctl
install:
ifneq (,$(wildcard /lib/modules/$(shell uname -r)/$(MDIR)/ax88179_178a.ko))
gzip /lib/modules/$(shell uname -r)/$(MDIR)/ax88179_178a.ko
endif
make -C $(KDIR) M=$(PWD) INSTALL_MOD_DIR=$(MDIR) modules_install
depmod -A
clean:
make -C $(KDIR) M=$(PWD) clean
rm -f ax88179_programmer ax88179a_programmer ax_ioctl
Aqui está o erro que recebo depois de adicionar eu #include <bsd/string.h>
mesmo:
make -C /lib/modules/6.8.0-31-generic/build M=/home/lelechko/Downloads/dexp-zh-utc2_drajver_100507_30082022/AX88772D-AX88179A-Drive/ASIX_USB_NET_Linux_Driver_v1.0.0_b7_Source/ASIX_USB_NET_Linux_Driver_v1.0.0_Source_b7 modules
make[1]: Entering directory '/usr/src/linux-headers-6.8.0-31-generic'
warning: the compiler differs from the one used to build the kernel
The kernel was built by: x86_64-linux-gnu-gcc-13 (Ubuntu 13.2.0-23ubuntu4) 13.2.0
You are using: gcc-13 (Ubuntu 13.2.0-23ubuntu4) 13.2.0
CC [M] /home/lelechko/Downloads/dexp-zh-utc2_drajver_100507_30082022/AX88772D-AX88179A-Drive/ASIX_USB_NET_Linux_Driver_v1.0.0_b7_Source/ASIX_USB_NET_Linux_Driver_v1.0.0_Source_b7/ax_main.o
/home/lelechko/Downloads/dexp-zh-utc2_drajver_100507_30082022/AX88772D-AX88179A-Drive/ASIX_USB_NET_Linux_Driver_v1.0.0_b7_Source/ASIX_USB_NET_Linux_Driver_v1.0.0_Source_b7/ax_main.c:4:10: fatal error: bsd/string.h: No such file or directory
4 | #include <bsd/string.h>
| ^~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [scripts/Makefile.build:243: /home/lelechko/Downloads/dexp-zh-utc2_drajver_100507_30082022/AX88772D-AX88179A-Drive/ASIX_USB_NET_Linux_Driver_v1.0.0_b7_Source/ASIX_USB_NET_Linux_Driver_v1.0.0_Source_b7/ax_main.o] Error 1
make[2]: *** [/usr/src/linux-headers-6.8.0-31-generic/Makefile:1926: /home/lelechko/Downloads/dexp-zh-utc2_drajver_100507_30082022/AX88772D-AX88179A-Drive/ASIX_USB_NET_Linux_Driver_v1.0.0_b7_Source/ASIX_USB_NET_Linux_Driver_v1.0.0_Source_b7] Error 2
make[1]: *** [Makefile:240: __sub-make] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-6.8.0-31-generic'
make: *** [Makefile:20: all] Error 2
Eu apreciaria sua ajuda, como sou completamente novato em Makefiles, estou apenas tentando instalar o driver para meu adaptador USB-Ethernet DEXP ZH-UTC2