Nsight Eclipse cross-compile error for "oceanFFT" example (Missing -lGL -lGLU -glut)

Setup:
-Nsight Eclipse 10.2
-Fresh install of Ubuntu 18.04.5 LTS
-Used SDK Manager to setup environment and download tools
-Jetson Nano is my only target

Note: No Nvidia graphics cards drivers have ever been installed using Ubuntu package managers (using basic nouveau driver).

It looks like I have a problem finding OpenGL libraries during cross-compile for AArch64 target (Jetson Nano). Below is the output:

make all
Building file: …/src/oceanFFT.cpp
Invoking: NVCC Compiler
/usr/local/cuda-10.2/bin/nvcc -I"/usr/local/cuda-10.2/samples/5_Simulations" -I"/usr/local/cuda-10.2/samples/common/inc" -I"/home/cameron/cuda-workspace/demo2" -G -g -O0 -ccbin aarch64-linux-gnu-g++ -gencode arch=compute_53,code=sm_53 -m64 -odir “src” -M -o “src/oceanFFT.d” “…/src/oceanFFT.cpp”
/usr/local/cuda-10.2/bin/nvcc -I"/usr/local/cuda-10.2/samples/5_Simulations" -I"/usr/local/cuda-10.2/samples/common/inc" -I"/home/cameron/cuda-workspace/demo2" -G -g -O0 --compile -m64 -ccbin aarch64-linux-gnu-g++ -x c++ -o “src/oceanFFT.o” “…/src/oceanFFT.cpp”
Finished building: …/src/oceanFFT.cpp

Building file: …/src/oceanFFT_kernel.cu
Invoking: NVCC Compiler
/usr/local/cuda-10.2/bin/nvcc -I"/usr/local/cuda-10.2/samples/5_Simulations" -I"/usr/local/cuda-10.2/samples/common/inc" -I"/home/cameron/cuda-workspace/demo2" -G -g -O0 -ccbin aarch64-linux-gnu-g++ -gencode arch=compute_53,code=sm_53 -m64 -odir “src” -M -o “src/oceanFFT_kernel.d” “…/src/oceanFFT_kernel.cu”
/usr/local/cuda-10.2/bin/nvcc -I"/usr/local/cuda-10.2/samples/5_Simulations" -I"/usr/local/cuda-10.2/samples/common/inc" -I"/home/cameron/cuda-workspace/demo2" -G -g -O0 --compile --relocatable-device-code=false -gencode arch=compute_53,code=compute_53 -gencode arch=compute_53,code=sm_53 -m64 -ccbin aarch64-linux-gnu-g++ -x cu -o “src/oceanFFT_kernel.o” “…/src/oceanFFT_kernel.cu”
Finished building: …/src/oceanFFT_kernel.cu

Building target: demo2
Invoking: NVCC Linker
/usr/local/cuda-10.2/bin/nvcc --cudart static -L"/usr/local/cuda-10.2/samples/common/lib/linux/x86_64" -lGL -lGLU -lglut --relocatable-device-code=false -gencode arch=compute_53,code=compute_53 -gencode arch=compute_53,code=sm_53 -m64 -ccbin aarch64-linux-gnu-g++ -link -o “demo2” ./src/oceanFFT.o ./src/oceanFFT_kernel.o /usr/local/cuda-10.2/samples/common/lib/linux/x86_64/libGLEW.a -lcufft
/usr/lib/gcc-cross/aarch64-linux-gnu/7/…/…/…/…/aarch64-linux-gnu/bin/ld: cannot find -lGL
/usr/lib/gcc-cross/aarch64-linux-gnu/7/…/…/…/…/aarch64-linux-gnu/bin/ld: cannot find -lGLU
/usr/lib/gcc-cross/aarch64-linux-gnu/7/…/…/…/…/aarch64-linux-gnu/bin/ld: cannot find -lglut
collect2: error: ld returned 1 exit status
makefile:59: recipe for target ‘demo2’ failed
make: *** [demo2] Error 1

I do have “Link with OpenGL Libraries” selected for the Build–>Settings–>Tool Settings–>Project Properties–>NVCC Linker–>Misc config (“Other Objects” is showing ${cuda_samples_common_lib_dir:/demo2}/libGLEW.a).

I didn’t mess around with the project settings, just basically set up the example and built it. Note I did add the mesa-utils package after running into this issue, but I did that for another reason. Not really sure why it can’t find the libraries…any insight would be appreciated!

FYI: I did cross-compile & remotely run/debug a simple CUDA sample (vectorAdd) on the nano with no issues…I believe the toolchain is generally working as intended.

I solved this issue - I did not fully complete the setup for the Nsight Eclipse environment, per the guidance provided in this NVIDIA Dev Blog:

https://developer.nvidia.com/blog/cuda-jetson-nvidia-nsight-eclipse-edition/

Specifically, I did not copy the libglut, libGL, libGLU, libX11 ARM libraries to my cross-compile PC. I will note, however that I did not find the libGL.so.1 library in the “/usr/lib/aarch64-linux-gnu/tegra/” folder, it was actually in “/usr/lib/aarch64-linux-gnu/” like all of the other files needed. Once I had copied those files over ( and confirmed my settings were correct per the blog’s notes!) I was able to build successfully. Likely a trivial matter for most, but nonetheless it was overlooked. Hopefully this post will save someone a headache!

FYI: I did not mention in the original post, I am using Jetpack 4.4.1

1 Like