Build "nvgstiva_app" from Deepstream SDK on Jetson in Nsight

I am trying to run the “nvgstiva_app” example from “Deepstream SDK on Jetson” in Nsight. And I am using “cross-compiler mode” in the Host x86 PC by following the tutorial as below:

https://devblogs.nvidia.com/parallelforall/cuda-jetson-nvidia-nsight-eclipse-edition/
https://devtalk.nvidia.com/default/topic/1010551/using-nsight-eclipse-edition-with-opencv-for-cross-compilation-/

And I am successfully to run the CUDA example in Jetson TX2. But when I try to run other example “nvgstiva_app” from Deepstream SDK on Jetson in Nsight. I get the error in the final NVCC Link step:

Building target: DeepStream
Invoking: NVCC Linker
/usr/local/cuda-8.0/bin/nvcc --cudart static -L/usr/lib/aarch64-linux-gnu/tegra -L/usr/lib/aarch64-linux-gnu/gstreamer-1.0 -L/usr/lib/aarch64-linux-gnu -lGL -lGLU -lglut --relocatable-device-code=false -gencode arch=compute_60,code=compute_60 -gencode arch=compute_60,code=sm_60 -m64 -ccbin aarch64-linux-gnu-g++ -gencode arch=compute_62,code=sm_62 -link -o “DeepStream” ./nvgstiva_app_main.o ./src/nvgstiva_app.o ./src/nvgstiva_color_detector_bin.o ./src/nvgstiva_common.o ./src/nvgstiva_config_file_parser.o ./src/nvgstiva_dsexample.o ./src/nvgstiva_face_detector_bin.o ./src/nvgstiva_metadata_pool.o ./src/nvgstiva_osd_bin.o ./src/nvgstiva_perf.o ./src/nvgstiva_primary_gie_bin.o ./src/nvgstiva_secondary_gie_bin.o ./src/nvgstiva_sink_bin.o ./src/nvgstiva_source_bin.o ./src/nvgstiva_split_bin.o ./src/nvgstiva_tracker_bin.o -lgstnvivameta -lnvid_mapper
collect2: fatal error: ld terminated with signal 11 [Segmentation fault], core dumped
compilation terminated.
makefile:59: recipe for target ‘DeepStream’ failed
make: *** [DeepStream] Error 1

And the same error happened when I try to run the example from visionworks, I guess the key problem is how to link remote library in Jetson TX2 in Nsight. What I do is copy the whole /usr/lib/aarch64-linux-gnu to the x86 host PC. Then I set like this:

Tool Settings->NVCC Linker->Library search path(-L)
/usr/lib/aarch64-linux-gnu/tegra
/usr/lib/aarch64-linux-gnu/gstreamer-1.0
/usr/lib/aarch64-linux-gnu

But I get the linker error: collect2: fatal error: ld terminated with signal 11 [Segmentation fault], core dumped

And what is painful for all example in Jetson is based on makefile on Jetson directly rather than Nsight. So I find that is very difficult to transfer them to Nsight. Can anyone give me some suggestion about that? Thank you very much!

Not sure at all, but such a ld fault might be caused by out of memory (try adding swap) or disk full (check with df -H -T). You may also look to dmesg or syslog for further info.

Hi,

Another alternative is to build the project directly on the device through Nsight interface. (If cross-compiler is not essential.)

Target Systems -> Select remote connection -> Manage -> …

With this setting, Nsight will automatically sync your project to the device and build it right on the device.
It’s recommended to use this mode if lots of required libraries.

Thanks.

Hi AastaLLL:
Thank you for your advice!
Actually I have try to use sync mode to build on device directly. But even in this way, I should includes libraries in Nsight. Otherwise, there will be error for the project. The only way to solve that is using makefile on the device. If I check Generate Makefiles Automatically in Nsight, you should need a CUDA NVCC Compiler, and includes libraries manually. My question is if I use makefile on device which is provided by NVIDIA examples, can I debug CUDA in Nsight in X86 PC. What is the elegant way to use CUDA Compiler to debug in the sync mode? I find it is very difficult to transfer NVIDIA SDK examples to Nsight, except of CUDA examples. And what I am curious about is that How the Deepstream examples on Jetson is make by NVIDIA engineer. How to debug it? Without Nsight? Thanks!

Hi AastaLLL:
I was using Sync Mode as you said with the example’s makefile by unchecking generate makefiles automatically, now it could compile and execute in Jetson TX2. But anther problem comes out, the CUDA gdb could not stay in any breakpoint when I am trying to remotely debug on the device. I guess if the problem comes from the compile configuration in the makefile. Since if I am using cross compiler, there is no problem for CUDA gdb debug. But in the Sync Mode, I could only use makefile to compile that. Any idea on that?Thanks!

Makefile:
################################################################################

APP:= nvgstiva-app

SRCS:= (wildcard *.c) SRCS+= (wildcard src/*.c)

INCS:= $(wildcard *.h)

PKGS:= gstreamer-1.0

OBJS:= $(SRCS:.c=.o)

CFLAGS:= -DOS_L4T -Iincludes

LIBS:= -lgstnvivameta -lnvid_mapper

CFLAGS+= pkg-config --cflags $(PKGS)

LIBS+= pkg-config --libs $(PKGS)

all: $(APP)

.o: .c (INCS) Makefile (CC) -c @ (CFLAGS) $<

(APP): (OBJS) Makefile
(CC) -o (APP) (OBJS) (LIBS)

clean:
rm -rf (OBJS) (APP)

Hi,

We are checking this issue internally.
Will update some information with you later.

Thanks.

Hi,

Here is some information for you.

1. There are some issues with the GIT configuration on your target system.
Please try following command to configure git:

git config –global user.name <your_name>
git config –global user.email <your_email>

Check this page to setup a synchronized project with Nsight EE.
https://devblogs.nvidia.com/remote-application-development-nvidia-nsight-eclipse-edition/

2. Check the permission of the ~/.gnupg/ folder.
Please change the permission of the directory with following:

chmod 600 ~/.gnupg/* (or)
chmod 700 ~/.gnupg

Thanks.