Vulkan vk_chopper compiles on TX2, but gives a segfault when run

On the Vulkan support on L4T page: Vulkan Support on Jetson Linux | NVIDIA Developer

… there is a vk_chopper example. If one downloads it, the prebuilt executable (chopper) works beautifully. However there is also a build script which I have run, after following the advice of the README which says if we get an ‘-lvulkan’ error, which I did on first build, then we must create a manual link:

/usr/lib/aarch64-linux-gnu/libvulkan.so → /usr/lib/aarch64-linux-gnu/libvulkan.so.1.0.8 (or whichever is the latest version).

So I went to usr/lib/aarch64-linux-gnu directory and did this:

nvidia@tegra-ubuntu:/usr/lib/aarch64-linux-gnu$ sudo ln -s libvulkan.so.1.0.21 libvulkan.so

Now when I go back to the vk_chopper and try the build.sh script it gives no errors and creates the chopper executable. However now this chopper executable, when run, opens a window and a brief glimpse at the sky+choppers, but then segfaults badly:

nvidia@tegra-ubuntu:~/Downloads/vk_chopper$ ./chopper
Initialising Devices
Found 1 Devices
Device ID : 0x614880
INFO 	 : 	Loading Cube Texture.
INFO 	 : 	Created CUBE Image Texture.
ERROR 	 [-1000011001] : Could not create buffer view.
 
ERROR 	 [-1000011001] : Could not create buffer view.
 
ERROR 	 [-1000011001] : Could not create buffer view.
 
ERROR 	 [-1000011001] : Could not create buffer view.
 
ERROR 	 [-1000011001] : Could not create buffer view.
 
ERROR 	 [-1000011001] : Could not create buffer view.
 
ERROR 	 [-1000011001] : Could not create image view for texture.
 
INFO 	 : 	Texture Loaded.
INFO 	 : 	Floating Point Texture Loaded.
Node Count : 32
Mesh Count : 32
Material Count 6
Texture Count : 8
Animation Count : 0
ERROR 	 [-1000011001] : Could not create buffer view.
 
ERROR 	 [-1000011001] : Could not create buffer view.
 
Vertex Count : 228 Index Count : 228.
First Index : 0 First Vertex : 0.
Vertex Count : 90 Index Count : 90.
First Index : 228 First Vertex : 228.
Vertex Count : 90 Index Count : 90.
First Index : 318 First Vertex : 318.
Vertex Count : 228 Index Count : 228.
First Index : 408 First Vertex : 408.
Vertex Count : 3528 Index Count : 3528.
First Index : 636 First Vertex : 636.
Vertex Count : 1440 Index Count : 1440.
First Index : 4164 First Vertex : 4164.
Vertex Count : 6333 Index Count : 6333.
First Index : 5604 First Vertex : 5604.
Vertex Count : 11826 Index Count : 11826.
First Index : 11937 First Vertex : 11937.
Vertex Count : 1716 Index Count : 1716.
First Index : 23763 First Vertex : 23763.
Vertex Count : 756 Index Count : 756.
First Index : 25479 First Vertex : 25479.
Vertex Count : 18813 Index Count : 18813.
First Index : 26235 First Vertex : 26235.
Vertex Count : 2610 Index Count : 2610.
First Index : 45048 First Vertex : 45048.
Vertex Count : 6930 Index Count : 6930.
First Index : 47658 First Vertex : 47658.
Vertex Count : 264 Index Count : 264.
First Index : 54588 First Vertex : 54588.
Vertex Count : 756 Index Count : 756.
First Index : 54852 First Vertex : 54852.
Vertex Count : 2034 Index Count : 2034.
First Index : 55608 First Vertex : 55608.
Vertex Count : 6930 Index Count : 6930.
First Index : 57642 First Vertex : 57642.
Vertex Count : 10803 Index Count : 10803.
First Index : 64572 First Vertex : 64572.
Vertex Count : 1830 Index Count : 1830.
First Index : 75375 First Vertex : 75375.
Vertex Count : 756 Index Count : 756.
First Index : 77205 First Vertex : 77205.
Vertex Count : 1608 Index Count : 1608.
First Index : 77961 First Vertex : 77961.
Vertex Count : 77541 Index Count : 77541.
First Index : 79569 First Vertex : 79569.
Vertex Count : 3456 Index Count : 3456.
First Index : 157110 First Vertex : 157110.
Vertex Count : 2610 Index Count : 2610.
First Index : 160566 First Vertex : 160566.
Vertex Count : 264 Index Count : 264.
First Index : 163176 First Vertex : 163176.
Vertex Count : 108 Index Count : 108.
First Index : 163440 First Vertex : 163440.
Vertex Count : 7008 Index Count : 7008.
First Index : 163548 First Vertex : 163548.
Vertex Count : 7008 Index Count : 7008.
First Index : 170556 First Vertex : 170556.
Vertex Count : 7008 Index Count : 7008.
First Index : 177564 First Vertex : 177564.
Vertex Count : 24786 Index Count : 24786.
First Index : 184572 First Vertex : 184572.
Vertex Count : 2409 Index Count : 2409.
First Index : 209358 First Vertex : 209358.
Vertex Count : 6333 Index Count : 6333.
First Index : 211767 First Vertex : 211767.
INFO 	 : 	Texture Loaded.
INFO 	 : 	Texture Loaded.
INFO 	 : 	Texture Loaded.
INFO 	 : 	Texture Loaded.
INFO 	 : 	Texture Loaded.
INFO 	 : 	Texture Loaded.
ERROR 	 [-1000011001] : Could not create buffer view.
 
ERROR 	 [-1000011001] : Could not create buffer view.
 
Segmentation fault (core dumped)

What’s going on here? Shouldn’t the build script work?

If a error is shown in dmesg after the failure occurs you might want to post that info too.

Please see message below as trying to paste entire dmesg output reached the truncate threshold of this commenting system.

@linuxdev: here is full dmesg output

[url]http://www.signaliser.com/dmsg[/url]

I see “unhandled level 0 translation fault”, which is a memory issue (I’m not sure what the different levels specify). I couldn’t say for sure, but I’m thinking perhaps something didn’t get ported correctly between older 32-bit or older 64-bit kernel version 3.x into the current 4.x kernel.

About truncating posts…you can put the block quote symbol in first (the “</>” icon), and then paste into that. Alternatively, you can post, and then attach a “.txt” file by hovering over the quote icon in your post, which then reveals a paper clip icon, and use the paper clip icon to attach.

So what you’re saying is that this is an L4T issue that I have no control over?

I believe it is a memory issue which may be caused by incorrect porting to this architecture. It could be an issue within L4T though. I’m hoping someone at NVIDIA can debug this and say whether the app was not ported correctly or if there is a bug in L4T. My gut feeling is that it is about a 75% chance it is caused by the app needing adjustment (incomplete port), and about a 25% chance something in L4T needs a tweak.

Are you using R27.1? This would probably be the first thing to change if you have not done so already…I believe there may have been memory fixes or other relevant GUI fixes going from the default R27.0.1 to R27.1.

I went to this site:

and clicked on the “Vulkan Demo Program (“Chopper”)” demo to download it
https://developer.nvidia.com/embedded/vulkan/chopper-demo

then I ran it and checked the binary, it ran fine. Then I read the README and ran the build.sh. The build.sh is just:

g++ src/*.cpp -g -std=c++11 -lvulkan -lxcb -lpng -DVK_USE_PLATFORM_XCB_KHR -I./src -I./include -w -o chopper

and it failed so I added the symbolic link as per the README and rebuilt:

# ls -l /usr/lib/aarch64-linux-gnu/libvulkan.so*
lrwxrwxrwx 1 root root     18 Apr 14  2016 /usr/lib/aarch64-linux-gnu/libvulkan.so.1 -> libvulkan.so.1.0.8
-rw-r--r-- 1 root root 121248 Apr 14  2016 /usr/lib/aarch64-linux-gnu/libvulkan.so.1.0.8
# ln -n /usr/lib/aarch64-linux-gnu/libvulkan.so.1.0.8 /usr/lib/aarch64-linux-gnu/libvulkan.so
# ls -l /usr/lib/aarch64-linux-gnu/libvulkan.so*
-rw-r--r-- 2 root root 121248 Apr 14  2016 /usr/lib/aarch64-linux-gnu/libvulkan.so
lrwxrwxrwx 1 root root     18 Apr 14  2016 /usr/lib/aarch64-linux-gnu/libvulkan.so.1 -> libvulkan.so.1.0.8
-rw-r--r-- 2 root root 121248 Apr 14  2016 /usr/lib/aarch64-linux-gnu/libvulkan.so.1.0.8
# ./build.sh
# ldd chopper
...
	libvulkan.so.1 => /usr/lib/aarch64-linux-gnu/libvulkan.so.1 (0x0000007f80bb2000)
...

Ran it and got a segfault but it did bring up a window with choppers in it, as yours did:

#0  0x0000007fb717e714 in ?? () from /usr/lib/aarch64-linux-gnu/tegra/libnvidia-glcore.so.27.1.0
#1  0x0000007fb7167410 in ?? () from /usr/lib/aarch64-linux-gnu/tegra/libnvidia-glcore.so.27.1.0
#2  0x000000000043fd38 in VulkanDC::Device::present (this=0x621800, inQueue=0x830d20, inBuffers=0x8589d0)
    at src/VulkanDeviceContext.cpp:572
#3  0x0000000000421e88 in vkeGameRendererDynamic::present (this=0x858960)
    at src/VkeGameRendererDynamic.cpp:1291
#4  0x000000000041fc08 in vkeGameRendererDynamic::update (this=0x858960) at src/VkeGameRendererDynamic.cpp:525
#5  0x000000000043c69c in VulkanAppContext::render (this=0x48ac20) at src/VulkanAppContext.cpp:300
#6  0x0000000000439e18 in renderScene () at src/vk_tx1_chopper.cpp:149
#7  0x000000000043a110 in xLibMessagePump () at src/vk_tx1_chopper.cpp:308
#8  0x000000000043a694 in main (argc=1, argv=0x7ffffff588) at src/vk_tx1_chopper.cpp:416
(gdb)

So I see the same thing. The chopper binary uses dynamically linked libraries and they are the same ones that the build.sh one uses so either there is a compiler difference between the source used to build the binary that comes with it or there is a source code difference between the source that built that binary and the source in the src directory.

I noticed the src/vk_tx1_chopper.cpp in the chopper example has an email contact at nvidia up at the top that says “contact for feedback”. Maybe contacting him would supply an answer.

As a side note, I went to see how to build the Vulkan SDK myself and couldn’t find the source or an ARM64 version of the library for download. The Vulkan site has x86 Windows and Linux and an Android version but it says to get the SDK for Linux ARM you need to build it but I can’t find the source. Maybe it is in the Khronos login but I don’t believe I have a login for that.

ESJS I had the same problem. You can get more detail here:

I have successfully compiled this, and indeed, I tried simlinking to the newer libvulkan that this produces, but I still get the segfault. As a further side note, this compilation creates a subtree with an enormous amount of directories and I have no clue where to put everything to get Vulkan compilation to work in general on the Jetson TX2.

I can verify that the “chopper” executable provided pre-built works, but the result of the “./build.sh” fails with seg fault in libnvidia-glcore.so.27.1.0 (I’m usring R27.1).

Would it be possible for someone at NVIDIA with a debug version of libnvidia-glcore.so.27.1.0 to find out if the bug is in libnvidia-glcore, or if instead it is an error on how chopper calls libnvidia-glcore?

Hi, vegabook, ESJS and linuxdev,

Thanks for reporting this issue, we’re investigating this issue now, the status will be updated once clarified.
Please stay tuned.

Thanks

@kayccc: nudge?

Hi vegabook,

There should be an update version of Vulkan SDK being released, it’s in validating stage now, please stay tuned.

Sorry for the late reply.

Thanks