Error: command '/usr/bin/aarch64-linux-gnu-gcc' failed with exit code 1

I am following the instructions to install torchvision from here :PyTorch for Jetson

I can install Pytorch but after the cloning step when I use python3 install --user I am getting following error :

building 'torchvision._C' extension
aarch64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -I/usr/local/cuda-12.2/include -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWITH_CUDA -I/home/t-tech/Downloads/torchvision/torchvision/csrc -I/home/t-tech/.local/lib/python3.10/site-packages/torch/include -I/home/t-tech/.local/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/t-tech/.local/lib/python3.10/site-packages/torch/include/TH -I/home/t-tech/.local/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda-12.2/include -I/usr/include/python3.10 -c /home/t-tech/Downloads/torchvision/torchvision/csrc/ops/autocast/deform_conv2d_kernel.cpp -o build/temp.linux-aarch64-3.10/home/t-tech/Downloads/torchvision/torchvision/csrc/ops/autocast/deform_conv2d_kernel.o -g0 -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="_gcc" -DPYBIND11_STDLIB="_libstdcpp" -DPYBIND11_BUILD_ABI="_cxxabi1016" -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=1 -std=c++17
/usr/lib/gcc/aarch64-linux-gnu/11/cc1plus: symbol lookup error: /usr/lib/gcc/aarch64-linux-gnu/11/cc1plus: undefined symbol: _ZNSt16invalid_argumentD1Ev
error: command '/usr/bin/aarch64-linux-gnu-gcc' failed with exit code 1

I have following

Jetpack :
Package: nvidia-jetpack
Version: 6.0-b52

Cuda :
CUDA Version: 12.2

TensorRT version: 8.6.2

PyTorch : 2.1.0

Please help me to resolve the issue. Thanks.

I’m not a python guy, but generally speaking, your C cross compiler is complaining about an undefined symbol. That, in turn, says there is a library you have to link against, but the library is missing.

The “mangled” symbol is “_ZNSt16invalid_argumentD1Ev”. If you pipe that via echo through “c++filt”, then the unmangled function/method which is missing is:

Seeing this is in the standard namespace, it is part of the C++ installation. Here is a reference to that code:

So this requires, in C++:

#include <stdexcept>

The particular method is a destructor. Depending on your Linux release, the declaration would be in “/usr/include/c++/...version.../stdexcept”. That’s actually for the local system, and not the cross tool install, but the destructor would be the same, and it shows as virtual. Thus your code must define the destructor to use it:

    virtual ~invalid_argument() _GLIBCXX_NOTHROW;

If you have a library which actually implements this, then it would be from a cross install to an aarch64 version of the C++ standard library. Otherwise, the library might be there (and probably is), but the code has to define the destructor. Code behavior might depend on the release used, so this might work as is in some releases, but fail in others. I couldn’t tell you what the cause is for this case (the choice is that the release version is causing this to be an error, or that the cross library for C++ has something missing).

@sarodeanil35 can you show the output of nvcc --version?
I also had problems with torchvision installation. Maybe my topic will be useful for you

t-tech@ubuntu:~$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Tue_Aug_15_22:08:11_PDT_2023
Cuda compilation tools, release 12.2, V12.2.140
Build cuda_12.2.r12.2/compiler.33191640_0

Dusty from nvidia suggested me use containers. Maybe you try it ?

@developer.makarov @sarodeanil35 I also have a prototype pip server that caches the wheels built by jetson-containers now, you can find info about it here:

You can download my jp6/cu122 torchvision wheel here: jp6/cu122/: torchvision-0.17.2+c1d70fe metadata and description

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.