I use ubuntu 24.04 lts. I am trying to compile Makefile of my DEXP ZH-UTC2 usb-ethernet adapter with make command.
That is how Makefile of the driver looks like:
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 #<-- ERROR
$(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
And that is the error I receive when I try to compile it:
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
make[1]: Leaving directory '/usr/src/linux-headers-6.8.0-31-generic'
cc ax88179_programmer.c -o ax88179_programmer
make: cc: No such file or directory
make: *** [Makefile:19: all] Error 127
I would appreciate any help, as I am complete noob in Makefiles world. If you need some more info, hit me up in comments section and I will add it.
$(CC) ax88179_programmer.c -o ax88179_programmer
The CC
variable is not defined.
You should add a line CC=gcc
in this makefile