How detected tegra gl core correctly in cmake?

If I no linked manually to libraries tegra returns a segment fault
from /usr/lib/aarch64-linux-gnu/libGLX.so.0
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Is there an example to follow? Thank you.

This problem does not seem to affect OpenGLes 2.0 / 3.x where it works without problems and no need linker tegra libs.

Hi,

Your issue looks similar to the topic 1036916:
https://devtalk.nvidia.com/default/topic/1036916/jetson-tx2/-segmentation-fault-in-usr-lib-aarch64-linux-gnu-tegra-libglx-so-0/

Could you check if the comment from linuxdev fixes your issue first?
Thanks.

The check sha is ok.

mrcmunir@mrcmunir-desktop:~$ sha1sum -c /etc/nv_tegra_release
/usr/lib/aarch64-linux-gnu/tegra/libnvosd.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvgov_camera.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmmlite_image.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvomx.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvgov_force.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnveventlib.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmedia.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmmlite_utils.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvexif.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvrm_gpu.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvtx_helper.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libsensors.l4t.no_fusion.nvs.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvargus_socketserver.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvscf.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libsensors.hal-client.nvs.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvfnetstorehdfx.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmm_parser.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvrm.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmm_contentpipe.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvgov_gpucompute.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvgov_tbc.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvos.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvtnr.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvgov_graphics.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libsensors_hal.nvs.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvimp.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvfnet.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvphs.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvavp.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmmlite_video.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvfnetstoredefog.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvgov_il.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvodm_imager.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvjpeg.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvargus_socketclient.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvtvmr.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvtracebuf.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvidia-egl-wayland.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvdc.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvgov_boot.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvgov_generic.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libtegrav4l2.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmm.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvapputil.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvcameratools.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvcam_imageencoder.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnveglstream_camconsumer.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmm_utils.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvomxilclient.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvwinsys.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvargus.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvgov_spincircle.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvphsd.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnveglstreamproducer.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvll.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvrm_graphics.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvcolorutil.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvddk_2d_v2.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvtestresults.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvcamv4l2.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvcamerautils.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvcamlog.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvparser.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvddk_vic.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvgov_ui.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmmlite.so: OK
/usr/lib/aarch64-linux-gnu/libv4lconvert.so: OK
/usr/lib/aarch64-linux-gnu/libv4l/plugins/libv4l2_nvvidconv.so: OK
/usr/lib/aarch64-linux-gnu/libv4l/plugins/libv4l2_nvvideocodec.so: OK
/usr/lib/xorg/modules/drivers/nvidia_drv.so: OK
/usr/lib/xorg/modules/extensions/libglxserver_nvidia.so: OK

I have been able to verify that if the application is compiled for
OpenGL core and vulkan -> Not loading fine Libglx.so.0 crash not loading fine due not detected correct tegra libs

OpenGL ES 3.2 and Vulkan -> switch OpenGL ES <-> Vulkan fine without linker tegra libs.

Ok I have found the main problem LibGLX.so library that is installed conflicts and breaks the detection of the GPU completely with OpenGL core<->Vulkan

Currently I use a toolchain.cmake file to solve that (As an example if someone wants to have a starting point if you use CMake into you project).
And fully functional with linking to libglX_nvidia.so.0 library instead of libGLX.so.0.

 if (NOT EXISTS "/usr/lib/aarch64-linux-gnu/tegra")
  message (FATAL_ERROR "Nvidia Jetson platform not recognized")
endif ()

include_directories (SYSTEM
 /usr/include/GL
)

set (ARCH_FLAGS "-march = armv8-a+crc -mtune=cortex-a57 -funsafe-math-optimizations")
set (CMAKE_C_FLAGS "$ {CMAKE_C_FLAGS} $ {ARCH_FLAGS}" CACHE STRING "" FORCE)
set (CMAKE_CXX_FLAGS "$ {CMAKE_CXX_FLAGS} $ {ARCH_FLAGS}" CACHE STRING "" FORCE)
set (CMAKE_ASM_FLAGS "$ {CMAKE_ASM_FLAGS} $ {ARCH_FLAGS}" CACHE STRING "" FORCE)

set (CMAKE_EXE_LINKER_FLAGS "-Wl,-rpath,/usr/lib/aarch64-linux-gnu/tegra" CACHE STRING "" FORCE)

set (OPENGL_LIBRARIES /usr/lib/aarch64-linux-gnu/tegra/libGLX_nvidia.so.0)

I hope you find it useful

For a future it would be necessary Improve that thanks.

What???
It’s incredible. I’m having lots of problems with Jetson Nano and Processing software (www.processing.org) as I posted in https://devtalk.nvidia.com/default/topic/1052181/jetson-nano/java-on-jetson-nano/post/5343955/#5343955.
Now, I have read this post about problems with libGLX.so.0. This is the problematic file that Processing reports to me when I try to use the OpenGL renderers that Processing has.
I’m not a computer technician and I am really bored about this problem. I’m having a week dealing with it and I decided to give up yesterday and go on with my Raspberry Pi that has no problem with Processing. But reading this post I decided to go to the “/usr/lib/aarch64-linux-gnu/tegra” folder and copy the libGLX_nvidia.so.0 file to the “”/usr/lib/aarch64-linux-gnu" folder and rename it as libGLX.so.0
https://drive.google.com/open?id=1h8bDiVyrTlOazdEIJeJS4GI5lvw9Teew
I tried to open Processing and no problem. I load one example file that uses one of the OpenGL renderers, I run it and… IT WORKS!!!
It’s incredible!!!
Although when I close the sketch I can see some errors in the console, I can use OpenGL renderers. I have to test deeply the frame rates, that seems to be low and compare it with Raspberry frame rates, but for me this is a victory.
I think I can do it in a better way, this is a wild method!!! :D

These are the final errors that appear when I close the sketch:
https://drive.google.com/open?id=1CnzQ0eBjvmjBqiRu8IZXd4A8Zcq9S1-A