cross compile error of sample with Nsight 10.0

I got following for the sample boxfilter

make all
Building target: boxfilter-arm
Invoking: NVCC Linker
/usr/local/cuda-10.0/bin/nvcc --cudart static -L"/usr/local/cuda-10.0/samples/common/lib/linux/aarch64" -lGL -lGLU -lglut -Xlinker --unresolved-symbols=ignore-in-shared-libs --relocatable-device-code=false -gencode arch=compute_60,code=compute_60 -gencode arch=compute_60,code=sm_60 -m64 -ccbin aarch64-linux-gnu-g++ -link -o “boxfilter-arm” ./src/boxFilter.o ./src/boxFilter_cpu.o ./src/boxFilter_kernel.o /usr/local/cuda-10.0/samples/common/lib/linux/x86_64/libGLEW.a
/usr/lib/gcc-cross/aarch64-linux-gnu/7/…/…/…/…/aarch64-linux-gnu/bin/ld: ./src/boxFilter_kernel.o: Relocations in generic ELF (EM: 62)

makefile:59: recipe for target ‘boxfilter-arm’ failed
/usr/lib/gcc-cross/aarch64-linux-gnu/7/…/…/…/…/aarch64-linux-gnu/bin/ld: ./src/boxFilter_kernel.o: Relocations in generic ELF (EM: 62)

./src/boxFilter_kernel.o: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status
make: *** [boxfilter-arm] Error 1

I don’t know anything about your particular setup or using Nsight, but this error usually implies you are mixing two different architectures (which you can’t do):

error adding symbols: File in wrong format

An example would be if your cross compiler expects aarch64, but the linker itself does not support aarch64. Another example would be if you are in a linking stage (with the correct linker), but the library the linker is pointing at is for the host x86_64 instead of for the target aarch64. I have no way of knowing which part of the setup or compile is invalid, but in such a case I’d always start by a complete clean of all intermediate content and starting fresh. If that fails, then I’d look at whether all of the libraries being pointed at are really aarch64.

Do note that although sample code in general should never ship intermediate files, that sometimes it does happen. So it could even be something left over from steps you’ve never touched.

Furthermore for TX2 you’d use CUDA arch 6.2, so arch=compute_62,code=sm_62.

Thanks for your advise I cleaned the entire project rebuilt and it works