make command fails when installing a TP-Link Driver

Hello,

I am trying to install a TP-Link driver, and following the instructions provided I run a “make clean” command followed by a “make”, however this is where it fails, giving the following error:

make ARCH=aarch64 CROSS_COMPILE= -C /lib/modules/4.4.38-tegra/build M=/home/nvidia/Downloads/TL-WN8200ND 2.0_LinuxDriverSetup/rtl8192EU_linux_v4.4.1.1_18873.20160805_BTCOEX20160412-0042-OK  modules
make[1]: Entering directory '/usr/src/linux-headers-4.4.38-tegra'
Makefile:617: arch/aarch64/Makefile: No such file or directory
make[1]: *** No rule to make target 'arch/aarch64/Makefile'.  Stop.
make[1]: Leaving directory '/usr/src/linux-headers-4.4.38-tegra'
Makefile:1686: recipe for target 'modules' failed
make: *** [modules] Error 2

does anyone know how to fix this or why this is happening?

Sometimes 64-bit ARM is called “aarch64”, and at other times “arm64”. In this case use “ARCH=arm64”.

Thank you for your fast reply. How can I change this? Does this goes on the Makefike? Because I was searching and I couldn’t find that it said “aarch64”, or “arch64” anywhere.

It depends on what produced this line from your log:

make ARCH=aarch64 CROSS_COMPILE= -C /lib/modules/4.4.38-tegra/build M=/home/nvidia/Downloads/TL-WN8200ND 2.0_LinuxDriverSetup/rtl8192EU_linux_v4.4.1.1_18873.20160805_BTCOEX20160412-0042-OK  modules

I am assuming you typed in the command line “make ARCH=aarch64…”. Just change “aarch64” for “arm64”. If it was a script or part of a file, then you’d have to edit that. In some cases this can be left out entirely if you have performed “export ARCH=arm64” (kernel build should pick up the environment variable, but manually naming this might be better if you are not sure).

I also see you have "CROSS_COMPILE= ", and there is nothing named after “=”. Assuming you are cross compiling, then you need to name the path prefix for your cross compiler tool (if you compile natively on a Jetson you don’t need to name ARCH or CROSS_COMPILE).

Finally managed to make the “make” work by performing “export ARCH=arm64”. Thank you so much!

Hi,

I’m fairly new to Linux and i’m having the same problem regarding “arch/aarch64/makefile no such file or directory” when trying to install my USB wifi adapter’s drivers on my nano. (Trying to install an Oxaoxe model XHT-6B06 btw)

In my case i’m just running an “install.sh” file that should do the job, but it’s not working for me. How did you perform the “export ARCH=arm64”? was it by editing the Makefile?

Thank you and apologies if that’s an ovbious question.

This should probably be in the Nano forum, but the particular question would be the same for a TX2 (other than perhaps a different kernel).

The “ARCH” names the architecture being built. “arm64” is 64-bit ARMv8-a, which is valid for both Nano and TX2. However, this is not the tool…when a cross compile occurs you must tell it what architecture to output for, and in this case it knows arm64. Then you must tell it which tool to use to produce that since it isn’t a native tool. This is where the original failure appears, and perhaps is for you too:

CROSS_COMPILE=

…doesn’t have anything after the “=”, and so it is empty. This would be a prefix path to the cross tool chain. Example: “CROSS_COMPILE=/usr/lib64/ccache/aarch64-linux-gnu-” (which happens to be on a Fedora host…Ubuntu would probably be a bit different).

When compiling on command line there are certain arguments a kernel compile will look for in the environment. If you explicitly give those arguments in the compile line, then that takes precedence. If neither the command line nor environment has those, then the compiler considers that no such option was requested. A kernel build with “ARCH=arm64” is the same as if prior to the command you had instead set an environment variable via “export ARCH=arm64” (the “export” says to “remember” this). The same is true of the location of cross compile tools…you could name a prefix to tools via “CROSS_COMPILE=/some/where”, or instead by using “export CROSS_COMPILE=/some/where” prior to the command.

Most kernel builds will pick up on the “export” even if the build is from a third party script, but not all. It just depends.

Incidentally, you can skip all of the cross tools and cross compile and build natively on a Jetson. The TX2 makes this easy, and probably the Nano as well, but the Nano will have less RAM and run slower (cross compile would definitely be faster, but also more complicated). As soon as you build on the native architecture life is much simplified.

FYI, I suggest sticking to a single thread in the forum. Too many threads makes it hard to answer. In the case of cross compile though it tends to be common ground on several Jetsons, and more specifically becomes a question of the host PC setup (it isn’t completely wrong to ask here).

Thank you for such a complete answer! really appreciate it, definitely learnt quite a few things from linux architecture from it. And next time I’ll make sure I’m on the right thread, sorry about that.

The wifi adapter’s manufacturer finally resopnded and told me that the provided drivers weren’t compatible with the Nano’s ubuntu version, so I just got the latest working Realtek driver (apparently the wifi adapter is using a realtek chipset) and just run the Makefile from it. Now it’s all finally fine and working!

Another solution that works for my EDUP Wifi Adapter ac600Mbps Wireless Usb Adapter 5.8GHz/2.4GHz Dual Band 600Mbps Usb Adapter 2dBi External Antennas (https://www.amazon.com/gp/product/B01CCMUN8C/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1)

Please check the driver
https://devtalk.nvidia.com/default/topic/1051503/jetson-nano/make-usb-wifi-dongle-rtl8812au-works-on-nano/

Hi, I am also new on Linux too.
I have the same situation like below:

make ARCH=aarch64 CROSS_COMPILE= -…
make[1]: Entering directory ‘/usr/src/linux-headers-4.4.38-tegra’
Makefile:617: arch/aarch64/Makefile: No such file or directory
make[1]: *** No rule to make target ‘arch/aarch64/Makefile’. Stop.

make: *** [modules] Error 2

I follow the suggestion to type command:

  1. export ARCH=arm64
  2. make
    then many .o was created, but there is an error and stop as below message(This driver can be installed on my Virtual Machine with same version uBuntu18):

CC [M] /home/harris/USB-dongle-driver/rtl8188C_8192C_usb_linux_v4.0.9_20171222/core/rtw_p2p.o
CC [M] /home/harris/USB-dongle-driver/rtl8188C_8192C_usb_linux_v4.0.9_20171222/core/rtw_tdls.o
CC [M] /home/harris/USB-dongle-driver/rtl8188C_8192C_usb_linux_v4.0.9_20171222/core/rtw_br_ext.o
/home/harris/USB-dongle-driver/rtl8188C_8192C_usb_linux_v4.0.9_20171222/core/rtw_br_ext.c: In function ‘nat25_db_handle’:
/home/harris/USB-dongle-driver/rtl8188C_8192C_usb_linux_v4.0.9_20171222/core/rtw_br_ext.c:1449:28: error: implicit declaration of function ‘csum_ipv6_magic’; did you mean ‘csum_tcpudp_magic’? [-Werror=implicit-function-declaration]
hdr->icmp6_cksum = csum_ipv6_magic(&iph->saddr, &iph->daddr,
^~~~~~~~~~~~~~~
csum_tcpudp_magic
cc1: some warnings being treated as errors
scripts/Makefile.build:335: recipe for target ‘/home/harris/USB-dongle-driver/rtl8188C_8192C_usb_linux_v4.0.9_20171222/core/rtw_br_ext.o’ failed

================I also tested another ASUS adapter that has the similar message too ========
from https://github.com/bijju/Asus_USB-AC53_rtl8822bu
I tested it on VM too, it works fine.

CC [M] /home/harris/Asus_USB-AC53_rtl8822bu/os_dep/linux/recv_linux.o
CC [M] /home/harris/Asus_USB-AC53_rtl8822bu/os_dep/linux/ioctl_cfg80211.o
/home/harris/Asus_USB-AC53_rtl8822bu/os_dep/linux/ioctl_cfg80211.c:6884:25: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
.change_virtual_intf = cfg80211_rtw_change_iface,
^~~~~~~~~~~~~~~~~~~~~~~~~
/home/harris/Asus_USB-AC53_rtl8822bu/os_dep/linux/ioctl_cfg80211.c:6884:25: note: (near initialization for ‘rtw_cfg80211_ops.change_virtual_intf’)
/home/harris/Asus_USB-AC53_rtl8822bu/os_dep/linux/ioctl_cfg80211.c:6907:22: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
.add_virtual_intf = cfg80211_rtw_add_virtual_intf,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/harris/Asus_USB-AC53_rtl8822bu/os_dep/linux/ioctl_cfg80211.c:6907:22: note: (near initialization for ‘rtw_cfg80211_ops.add_virtual_intf’)
cc1: some warnings being treated as errors
scripts/Makefile.build:335: recipe for target ‘/home/harris/Asus_USB-AC53_rtl8822bu/os_dep/linux/ioctl_cfg80211.o’ failed
make[2]: *** [/home/harris/Asus_USB-AC53_rtl8822bu/os_dep/linux/ioctl_cfg80211.o] Error 1
Makefile:1629: recipe for target ‘module/home/harris/Asus_USB-AC53_rtl8822bu’ failed
make[1]: *** [module/home/harris/Asus_USB-AC53_rtl8822bu] Error 2
make[1]: Leaving directory ‘/usr/src/linux-headers-4.9.140-tegra-ubuntu18.04_aarch64/kernel-4.9’
Makefile:1801: recipe for target ‘modules’ failed
make: *** [modules] Error 2

=======
I am sorry put this message, but I saw some people has found the solution, I still had the error.

Are you compiling natively on the TX2? Or are you cross compiling? Are you compiling only a module from outside of the tree, or are you using full kernel source?

For the case of cross compiling, what was your actual “CROSS_COMPILE= -…” content? If you are actually cross compiling, then you need the prefix of the cross toolchain, not the suffix. For example, if you have some path like this (which is from Fedora):

/usr/lib64/ccache/aarch64-linux-gnu-gcc

…then the prefix used for CROSS_COMPILE is everything except the “gcc” part:

CROSS_COMPILE=/usr/lib64/ccache/aarch64-linux-gnu-

Also, despite aarch64 and arm64 being synonymous for many purposes, the kernel build demands the syntax “arm64” instead of “aarch64”. If you were to download packages where some say “arm64” and others say “aarch64”, then those are compatible and equivalent, but the kernel build syntax only recognizes arm64.

  1. I compile the driver on the Jetson Nano directly. (I can’t find drivers that support Nano, so I downloaded some drivers from github but fail).

  2. I didn’t set CROSS_COMPILE value, it is the default value on Jetson Nano.

or If you know which USB-WiFi that support Nano, I can by it directly.
Thanks for your kindly information.

Harris

On Nano there is no need for ARCH or CROSS_COMPILE. Leave those completely out. Example: “make -j6 Image; make -j6 modules”.

I do not have any WiFi advice. If you find one with an existing kernel module though, then that module will either still have to be compiled, or else be provided in arm64/aarch64 format. You won’t be able to copy a file from a host PC which wasn’t intended for ARM.

I have the same situation when I compile RTL8192CU driver. Then add “export ARCH=arm64” in Makefile. But this is where it fails, giving the following error:

fatal error: linux/smp_lock.h: No such file or directory
 #include <linux/smp_lock.h>
          ^~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
compilation terminated.
scripts/Makefile.build:335: recipe for target '/home/jetsonnano2/Downloads/RTL8192CU_8188CUS_8188CE-VAU_linux_v2.0.1212.20101208/driver/rtl8192CU_linux_v2.0.1212.20101208/core/rtw_cmd.o' failed
make[2]: *** [/home/jetsonnano2/Downloads/RTL8192CU_8188CUS_8188CE-VAU_linux_v2.0.1212.20101208/driver/rtl8192CU_linux_v2.0.1212.20101208/core/rtw_cmd.o] Error 1
Makefile:1629: recipe for target '_module_/home/jetsonnano2/Downloads/RTL8192CU_8188CUS_8188CE-VAU_linux_v2.0.1212.20101208/driver/rtl8192CU_linux_v2.0.1212.20101208' failed
make[1]: *** [_module_/home/jetsonnano2/Downloads/RTL8192CU_8188CUS_8188CE-VAU_linux_v2.0.1212.20101208/driver/rtl8192CU_linux_v2.0.1212.20101208] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.9.140-tegra-ubuntu18.04_aarch64/kernel-4.9'
Makefile:271: recipe for target 'modules' failed
make: *** [modules] Error 2
Compile make driver error: 2, Please check error Mesg

Knowing the command line, and the kernel config you started with, and where you obtained the kernel source would help. Am I correct that you are cross compiling?

linuxdev,

I have a tx2 r32.3.1 standard build, and am trying to compile rtl8821cu on the tx2 system. It maked perfectly on my x86 ubuntu 18.04. but failed looking for aarm64, then based on this topic I changed to make ARCH=arm64 and it is complaining about missing include files. Is the /usr/src directories correct on the system or is there some type of apt-get problems?

Linux BaseSystem_0_1 4.9.140-tegra #5 SMP PREEMPT Thu Aug 6 13:04:57 CDT 2020 aarch64 aarch64 aarch64 GNU/Linux

head /etc/nv_tegra_release

R32 (release), REVISION: 3.1, GCID: 18186506, BOARD: t186ref, EABI: aarch64, DATE: Tue Dec 10 07:03:07 UTC 2019

looks like some type of conflict between arm64 and aarch64. basic make for the rtl8821cu tried aarch64 and failed to find the aarch64 dir in the /usr/src dir, and then when you use ARCH=arm64 the make fails to find aarch64 include files.

found my problem, the Makefile was wrong, rtl88x2cu needed the drivers/Makefile changed to use arm64 instead of aarch64 and some other config changes and it builds and works on the tx2

1 Like