I am running Lubuntu 17.04 inside a VMWare virtual machine. I am trying to compile and install the driver for my D-Link DUB-1312 Gigabit Ethernet Adapter. However, I get the error in the code block below when I try to run make. After reading similar questions elsewhere, I've seen other users ask whether binutils is installed. It is installed on my Lubuntu system. I'm an inexperienced Linux user.
make -C /lib/modules/4.10.0-19-generic/build SUBDIRS=/home/magnus/Documents/DUB modules
make[1]: Entering directory '/usr/src/linux-headers-4.10.0-19-generic'
arch/x86/Makefile:140: CONFIG_X86_X32 enabled but no binutils support
./scripts/gcc-version.sh: line 25: gcc: command not found
./scripts/gcc-version.sh: line 26: gcc: command not found
make[1]: gcc: Command not found
make[1]: gcc: Command not found
make[1]: gcc: Command not found
make[1]: gcc: Command not found
make[1]: gcc: Command not found
CC [M] /home/magnus/Documents/DUB/DUB-13X2.o
/bin/sh: 1: gcc: not found
scripts/Makefile.build:301: recipe for target '/home/magnus/Documents/DUB/DUB-13X2.o' failed
make[2]: *** [/home/magnus/Documents/DUB/DUB-13X2.o] Error 127
Makefile:1524: recipe for target '_module_/home/magnus/Documents/DUB' failed
make[1]: *** [_module_/home/magnus/Documents/DUB] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.10.0-19-generic'
Makefile:30: recipe for target 'default' failed
make: *** [default] Error 2
Does anyone have any tips? Been stuck on this for too long.
EDIT: After installing gcc like Arun suggested, I've made some progress. I now get a new error:
make -C /lib/modules/4.10.0-19-generic/build SUBDIRS=/home/magnus/Documents/DUB modules
make[1]: Entering directory '/usr/src/linux-headers-4.10.0-19-generic'
CC [M] /home/magnus/Documents/DUB/DUB-13X2.o
/home/magnus/Documents/DUB/DUB-13X2.c:55:6: error: macro "__TIME__" might prevent reproducible builds [-Werror=date-time]
" " __TIME__ " " __DATE__ "\n"
^~~~~~~~
/home/magnus/Documents/DUB/DUB-13X2.c:55:19: error: macro "__DATE__" might prevent reproducible builds [-Werror=date-time]
" " __TIME__ " " __DATE__ "\n"
^~~~~~~~
cc1: some warnings being treated as errors
scripts/Makefile.build:301: recipe for target '/home/magnus/Documents/DUB/DUB-13X2.o' failed
make[2]: *** [/home/magnus/Documents/DUB/DUB-13X2.o] Error 1
Makefile:1524: recipe for target '_module_/home/magnus/Documents/DUB' failed
make[1]: *** [_module_/home/magnus/Documents/DUB] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.10.0-19-generic'
Makefile:30: recipe for target 'default' failed
make: *** [default] Error 2
For anyone who might ask, this is my Makefile:
CURRENT = $(shell uname -r)
#TARGET = usbnet
#OBJS = usbnet.o
TARGET = DUB-13X2
OBJS = DUB-13X2.o
MDIR = drivers/net/usb
KDIR = /lib/modules/$(CURRENT)/build
#KDIR = /root/Desktop/Android/UBIQCONN/android-3.0
SUBLEVEL= $(shell uname -r | cut -d '.' -f 3 | cut -d '.' -f 1 | cut -d '-' -f 1 | cut -d '_' -f 1)
USBNET = $(shell find $(KDIR)/include/linux/usb/* -name usbnet.h)
ifneq (,$(filter $(SUBLEVEL),14 15 16 17 18 19 20 21))
MDIR = drivers/usb/net
#USBNET = $(shell find $(KDIR)/$(MDIR)/* -name usbnet.h)
endif
#ifneq (,$(filter $(SUBLEVEL),21 22 23 24))
#USBNET = $(shell find $(KDIR)/$(MDIR)/* -name usbnet.h)
#endif
#$(if $(USBNET),,$(error $(KDIR)/$(MDIR)/usbnet.h not found. please refer to readme file for the detailed description))
EXTRA_CFLAGS = -DEXPORT_SYMTAB
PWD = $(shell pwd)
DEST = /lib/modules/$(CURRENT)/kernel/$(MDIR)
obj-m := $(TARGET).o
default:
make -C $(KDIR) SUBDIRS=$(PWD) modules
$(TARGET).o: $(OBJS)
$(LD) $(LD_RFLAG) -r -o $@ $(OBJS)
install:
su -c "cp -v $(TARGET).ko $(DEST) && /sbin/depmod -a"
clean:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) clean
.PHONY: modules clean
-include $(KDIR)/Rules.make
EDIT2: I added the flag, -Wno-date-time, like Arun suggested. This made the driver compile! After struggling a bit further, I also managed to install the driver. If your answer, Arun, had been an "answer" and not a comment, I would have marked it as a solution.