fastoe / RTL8812BU

Realtek RTL8812BU Driver for Linux
346 stars 84 forks source link

"prandom_u32_max" build failure under Linux 6.1.0 #39

Open lamby opened 1 year ago

lamby commented 1 year ago
/home/lamby/temp/cdt.20221221115757.cmvTwmdtNA/RTL8812BU/os_dep/osdep_service.c: In function ‘rtw_change_ifname’:
/home/lamby/temp/cdt.20221221115757.cmvTwmdtNA/RTL8812BU/os_dep/osdep_service.c:2574:28: warning: passing argument 1 of ‘_rtw_memcpy’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 2574 |         _rtw_memcpy(pnetdev->dev_addr, adapter_mac_addr(padapter), ETH_ALEN);
      |                     ~~~~~~~^~~~~~~~~~
/home/lamby/temp/cdt.20221221115757.cmvTwmdtNA/RTL8812BU/os_dep/osdep_service.c:922:24: note: expected ‘void *’ but argument is of type ‘const unsigned char *’
  922 | void _rtw_memcpy(void *dst, const void *src, u32 sz)
      |                  ~~~~~~^~~
/home/lamby/temp/cdt.20221221115757.cmvTwmdtNA/RTL8812BU/os_dep/osdep_service.c: In function ‘rtw_random32’:
/home/lamby/temp/cdt.20221221115757.cmvTwmdtNA/RTL8812BU/os_dep/osdep_service.c:2698:16: error: implicit declaration of function ‘prandom_u32’; did you mean ‘prandom_u32_max’? [-Werror=implicit-function-declaration]
 2698 |         return prandom_u32();
      |                ^~~~~~~~~~~
      |                prandom_u32_max
cc1: some warnings being treated as errors
make[2]: *** [/usr/src/linux-headers-6.1.0-0-common/scripts/Makefile.build:255: /home/lamby/temp/cdt.20221221115757.cmvTwmdtNA/RTL8812BU/os_dep/osdep_service.o] Error 1
make[1]: *** [/usr/src/linux-headers-6.1.0-0-common/Makefile:2017: /home/lamby/temp/cdt.20221221115757.cmvTwmdtNA/RTL8812BU] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-6.1.0-0-amd64'
make: *** [Makefile:2390: modules] Error 2
fastoe commented 1 year ago

Please provide the error message and OS information 'uname -a'.

fastoe commented 1 year ago

For kernel 5.11 or later, please clone the v5.13.1 branch:

sudo apt update sudo apt install -y build-essential dkms git bc git clone -b v5.13.1 https://github.com/fastoe/RTL8812BU.git cd RTL8812BU make sudo make install sudo reboot

hubgit115 commented 1 year ago
/home/lamby/temp/cdt.20221221115757.cmvTwmdtNA/RTL8812BU/os_dep/osdep_service.c: In function ‘rtw_change_ifname’:
/home/lamby/temp/cdt.20221221115757.cmvTwmdtNA/RTL8812BU/os_dep/osdep_service.c:2574:28: warning: passing argument 1 of ‘_rtw_memcpy’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 2574 |         _rtw_memcpy(pnetdev->dev_addr, adapter_mac_addr(padapter), ETH_ALEN);
      |                     ~~~~~~~^~~~~~~~~~
/home/lamby/temp/cdt.20221221115757.cmvTwmdtNA/RTL8812BU/os_dep/osdep_service.c:922:24: note: expected ‘void *’ but argument is of type ‘const unsigned char *’
  922 | void _rtw_memcpy(void *dst, const void *src, u32 sz)
      |                  ~~~~~~^~~
/home/lamby/temp/cdt.20221221115757.cmvTwmdtNA/RTL8812BU/os_dep/osdep_service.c: In function ‘rtw_random32’:
/home/lamby/temp/cdt.20221221115757.cmvTwmdtNA/RTL8812BU/os_dep/osdep_service.c:2698:16: error: implicit declaration of function ‘prandom_u32’; did you mean ‘prandom_u32_max’? [-Werror=implicit-function-declaration]
 2698 |         return prandom_u32();
      |                ^~~~~~~~~~~
      |                prandom_u32_max
cc1: some warnings being treated as errors
make[2]: *** [/usr/src/linux-headers-6.1.0-0-common/scripts/Makefile.build:255: /home/lamby/temp/cdt.20221221115757.cmvTwmdtNA/RTL8812BU/os_dep/osdep_service.o] Error 1
make[1]: *** [/usr/src/linux-headers-6.1.0-0-common/Makefile:2017: /home/lamby/temp/cdt.20221221115757.cmvTwmdtNA/RTL8812BU] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-6.1.0-0-amd64'
make: *** [Makefile:2390: modules] Error 2

i have the same problem plz provide me with the soultion i am trying it for the tp link wifi adapter

hubgit115 commented 1 year ago
/home/lamby/temp/cdt.20221221115757.cmvTwmdtNA/RTL8812BU/os_dep/osdep_service.c: In function ‘rtw_change_ifname’:
/home/lamby/temp/cdt.20221221115757.cmvTwmdtNA/RTL8812BU/os_dep/osdep_service.c:2574:28: warning: passing argument 1 of ‘_rtw_memcpy’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 2574 |         _rtw_memcpy(pnetdev->dev_addr, adapter_mac_addr(padapter), ETH_ALEN);
      |                     ~~~~~~~^~~~~~~~~~
/home/lamby/temp/cdt.20221221115757.cmvTwmdtNA/RTL8812BU/os_dep/osdep_service.c:922:24: note: expected ‘void *’ but argument is of type ‘const unsigned char *’
  922 | void _rtw_memcpy(void *dst, const void *src, u32 sz)
      |                  ~~~~~~^~~
/home/lamby/temp/cdt.20221221115757.cmvTwmdtNA/RTL8812BU/os_dep/osdep_service.c: In function ‘rtw_random32’:
/home/lamby/temp/cdt.20221221115757.cmvTwmdtNA/RTL8812BU/os_dep/osdep_service.c:2698:16: error: implicit declaration of function ‘prandom_u32’; did you mean ‘prandom_u32_max’? [-Werror=implicit-function-declaration]
 2698 |         return prandom_u32();
      |                ^~~~~~~~~~~
      |                prandom_u32_max
cc1: some warnings being treated as errors
make[2]: *** [/usr/src/linux-headers-6.1.0-0-common/scripts/Makefile.build:255: /home/lamby/temp/cdt.20221221115757.cmvTwmdtNA/RTL8812BU/os_dep/osdep_service.o] Error 1
make[1]: *** [/usr/src/linux-headers-6.1.0-0-common/Makefile:2017: /home/lamby/temp/cdt.20221221115757.cmvTwmdtNA/RTL8812BU] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-6.1.0-0-amd64'
make: *** [Makefile:2390: modules] Error 2

i have the same problem plz provide me with the soultion i am trying it for the tp link wifi adapter

Linux monster 6.1.0-kali7-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.20-1kali1 (2023-03-22) x86_64 GNU/Linux

averissimo commented 1 year ago

The function was deprecated on kernel 6.1.0

Change line 2609 on os_dep/osdep_service.c to match the code below (adds a if clause and moves current if to and else-if)

#ifdef PLATFORM_LINUX
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
    return get_random_u32();
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0))
    return prandom_u32();