Running HelloWorld sample using CMake in my own directory

Hardware Platform: DriveWorks AGX Xavier
Software Version: Drive Software 2.2
Host Machine Version: Ubuntu 18.04.4 LTS (Bionic Beaver)
SDK Manager Version:

Note: I am running everything I mentioned below in Linux 18.4 Host machine.

I am trying to run HelloWorld sample in my own directory residing in /Home/Document/HelloWorld
I am using this page: NVIDIA/DRIVE_SW_10/DRIVE_Software/DRIVE_AV_doxy_files/dwx_hello_world.html to do this.

When I compile my HelloWorld sample application using gcc -I/usr/local/driveworks/include/ -I/usr/local/cuda/include helloworld.cpp -ldriveworks -L/usr/local/driveworks/lib/ -lstdc++ -o helloworld it compiles and runs using ./helloworld

After that, I followed to compile my HelloWorld Application and it fails with this error:

CMakeFiles/hello_world.dir/hello_world/main.cpp.o: In function `main':
/home/aceinna/Documents/HelloWorld/src/hello_world/main.cpp:25: undefined reference to `dwGetVersion'
/home/aceinna/Documents/HelloWorld/src/hello_world/main.cpp:26: undefined reference to `dwInitialize'
/home/aceinna/Documents/HelloWorld/src/hello_world/main.cpp:30: undefined reference to `dwContext_getGPUCount'
/home/aceinna/Documents/HelloWorld/src/hello_world/main.cpp:33: undefined reference to `dwRelease'
CMakeFiles/hello_world.dir/hello_world/main.cpp.o:(.debug_addr+0x28): undefined reference to `dwContext_getGPUCount'
CMakeFiles/hello_world.dir/hello_world/main.cpp.o:(.debug_addr+0x88): undefined reference to `dwRelease'
CMakeFiles/hello_world.dir/hello_world/main.cpp.o:(.debug_addr+0xe8): undefined reference to `dwGetVersion'
CMakeFiles/hello_world.dir/hello_world/main.cpp.o:(.debug_addr+0x110): undefined reference to `dwInitialize'
collect2: error: ld returned 1 exit status
src/CMakeFiles/hello_world.dir/build.make:94: recipe for target 'src/hello_world' failed
make[2]: *** [src/hello_world] Error 1
CMakeFiles/Makefile2:346: recipe for target 'src/CMakeFiles/hello_world.dir/all' failed
make[1]: *** [src/CMakeFiles/hello_world.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

I understand that I need to include driveworks/include, cuds/include and link driveworks/lib. I just don’t know where in my CMakeLists.text and how.

My goal is to eventually compile sample/src/sensors/plugins/canbus here in my folder so that I don’t have to modify canbus plugin in driveworks folder, keeping the original intact.

I am looking for pointers.

Thanks in advance.

Dear @rborad,
You can create a copy of canbus sample and include it as a new sample to DW. You need to update the cmakefile to add your new sample in the sample list. That should work out of the box.

1 Like