nvcc: cannot execute binary file: Exec format error

I believe my error comes from not organize paths correctly. I need help on fixing so that nvcc works correctly. SEE BELOW FOR DETAILS, THANK YOU.

When I run nvcc --version, this output:
bash: /usr/local/cuda-9.0/bin/nvcc: cannot execute binary file: Exec format error

MY BASHRC LOOK LIKE THIS:
export PATH=/usr/local/cuda-9.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/usr/local/cuda/bin${LD_LIBRARY_PATH:+:{LD_LIBRARY_PATH}} export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64\${LD_LIBRARY_PATH:+:{LD_LIBRARY_PATH}}
export CUDA_HOME=/usr/local/cuda-9.0
source /opt/ros/kinetic/setup.bash
export ROS_MASTER_URI=http://localhost:11311
export ROS_IP=192.168.1.47
export LD_LIBRARY_PATH=/usr/local/lib:/opt/ros/kinetic/lib:/opt/ros/kinetic/lib/aarch64-linux-gnu:/usr/local/cuda-9.0/lib64:
export LD_LIBRARY_PATH=/usr/local/lib:/opt/ros/kinetic/lib:/opt/ros/kinetic/lib/aarch64-linux-gnu:/usr/local/lib:/usr/local/cuda-9.0/lib64

You may have the installation for the wrong architecture. What platform does this run on (e.g., on a TX1 or on a host)? What do you get from:

file /usr/local/cuda-9.0/bin/nvcc

Hello thanks for your response
I am having this issue in the TX1
I install in the beginning CUDA though Jetpack 3.2

After run file /usr/local/cuda-9.0/bin/nvcc output:

/usr/local/cuda-9.0/bin/nvcc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.4.0, stripped

You somehow got the desktop PC architecture version on your Jetson (Jetson is aarch64/arm64/ARMv8-a, while the desktop is the x86_64). Normally JetPack would not do this…was there anything custom about how you installed this?

Yes after a couple tries I follow the uninstallation of the CUDA toolkit from:
https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#runfile-uninstallation

Using this command":
sudo /usr/local/cuda-9.0/bin/uninstall_cuda_toolkit_9.0.pl

and then I tried to install again the CUDA toolkit from this instruction set just the toolkit not the drivers:
https://gist.github.com/zhanwenchen/e520767a409325d9961072f666815bb8

Do you think is any way that I can fix this without flashing again the whole system ?

Thanks again for your response

The instructions for desktop install don’t apply to the Jetson (the desktop is not only a different architecture, it is also set up for a PCIe GPU…the Jetson GPU is integrated with the memory controller and thus much of the PC software can’t be used with the Jetson). Whatever was installed with the run file needs to be removed, and then use JetPack for the install of the extra packages. If there is a problem with JetPack, then we can work on that, but PC packages won’t work.

NOTE: I think there is an error with JetPack3.2 and JetPack3.2.1 has superceded 3.2, so you may have run into a 3.2 issue (if you really mean 3.2.1, then this should work).

So the most available solution is reflash the whole system using Jetpack 3.2 ?

JetPack can have flash unchecked and just add packages. You don’t have to reflash most of the time.

JetPack version used for package addition should be from the same one which flashed the Jetson, but I suspect that since 3.2.1 is just a patch fix release, then perhaps a 3.2 install can get packages added via JetPack3.2.1…not sure, I have not tried yet.

Reflashing via JetPack3.2.1 would guarantee all packages of JetPack3.2.1 would work on your Jetson. You can clone your current install to keep a copy available for loopback mount on your host PC if you have something you want to save. It is usually problematic though to restore a newer L4T release with an older rootfs clone, but that doesn’t mean the clone isn’t useful. If interested in cloning see:
https://devtalk.nvidia.com/default/topic/1000105/jetson-tx2/tx2-cloning/

Thanks you are right that you can select what packages can be flash on the Jetson I will try this I let you know what happen. I dont know really well about the clone my current installation but I will back any important program or folder to be save