Driveworks-0.2.1 build sample but cannot run on PX2

Hi,

I successfully cross compiled the driveworks-0.2.1 samples on a Host PC, and copied the whole /usr/local/driveworks-0.2.1 folder to PX2’s /usr/local folder. But when I tried to run the sample_camera_gmsl with parameter --camera-type=ov10635 on PX2, the following error was encountered:

./sample_camera_gmsl: symbol lookup error: /usr/local/driveworks-0.2.1/lib/libdriveworks.so.0: undefined symbol: NvMediaBEPDestroy

Is there anyone know the reason of this error? Thank you for your attention!

Hello Wanghao,

I think you just should copy “bin folder” not whole folder.
One more thing, please copy your sample to the DPX2 and rename it to avoid overriding the already existing sample.
Could you please try it? Thanks.

Thank you! I upgraded the PX2 Tegra operating system to newest version, and this problem no longer exist.

In my case also the build was complete and I copied the files to the bin folder.
However, the programs are giving an error “cannot execute binary file: Exec format error”.

Hello Agneev,

Could you please see below steps and check it?

There is a document in /usr/local/driveworks-0.2.1/doc/index.html. You can open this file using any web browser.
Please go to the “DriveWorks Samples” section for the cross compilation setting.

Step1. Install CUDA package for cross compilation. (Just ignore warning message when sudo apt-get update.

sudo dpkg --add-architecture arm64
sudo apt-get update
sudo apt-get install cuda-cross-aarch64-8-0

Step2. Run the cmake with proper parameter setting.

#cd /usr/local/driveworks-0.2.1/
#mkdir build
#cd build
#cmake -DCMAKE_BUILD_TYPE=Release \

     -DCMAKE_TOOLCHAIN_FILE=/path/to/samples/cmake/Toolchain-V4L.cmake \
     -DVIBRANTE_PDK:STRING=/path/to/vibrante-t186ref-linux \
      /path/to/driveworks/samples/folder

In my case, commnad is like below.
#sudo cmake -DCMAKE_BUILD_TYPE=Release
-DVIBRANTE_PDK:STRING=/home/NV/WorkSpace/v4_1l_4_1_4_0/VibrantePDK/vibrante-t186ref-linux
-DCMAKE_TOOLCHAIN_FILE=/usr/local/driveworks-0.2.1/samples/cmake
/usr/local/driveworks-0.2.1/samples

note sudo is required due to the permission.

Step3. Run the make to build sampels
#sudo make -j6
#sudo make install

Then, new built sampels are located under " /usr/local/driveworks-0.2.1/samples/install/bin/"

step4. copy all samples to the target board (DrivePX2 = DPX2)

scp -r /usr/local/driveworks-0.2.1/samples/install/bin/* nvidia@DPX_IP:/home/nvidia/driveworks/bin
DPX_IP is IP address of DPX2. you can find it at the terminal of DPX2 with “ifconfig” command.

Thanks.

Really appreciate your reply.
However I have followed the exact same procedure and still getting the same error.
I noticed you missed the cmake file ‘Toolchain-V4L.cmake’ in your command.

Kindly note my bin folder is being generated inside /usr/local/driveworks-0.2.1/build/install/bin/ and not /usr/local/driveworks-0.2.1/samples/install/bin/.

I have also tried the below to remove my warnings for apt-get-update (it didn’t work):
@note Some repositories may not have binaries for arm64 and apt-get update causes errors.
To prevent these errors, edit /etc/apt/sources.list and files under /etc/apt/sources.list.d/ and add [arch=amd64,i386] into each line starting with deb.

I am using the below commands:
cmake -DCMAKE_BUILD_TYPE=Release
-DCMAKE_TOOLCHAIN_FILE= /usr/local/driveworks-0.2.1/samples/cmake
-DVIBRANTE_PDK:STRING=/home/scrop/DrivePX2_VM_Setup/VibrantePDK/vibrante-t186ref-linux
/usr/local/driveworks-0.2.1/samples/

scp -r /usr/local/driveworks-0.2.1/build/install/bin/* nvidia@XXX.XXX.X.XX:/home/nvidia/Scania/Bin_Built

and moving the files from Bin_Built to /usr/local/driveworks-0.2.1/bin with permissions and running the same.
In all cases, I am still getting the Exec format error.

Hi Agneev,

The symptoms you described look like you compiled against your host architecture (presumably amd64).
Can you please check if your executables can be run on your host computer?

Thanks,
Oliver

Hi Oliver,

It seems the issue persists. I have now reinstalled everything on a new host computer (x86-64).
And yes, the executables are running on the host.

Regards,
Agneev

Hi Agneev,

Please follow the cross-compilation steps from the DW documentation in /usr/local/driveworks-0.2.1/samples/README.md. If you were able to run the binaries on your host following the earlier steps, something went wrong with your cross-compilation settings.

Can you please do the following?

  1. Remove/rename your build folder in /usr/local/driveworks-0.2.1/samples/build if existing.
  2. Follow mania91's steps for cross-compilation, but use the command "cd /usr/local/driveworks-0.2.1/samples" instead of "cd /usr/local/driveworks-0.2.1" (as also specified in /usr/local/driveworks-0.2.1/samples/README.md)
  3. Try if it works.
  4. If not, attach the console output directly after running "cmake" to this thread.

Are you using native Linux or a virtual machine now (I saw your path /home/scrop/DrivePX2_VM_Setup/)?

Thanks,
Oliver

Hi Oliver,

Yes, now I’m on a native Linux and the path error occurred as the bash script was not run appropriately. The files have been built in the correct path now.

However, the error “cannot execute binary file: Exec format error” seems to be caused due to the missing link to the binaries. This follows based on the README file:

@note The default installation of DriveWorks on the DRIVE PX 2 target is
/usr/local/driveworks, hence, after copying the samples to the DRIVE PX 2 in
any non-default location, the binaries must be able to locate the
libdriveworks.so libraries and the ../data/ folder. In general, the proper
linking is achieved with the /etc/ld.so.conf.d/driveworks.conf file which sets
the correct linker search paths to search for the library. To access the
../data folder, do one of the following:

  • Copy the compiled samples into /usr/local/driveworks/bin or
  • Create appropriate symbolic link.

I have attached the cmake output for your reference.
Cmake_output.txt (28.2 KB)

Hi Agneev,

Thanks for the update and the attachment – in the latter, I can see that there is a space after the equation sign in:

-DCMAKE_TOOLCHAIN_FILE= /usr/local/driveworks-0.2.1/samples/cmake/Toolchain-V4L.cmake \

Remove that space.

If you set up the cmake parameters for cross compilation correctly, the output should look like shown here (look at the first 4 lines after the cmake command):

user@user:/usr/local/driveworks-0.2.1/samples$ mkdir build
user@user:/usr/local/driveworks-0.2.1/samples$ cd build
user@user:/usr/local/driveworks-0.2.1/samples/build$ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-V4L.cmake -DVIBRANTE_PDK:STRING=/path/to/pdk/vibrante-t186ref-linux ..
-- VIBRANTE_PDK = /path/to/pdk/vibrante-t186ref-linux
-- VIBRANTE_PDK_DEVICE = t186ref
-- VIBRANTE_PDK_BRANCH = 4.1.4.0
-- VIBRANTE_PDK = /path/to/pdk/vibrante-t186ref-linux
-- The C compiler identification is GNU 4.9.2
-- The CXX compiler identification is GNU 4.9.2
-- Check for working C compiler: /path/to/pdk/vibrante-t186ref-linux../toolchains/tegra-4.9-nv/usr/bin/aarch64-gnu-linux/aarch64-gnu-linux-gcc
-- Check for working C compiler: /path/to/pdk/vibrante-t186ref-linux../toolchains/tegra-4.9-nv/usr/bin/aarch64-gnu-linux/aarch64-gnu-linux-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /path/to/pdk/vibrante-t186ref-linux../toolchains/tegra-4.9-nv/usr/bin/aarch64-gnu-linux/aarch64-gnu-linux-g++
-- Check for working CXX compiler: /path/to/pdk/vibrante-t186ref-linux../toolchains/tegra-4.9-nv/usr/bin/aarch64-gnu-linux/aarch64-gnu-linux-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found CUDA: /usr/local/cuda (found version "8.0") 
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Cross Compiling for Vibrante
-- VIBRANTE_PDK_BRANCH = 4.1.4.0
-- Vibrante >= 4.1.1.0 - append nv_extimgdev library
-- Vibrante >= 4.1.1.0 - append nv_embstatsplugin library
-- Found vibrante lib: /usr/local/driveworks-0.2.1/samples/3rdparty/linux-aarch64/vibrante/lib/libXrandr.so
-- Found vibrante lib: /usr/local/driveworks-0.2.1/samples/3rdparty/linux-aarch64/vibrante/lib/libXinerama.so
-- Found vibrante lib: /usr/local/driveworks-0.2.1/samples/3rdparty/linux-aarch64/vibrante/lib/libXi.so
-- Found vibrante lib: /usr/local/driveworks-0.2.1/samples/3rdparty/linux-aarch64/vibrante/lib/libXcursor.so
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Found EGL: /path/to/pdk/vibrante-t186ref-linuxlib-target/libEGL.so  
-- Driveworks Samples install dir: /usr/local/driveworks-0.2.1/samples/build/install
-- Cross Compiling for Vibrante
-- Driveworks found at: /usr/local/driveworks-0.2.1/targets/aarch64-linux
-- Found Driveworks 
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/local/driveworks-0.2.1/samples/build

One tip, in order to be able to perform the cmake and make commands without sudo rights, type in the following command:

sudo chown -R $(whoami):$(whoami) /usr/local/driveworks-0.2.1/samples

Worked like a charm!
I had copied the cmake command from my previous try and space broke the toolchain link every time.

Thanks a lot Oliver.

Regards,
Agneev

Hi Agneev and nvok

I am facing the similar problem as you. I tried makingthe chnage with the extra space however, I still get the same error. Also as mentioned by nvok I cannot find the first 4 lines of the cmake output in my case.
I am attaching my cmake output for reference as well.

Could you guys help me rectify it ?

Thanks

vsi@vsi-thor:/usr/local/driveworks-0.3/samples/build$ sudo cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE= /usr/local/driveworks-0.3/samples/cmake/Toolchain-V4L.cmake -DVIBRANTE_PDK:STRING=/home/vsi/DrivePX/VibranteSDK/vibrante-t186ref-linux  /usr/local/driveworks-0.3/samples/
CMake Warning (dev) at build/CMakeFiles/3.2.3/CMakeSystem.cmake:6 (include):
  include() given empty file name (ignored).
Call Stack (most recent call first):
  CMakeLists.txt:17 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/cc
CMake Warning (dev) at /usr/local/driveworks-0.3/samples/build/CMakeFiles/3.2.3/CMakeSystem.cmake:6 (include):
  include() given empty file name (ignored).
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
CMake Warning (dev) at /usr/local/driveworks-0.3/samples/build/CMakeFiles/3.2.3/CMakeSystem.cmake:6 (include):
  include() given empty file name (ignored).
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Detecting C compiler ABI info - done
-- Detecting C compile features
CMake Warning (dev) at /usr/local/driveworks-0.3/samples/build/CMakeFiles/3.2.3/CMakeSystem.cmake:6 (include):
  include() given empty file name (ignored).
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /usr/local/driveworks-0.3/samples/build/CMakeFiles/3.2.3/CMakeSystem.cmake:6 (include):
  include() given empty file name (ignored).
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /usr/local/driveworks-0.3/samples/build/CMakeFiles/3.2.3/CMakeSystem.cmake:6 (include):
  include() given empty file name (ignored).
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
CMake Warning (dev) at /usr/local/driveworks-0.3/samples/build/CMakeFiles/3.2.3/CMakeSystem.cmake:6 (include):
  include() given empty file name (ignored).
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
CMake Warning (dev) at /usr/local/driveworks-0.3/samples/build/CMakeFiles/3.2.3/CMakeSystem.cmake:6 (include):
  include() given empty file name (ignored).
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
CMake Warning (dev) at /usr/local/driveworks-0.3/samples/build/CMakeFiles/3.2.3/CMakeSystem.cmake:6 (include):
  include() given empty file name (ignored).
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /usr/local/driveworks-0.3/samples/build/CMakeFiles/3.2.3/CMakeSystem.cmake:6 (include):
  include() given empty file name (ignored).
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /usr/local/driveworks-0.3/samples/build/CMakeFiles/3.2.3/CMakeSystem.cmake:6 (include):
  include() given empty file name (ignored).
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Detecting CXX compile features - done
-- Found CUDA: /usr/local/cuda (found version "8.0") 
-- Looking for include file pthread.h
CMake Warning (dev) at /usr/local/driveworks-0.3/samples/build/CMakeFiles/3.2.3/CMakeSystem.cmake:6 (include):
  include() given empty file name (ignored).
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Looking for include file pthread.h - found
-- Looking for pthread_create
CMake Warning (dev) at /usr/local/driveworks-0.3/samples/build/CMakeFiles/3.2.3/CMakeSystem.cmake:6 (include):
  include() given empty file name (ignored).
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
CMake Warning (dev) at /usr/local/driveworks-0.3/samples/build/CMakeFiles/3.2.3/CMakeSystem.cmake:6 (include):
  include() given empty file name (ignored).
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
CMake Warning (dev) at /usr/local/driveworks-0.3/samples/build/CMakeFiles/3.2.3/CMakeSystem.cmake:6 (include):
  include() given empty file name (ignored).
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
CMake Warning (dev) at /usr/local/driveworks-0.3/samples/build/CMakeFiles/3.2.3/CMakeSystem.cmake:6 (include):
  include() given empty file name (ignored).
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
CMake Warning (dev) at /usr/local/driveworks-0.3/samples/build/CMakeFiles/3.2.3/CMakeSystem.cmake:6 (include):
  include() given empty file name (ignored).
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Looking for gethostbyname - found
-- Looking for connect
CMake Warning (dev) at /usr/local/driveworks-0.3/samples/build/CMakeFiles/3.2.3/CMakeSystem.cmake:6 (include):
  include() given empty file name (ignored).
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Looking for connect - found
-- Looking for remove
CMake Warning (dev) at /usr/local/driveworks-0.3/samples/build/CMakeFiles/3.2.3/CMakeSystem.cmake:6 (include):
  include() given empty file name (ignored).
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Looking for remove - found
-- Looking for shmat
CMake Warning (dev) at /usr/local/driveworks-0.3/samples/build/CMakeFiles/3.2.3/CMakeSystem.cmake:6 (include):
  include() given empty file name (ignored).
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
CMake Warning (dev) at /usr/local/driveworks-0.3/samples/build/CMakeFiles/3.2.3/CMakeSystem.cmake:6 (include):
  include() given empty file name (ignored).
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib/x86_64-linux-gnu/libX11.so
-- Driveworks Samples install dir: /usr/local/driveworks-0.3/samples/build/install
-- Driveworks found at: /usr/local/driveworks-0.3/targets/x86_64-linux
-- Found Driveworks 
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/local/driveworks-0.3/samples/build
vsi@vsi-thor:/usr/local/driveworks-0.3/samples/build$

UPDATE : Issue resolved after upgrading to the latest version of the PDK

Where can I find mania91’s instructions for cross compilation mentioned by Oliver above?

Oliver is referring to SteveNV’s message above.
"Step2. Run the cmake with proper parameter setting.

#cd /usr/local/driveworks-0.2.1/samples"

Hi Agneev,

Thanks for the help, but I still get:

adrian@adrian-Dell-System-XPS-L702X:/usr/local/driveworks/samples/build$ sudo /usr/bin/cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=/usr/local/driveworks/samples/cmake/Toolchain-V4L.cmake -DVIBRANTE_PDK_FILE:STRING=~/nvidia/di418/i/VibranteSDK/vibrante-t186ref-linux/lib-target/version-nv-sdk.txt -DVIBRANTE_PDK:STRING=~/nvidia/di418/i/VibranteSDK/vibrante-t186ref-linux \ -DCMAKE_INSTALL_PREFIX=/usr/local/driveworks/bin/ /usr/local/driveworks/samples
– VIBRANTE_PDK = ~/nvidia/di418/i/VibranteSDK/vibrante-t186ref-linux
– VIBRANTE_PDK_DEVICE = t186ref
– VIBRANTE_PDK_FILE = ~/nvidia/di418/i/VibranteSDK/vibrante-t186ref-linux/lib-target/version-nv-sdk.txt
CMake Error at cmake/Toolchain-V4L.cmake:88 (file):
file failed to open for reading (No such file or directory):

~/nvidia/di418/i/VibranteSDK/vibrante-t186ref-linux/lib-target/version-nv-sdk.txt

Call Stack (most recent call first):
/usr/share/cmake-3.5/Modules/CMakeDetermineSystem.cmake:98 (include)
CMakeLists.txt:17 (project)

CMake Error at cmake/Toolchain-V4L.cmake:93 (message):
Can’t determine PDK branch for PDK
~/nvidia/di418/i/VibranteSDK/vibrante-t186ref-linux
Call Stack (most recent call first):
/usr/share/cmake-3.5/Modules/CMakeDetermineSystem.cmake:98 (include)
CMakeLists.txt:17 (project)

– Configuring incomplete, errors occurred!

Sorry amb2. I didn’t come across this. Seems like you posted another issue. Hope it gets resolved soon.

I am not able to find the VibranteSDK folder any idea how it is generated. I just ran the Driveinstall.sh and then looking for the cross compilation procedures and came across this procedure.