Run a project from Nsight Host

Hi,
I want to launch project on my Jetson TX2 from Nsight on Host, but I have a problem:

Last login: Tue Nov 21 14:58:11 2017 from 172.22.61.188
    echo $PWD'>'
    /bin/sh -c "cd \"/home/nvidia/host_pc_camera/Debug\";export LD_LIBRARY_PATH=\"/usr/local/cuda-8.0/lib64\":\${LD_LIBRARY_PATH};\"/home/nvidia/host_pc_camera/Debug/host_pc_camera\"";exit
    nvidia@tegra-ubuntu:~$ echo $PWD'>'
    /home/nvidia>
    nvidia@tegra-ubuntu:~$ /bin/sh -c "cd \"/home/nvidia/host_pc_camera/Debug\";export LD_LIBRARY_PATH=\"/usr/local/cuda-8.0/lib64\":\${LD_LIBRARY_PATH};\"/home/nvidia/host_pc_camera/Debug/host_pc_camera\"";exit

    (host_pc_camera:21674): Gtk-WARNING **: cannot open display:
    ****** tcambin serial=19710151 ! video/x-raw,format=BGRx,width=640,height=480,framerate=30/1 ! videoconvert ! video/x-raw, format=BGR !appsinklogout

I added it:

setenv(“DISPLAY”, “:0”, 0);

But I have an error:

../camera.cpp:60:11: error: ‘int setenv’ redeclared as different kind of symbol
 int setenv("DISPLAY", ":0", 0);
           ^
In file included from ../camera.cpp:4:0:
/usr/include/stdlib.h:584:12: note: previous declaration ‘int setenv(const char*, const char*, int)’
 extern int setenv (const char *__name, const char *__value, int __replace)
            ^
subdir.mk:18: recipe for target 'camera.o' failed
make: Leaving directory '/home/nvidia/host_pc_camera/Debug'
make: *** [camera.o] Error 1
> Shell Completed (exit code = 2)

Hi,vvvarvolik

You can erase " int setenv(“DISPLAY”, “:0”, 0);" in your code firstly to make the build pass.

Then you can configure the DISPLAY env in Run->Run Configurations->Environment.

If “DISPLAY=:0 ./sample” can work directly on target side command line, I think remote run should be OK.

I have an error:

(host_pc_camera:3312): Gtk-WARNING **: cannot open display: 0
****** tcambin serial=19710151 ! video/x-raw,format=BGRx,width=640,height=480,framerate=80/1 ! videoconvert ! video/x-raw, format=BGR !appsinklogout

Hi, vvvarvolik

You should check in target side firstly.

Is the X started ? Which user does the X belong to ?

ps -ef|grep X to check

What is X?
Can you explain step by step?

You want to start UI on target side, right ?

That need Xserver launched.

  1. ps -ef|grep X to check if you get info like below

nvidia@jetson-tx1:~$ ps -ef|grep X
root 798 740 5 Nov21 tty7 02:43:20 /usr/lib/xorg/Xorg -core :0 -seat seat0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch

  1. If not, you need start X by using “sudo service lightdm start” or others

  2. Then please check below

root@jetson-tx1:~# ls -l .Xauthority
lrwxrwxrwx 1 root root 24 Nov 21 07:22 .Xauthority -> /home/nvidia/.Xauthority

In this case, you can either use root or nvidia user name to set target system in Nsight EE

Suggest you launch the application from command line firstly to make sure it can work

I have a project with two cameras, they are connected to Jetson TX2, I can start project from Jetson TX2 terminal but can not start with Nsight EE

Then please check the command line generated in Nsight and compare the command line you used in Jetson TX2 to find the difference.

There must be something wrong.

At Jetson, I just open the project and do it. / Simple