Ubuntu – Make: *** [modules] Error 2 when trying to install rtl8723de driver

compilingdriversmakerealtek-wireless

I was trying to install a wifi driver in my Ubuntu 18.04.
kernel 14.5 and hp laptop.

I ran these commands:

sudo apt-get install build-essential dkms
wget -d -c -O 'rtl8723de.zip' https://github.com/smlinux/rtl8723de/archive/4.11-up.zip
unzip rtl8723de.zip
cd rtl8723de
make

After make I get this output in terminal:

make ARCH=x86_64 CROSS_COMPILE= -C /lib/modules/4.15.0-22-generic/build M=/home/praveen/rtl8723de  modules
make[1]: Entering directory '/usr/src/linux-headers-4.15.0-22-generic'
Makefile:976: "Cannot use CONFIG_STACK_VALIDATION=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel"
  CC [M]  /home/praveen/rtl8723de/core/rtw_cmd.o
In file included from /home/praveen/rtl8723de/include/osdep_service.h:42:0,
                 from /home/praveen/rtl8723de/include/drv_types.h:32,
                 from /home/praveen/rtl8723de/core/rtw_cmd.c:22:
/home/praveen/rtl8723de/include/osdep_service_linux.h: In function ‘_init_timer’:
/home/praveen/rtl8723de/include/osdep_service_linux.h:287:8: error: ‘_timer {aka struct timer_list}’ has no member named ‘data’
  ptimer->data = (unsigned long)cntx;
        ^~
/home/praveen/rtl8723de/include/osdep_service_linux.h:288:2: error: implicit declaration of function ‘init_timer’; did you mean ‘_init_timer’? [-Werror=implicit-function-declaration]
  init_timer(ptimer);
  ^~~~~~~~~~
  _init_timer
cc1: some warnings being treated as errors
scripts/Makefile.build:332: recipe for target '/home/praveen/rtl8723de/core/rtw_cmd.o' failed
make[2]: *** [/home/praveen/rtl8723de/core/rtw_cmd.o] Error 1
Makefile:1552: recipe for target '_module_/home/praveen/rtl8723de' failed
make[1]: *** [_module_/home/praveen/rtl8723de] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.15.0-22-generic'
Makefile:1884: recipe for target 'modules' failed
make: *** [modules] Error 2

How do I solve this problem?

Best Answer

  • First, remove the inoperable files:

    sudo rm -r rtl8723de*
    

    Next, install another prerequisite:

    sudo apt update && sudo apt -y install git
    

    Now clone a better file:

    git clone https://github.com/lwfinger/rtlwifi_new.git
    

    Now build the driver:

    cd rtlwifi_new
    make
    sudo make install
    sudo modprobe rtl8723de
    

    Your wireless should now be working.

    EDIT: When Update Manager installs a newer kernel version, also known as linux-image, after the requested reboot, recompile:

    cd ~/rtlwifi_new
    make clean
    git pull
    make
    sudo make install
    sudo modprobe rtl8723de
    
  • Related Question