Compilation with VisionWorks and cmake

Hi,
I’m trying to compile a simple example of VisionWorks but using cmake.
My CMakeLists.txt file is the following:

cmake_minimum_required(VERSION 3.10)

set the project name and version
project(render)

find_package(OpenCV REQUIRED)
find_package(VisionWorks REQUIRED)
find_package(CUDA 10.2 REQUIRED)

set(WITH_CUDA ON)

include_directories(${OpenCV_INCLUDE_DIRS})
include_directories(${VisionWorks_INCLUDE_DIRS})

add_executable(main main_video_stabilizer.cpp)

target_include_directories(main PUBLIC
/usr/share/visionworks/sources/nvxio/include
${CUDA_INCLUDE_DIRS})

target_link_libraries(main
-L/usr/share/visionworks/sources/libs/aarch64/linux/release
-lnvx
-lovx
-lglfw
${VisionWorks_LIBRARIES}
${OpenCV_LIBS}
${CUDA_LIBRARIES}
/usr/share/visionworks/sources/3rdparty/freetype/libs/libfreetype.a
-lgstpbutils-1.0
-lgstaudio-1.0
-lgstvideo-1.0
-lgstapp-1.0
-lgstbase-1.0
-lgstreamer-1.0
-lgobject-2.0
-lglib-2.0
-lGL
-lGLESv2)

The result is a link problem:

/usr/share/visionworks/sources/libs/aarch64/linux/release/libovx.a(GStreamerEGLStreamSinkFrameSourceImpl.o): In function nvidiaio::GStreamerEGLStreamSinkFrameSourceImpl::InitializeEglCudaConsumer()': GStreamerEGLStreamSinkFrameSourceImpl.cpp:(.text+0x868): undefined reference to cuEGLStreamConsumerConnect’
/usr/share/visionworks/sources/libs/aarch64/linux/release/libovx.a(GStreamerEGLStreamSinkFrameSourceImpl.o): In function nvidiaio::GStreamerEGLStreamSinkFrameSourceImpl::FinalizeEglCudaConsumer()': GStreamerEGLStreamSinkFrameSourceImpl.cpp:(.text+0xd88): undefined reference to cuEGLStreamConsumerDisconnect’
/usr/share/visionworks/sources/libs/aarch64/linux/release/libovx.a(GStreamerEGLStreamSinkFrameSourceImpl.o): In function nvidiaio::GStreamerEGLStreamSinkFrameSourceImpl::FinalizeGstPipeLine()': GStreamerEGLStreamSinkFrameSourceImpl.cpp:(.text+0xf20): undefined reference to cuEGLStreamConsumerAcquireFrame’
GStreamerEGLStreamSinkFrameSourceImpl.cpp:(.text+0xf30): undefined reference to cuEGLStreamConsumerReleaseFrame' /usr/share/visionworks/sources/libs/aarch64/linux/release/libovx.a(GStreamerEGLStreamSinkFrameSourceImpl.o): In function nvidiaio::GStreamerEGLStreamSinkFrameSourceImpl::close()‘:
GStreamerEGLStreamSinkFrameSourceImpl.cpp:(.text+0x1014): undefined reference to cuEGLStreamConsumerDisconnect' /usr/share/visionworks/sources/libs/aarch64/linux/release/libovx.a(GStreamerEGLStreamSinkFrameSourceImpl.o): In function nvidiaio::GStreamerEGLStreamSinkFrameSourceImpl::open()’:
GStreamerEGLStreamSinkFrameSourceImpl.cpp:(.text+0x1148): undefined reference to cuEGLStreamConsumerDisconnect' GStreamerEGLStreamSinkFrameSourceImpl.cpp:(.text+0x11e8): undefined reference to cuEGLStreamConsumerConnect’
/usr/share/visionworks/sources/libs/aarch64/linux/release/libovx.a(GStreamerEGLStreamSinkFrameSourceImpl.o): In function nvidiaio::GStreamerEGLStreamSinkFrameSourceImpl::fetch(nvidiaio::image_t const&, unsigned int)': GStreamerEGLStreamSinkFrameSourceImpl.cpp:(.text+0x1408): undefined reference to cuEGLStreamConsumerDisconnect’
GStreamerEGLStreamSinkFrameSourceImpl.cpp:(.text+0x14ec): undefined reference to cuEGLStreamConsumerDisconnect' GStreamerEGLStreamSinkFrameSourceImpl.cpp:(.text+0x154c): undefined reference to cuEGLStreamConsumerAcquireFrame’
GStreamerEGLStreamSinkFrameSourceImpl.cpp:(.text+0x15c0): undefined reference to cuEGLStreamConsumerDisconnect' GStreamerEGLStreamSinkFrameSourceImpl.cpp:(.text+0x1618): undefined reference to cuGraphicsResourceGetMappedEglFrame’
GStreamerEGLStreamSinkFrameSourceImpl.cpp:(.text+0x1750): undefined reference to cuEGLStreamConsumerReleaseFrame' GStreamerEGLStreamSinkFrameSourceImpl.cpp:(.text+0x17d4): undefined reference to cuEGLStreamConsumerReleaseFrame’
GStreamerEGLStreamSinkFrameSourceImpl.cpp:(.text+0x1834): undefined reference to cuEGLStreamConsumerDisconnect' /usr/share/visionworks/sources/libs/aarch64/linux/release/libovx.a(GStreamerEGLStreamSinkFrameSourceImpl.o): In function nvidiaio::GStreamerEGLStreamSinkFrameSourceImpl::~GStreamerEGLStreamSinkFrameSourceImpl()‘:
GStreamerEGLStreamSinkFrameSourceImpl.cpp:(.text+0x2680): undefined reference to cuEGLStreamConsumerDisconnect' /usr/share/visionworks/sources/libs/aarch64/linux/release/libovx.a(GStreamerEGLStreamSinkFrameSourceImpl.o): In function nvidiaio::GStreamerEGLStreamSinkFrameSourceImpl::~GStreamerEGLStreamSinkFrameSourceImpl()’:
GStreamerEGLStreamSinkFrameSourceImpl.cpp:(.text+0x27a0): undefined reference to cuEGLStreamConsumerDisconnect' /usr/share/visionworks/sources/libs/aarch64/linux/release/libovx.a(EGLAPIAccessors.o): In function nvidiaio::EGLDisplayAccessor::~EGLDisplayAccessor()‘:
EGLAPIAccessors.cpp:(.text+0x1c): undefined reference to eglTerminate' /usr/share/visionworks/sources/libs/aarch64/linux/release/libovx.a(EGLAPIAccessors.o): In function nvidiaio::EGLDisplayAccessor::getInstance()’:
EGLAPIAccessors.cpp:(.text+0xbc): undefined reference to eglGetDisplay' EGLAPIAccessors.cpp:(.text+0xd4): undefined reference to eglInitialize’
EGLAPIAccessors.cpp:(.text+0x128): undefined reference to eglTerminate' /usr/share/visionworks/sources/libs/aarch64/linux/release/libovx.a(EGLAPIAccessors.o): In function nvidiaio::EGLDisplayAccessor::EGLDisplayAccessor()‘:
EGLAPIAccessors.cpp:(.text+0x190): undefined reference to eglGetDisplay' EGLAPIAccessors.cpp:(.text+0x1a4): undefined reference to eglInitialize’
EGLAPIAccessors.cpp:(.text+0x1ec): undefined reference to eglTerminate' /usr/share/visionworks/sources/libs/aarch64/linux/release/libovx.a(EGLAPIAccessors.o): In function nvidiaio::egl_api::setupEGLExtensions()‘:
EGLAPIAccessors.cpp:(.text+0x25c): undefined reference to eglGetProcAddress' CMakeFiles/main.dir/main_video_stabilizer.cpp.o: In function main’:
main_video_stabilizer.cpp:(.text+0xdfc): undefined reference to nvx::initDelayOfImages(_vx_context*, _vx_delay*)' main_video_stabilizer.cpp:(.text+0x1050): undefined reference to nvx::VideoStabilizer::VideoStabilizerParams::VideoStabilizerParams()’
main_video_stabilizer.cpp:(.text+0x1080): undefined reference to `nvx::VideoStabilizer::createImageBasedVStab(_vx_context*, nvx::VideoStabilizer::VideoStabilizerParams const&)’
collect2: error: ld returned 1 exit status
CMakeFiles/main.dir/build.make:121: recipe for target ‘main’ failed
make[2]: *** [main] Error 1
CMakeFiles/Makefile2:94: recipe for target ‘CMakeFiles/main.dir/all’ failed
make[1]: *** [CMakeFiles/main.dir/all] Error 2
Makefile:102: recipe for target ‘all’ failed
make: *** [all] Error 2

I have also tried with the cmakeLists that appears in the following post:

Does anyone know where the problem is?
Thanks in advance

Hi,

Could you try the cmake file shared in the below comment?

Thanks.

Hi,
thanks for the answer, but unfortunately I get the same result with that CMakeLists.txt.

Hi,
I have to add the following includes in the target_link_libraries:

-lEGL
/usr/lib/aarch64-linux-gnu/tegra-egl/libGLESv2_nvidia.so.2
/usr/lib/aarch64-linux-gnu/tegra/libcuda.so

I attach the file in case someone else needs it.CMakeLists.txt (961 Bytes)

But my new problem is that when I launch the program I receive:

VisionWorks library info:
VisionWorks version : 1.6.0
OpenVX Standard version : 1.1.0

GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected…
GST_ARGUS: Available Sensor modes :
GST_ARGUS: 2592 x 1944 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 16.000000; Exposure Range min 34000, max 550385000;

GST_ARGUS: 2592 x 1458 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 16.000000; Exposure Range min 34000, max 550385000;

GST_ARGUS: 1280 x 720 FR = 120.000005 fps Duration = 8333333 ; Analog Gain range min 1.000000, max 16.000000; Exposure Range min 22000, max 358733000;

GST_ARGUS: Running with following settings:
Camera index = 0
Camera mode = 2
Output Stream W = 1280 H = 720
seconds to Run = 0
Frame Rate = 120.000005
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.
Error: Cannot open default render!
CONSUMER: Done Success
GST_ARGUS: Cleaning up
GST_ARGUS: Done Success

And then the program finish, I can see with that compilation the image from the camera.
I am trying to execute the simple example “nvgstcamera_capture” with a CSI camera connected. If I try to execute this program with the Makefile that is by default I can see the camera correctly.
I don’t understand what is happening here.

Hi,

Error: Cannot open default render!

The error indicates that VisionWorks cannot open the output window correctly.
Could you run the following command and try the app again?

export DISPLAY=:1   # or :0

Thanks.

Thanks for your time, but with export DISPLAY=:1 I see the same result as my last comment.
And with export DISPLAY=:0 I see the following error:

VisionWorks library info:
VisionWorks version : 1.6.0
OpenVX Standard version : 1.1.0

Invalid MIT-MAGIC-COOKIE-1 keyError: cannot open source!

After make some changes in my CMakeLists.txt I get it. I attach the file in case someone needs it.
CMakeLists.txt (1.5 KB)