jherico / VulkanExamples

Examples and demos for the Vulkan C++ API
https://github.com/KhronosGroup/Vulkan-Hpp
MIT License
339 stars 29 forks source link

Build failed #39

Closed xrombik closed 5 years ago

xrombik commented 5 years ago

Build failed with this output:

$make
Scanning dependencies of target SetupRelease
[  0%] Built target SetupRelease
Scanning dependencies of target SetupDebug
[  0%] Built target SetupDebug
Scanning dependencies of target glad
[  1%] Building C object base/CMakeFiles/glad.dir/__/external/glad/src/glad.c.o
[  1%] Linking C static library libglad.a
[  1%] Built target glad
Scanning dependencies of target imgui
[  2%] Building CXX object base/CMakeFiles/imgui.dir/__/external/imgui/imgui.cpp.o
[  2%] Building CXX object base/CMakeFiles/imgui.dir/__/external/imgui/imgui_demo.cpp.o
[  2%] Building CXX object base/CMakeFiles/imgui.dir/__/external/imgui/imgui_draw.cpp.o
[  2%] Linking CXX static library libimgui.a
[  2%] Built target imgui
Scanning dependencies of target gli
[  2%] Creating directories for 'gli'
[  2%] Performing download step (download, verify and extract) for 'gli'
-- Downloading...
   dst='/mnt/sdc1/Vulkan/ext/makefiles/gli/project/src/gli.zip'
   timeout='none'
-- Using src='https://s3.amazonaws.com/VulkanCppExamples/gli.zip'
-- [download 0% complete]
-- [download 15% complete]
-- [download 16% complete]
-- [download 31% complete]
-- [download 32% complete]
-- [download 47% complete]
-- [download 48% complete]
-- [download 63% complete]
-- [download 64% complete]
-- [download 79% complete]
-- [download 80% complete]
-- [download 95% complete]
-- [download 96% complete]
-- [download 100% complete]
-- verifying file...
       file='/mnt/sdc1/Vulkan/ext/makefiles/gli/project/src/gli.zip'
-- Downloading... done
-- extracting...
     src='/mnt/sdc1/Vulkan/ext/makefiles/gli/project/src/gli.zip'
     dst='/mnt/sdc1/Vulkan/ext/makefiles/gli/project/src/gli'
-- extracting... [tar xfz]
-- extracting... [analysis]
-- extracting... [rename]
-- extracting... [clean up]
-- extracting... done
[  2%] No patch step for 'gli'
[  2%] No update step for 'gli'
[  3%] No configure step for 'gli'
[  3%] No build step for 'gli'
[  3%] No install step for 'gli'
[  3%] Completed 'gli'
[  3%] Built target gli
Scanning dependencies of target shaders
[  3%] Generating ../data/shaders/base/textoverlay.vert.debug.spv
/bin/sh: 1: GLSLANG_EXECUTABLE-NOTFOUND: not found
base/CMakeFiles/shaders.dir/build.make:1141: recipe for target 'data/shaders/base/textoverlay.vert.debug.spv' failed
make[2]: *** [data/shaders/base/textoverlay.vert.debug.spv] Error 127
CMakeFiles/Makefile2:243: recipe for target 'base/CMakeFiles/shaders.dir/all' failed
make[1]: *** [base/CMakeFiles/shaders.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Try on platform:

Distributor ID: LinuxMint
Description:    Linux Mint 19.1 Tessa
Release:    19.1
Codename:   tessa

Dev packages:

$pkg-config --list-all
zlib                           zlib - zlib compression library
gio-unix-2.0                   GIO unix specific APIs - unix specific headers for glib I/O library
xbitmaps                       X bitmaps - Bitmaps that are shared between X applications
gtk-engines-2                  gtk-engines-2 - GTK+ Theme Engines
cairo-xcb                      cairo-xcb - XCB surface backend for cairo graphics library
xshmfence                      xshmfence - The X Shared Memory Fence Library
protobuf                       Protocol Buffers - Google's Data Interchange Format
gio-2.0                        GIO - glib I/O library
applewmproto                   AppleWMProto - AppleWM extension headers
xf86dgaproto                   XF86DGAProto - XF86DGA extension headers
mirclient                      mirclient - Mir client library
openal                         OpenAL - OpenAL is a cross-platform 3D audio API
cairo-gobject                  cairo-gobject - gobject functions for cairo graphics library
xinerama                       Xinerama - The Xinerama Library
harfbuzz-icu                   harfbuzz - HarfBuzz text shaping library ICU integration
libpng16                       libpng - Loads and saves PNG files
randrproto                     RandrProto - Randr extension headers
menu                           menu - ncurses 6.1 add-on library
dbus-1                         dbus - Free desktop message bus
cairo-ps                       cairo-ps - PostScript surface backend for cairo graphics library
gmodule-2.0                    GModule - Dynamic module loader for GLib
xfce4-session-2.0              xfce4-session - Xfce 4 session manager
glib-2.0                       GLib - C Utility Library
xdmcp                          Xdmcp - X Display Manager Control Protocol library
xextproto                      XExtProto - XExt extension headers
dmxproto                       DMXProto - DMX extension headers
xau                            Xau - X authorization file management libary
fontsproto                     FontsProto - Fonts extension headers
gnome-icon-theme-symbolic      gnome-icon-theme-symbolic - A collection of symbolic icons used as the basis for GNOME themes
windowswmproto                 WindowsWMProto - WindowsWM extension headers
pango                          Pango - Internationalized text handling
inputproto                     InputProto - Input extension headers
libdrm                         libdrm - Userspace interface to kernel DRM services
glfw3                          GLFW - A multi-platform library for OpenGL, window and input
xscrnsaver                     XScrnSaver - The XScrnSaver Library
presentproto                   PresentProto - Present extension headers
adwaita-icon-theme             gnome-icon-theme - A collection of icons used as the basis for GNOME themes
gl                             gl - Mesa OpenGL library
glew                           glew - The OpenGL Extension Wrangler library
icu-le-hb                      icu-le-hb - ICU Layout Engine API on top of HarfBuzz shaping library
glproto                        GLProto - GL extension headers
wayland-client                 Wayland Client - Wayland client side library
fontutil                       FontUtil - Font utilities dirs
libpcrecpp                     libpcrecpp - PCRECPP - C++ wrapper for PCRE
pangoft2                       Pango FT2 and Pango Fc - Freetype 2.0 and fontconfig font support for Pango
xorg-wacom                     xorg-wacom - X.Org Wacom Tablet driver.
ice                            ICE - X Inter Client Exchange Library
gdk-pixbuf-2.0                 GdkPixbuf - Image loading and scaling
sdl2                           sdl2 - Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer.
pugixml                        pugixml - Light-weight, simple and fast XML parser for C++ with XPath support.
gmodule-no-export-2.0          GModule - Dynamic module loader for GLib
pangox                         Pango X - X Window System font support for Pango
xrender                        Xrender - X Render Library
gdk-pixbuf-xlib-2.0            GdkPixbuf Xlib - GdkPixbuf rendering for Xlib
wayland-server                 Wayland Server - Server side implementation of the Wayland protocol
libdrm_nouveau                 libdrm_nouveau - Userspace interface to nouveau kernel DRM services
libgdiplus                     libgdiplus - GDI+ implementation
icu-io                         icu-io - International Components for Unicode: Stream and I/O Library
theoradec                      theora - Theora video codec (decoder)
xext                           Xext - Misc X Extension Library
xcb                            XCB - X-protocol C Binding
xproto                         Xproto - Xproto headers
videoproto                     VideoProto - Video extension headers
pthread-stubs                  pthread stubs - Stubs missing from libc for standard pthread functions
bigreqsproto                   BigReqsProto - BigReqs extension headers
mobile-broadband-provider-info mobile-broadband-provider-info - Mobile Broadband Service Provider Information Database
gtk+-unix-print-2.0            GTK+ - GTK+ Unix print support
pygtkglext-1.0                 PyGtkGLExt - Python Bindings for GtkGLExt
xcb-randr                      XCB RandR - XCB RandR Extension
compizconfig-python            compizconfig-python - Compiz configuration system bindings
renderproto                    RenderProto - Render extension headers
systemd                        systemd - systemd System and Service Manager
xcb-present                    XCB Present - XCB Present Extension
gdk-2.0                        GDK - GTK+ Drawing Kit (x11 target)
glesv2                         glesv2 - Mesa OpenGL ES 2.0 library
gnome-system-tools             gst - Gnome System Tools
xcursor                        Xcursor - X Cursor Library
xi                             Xi - X Input Extension Library
xrandr                         Xrandr - X RandR Library
xcb-sync                       XCB Sync - XCB Sync Extension
egl                            egl - Mesa EGL library
cairo-pdf                      cairo-pdf - PDF surface backend for cairo graphics library
ncurses                        ncurses - ncurses 6.1 library
fixesproto                     FixesProto - X Fixes extension headers
libpulse-mainloop-glib         libpulse-mainloop-glib - PulseAudio GLib 2.0 Main Loop Wrapper
xcomposite                     Xcomposite - X Composite Extension Library
expat                          expat - expat XML parser
xkbcomp                        xkbcomp - XKB keymap compiler
xt                             Xt - X Toolkit Library
x11-xcb                        X11 XCB - X Library XCB interface
xv                             Xv - The Xv Library
libudev                        libudev - Library to access udev device information
vulkan                         VULKAN - Vulkan Loader
xcb-shape                      XCB Shape - XCB Shape Extension
xcb-shm                        XCB Shm - XCB Shm Extension
pangocairo                     Pango Cairo - Cairo rendering support for Pango
ibus-1.0                       IBus - IBus Library
vorbisfile                     vorbisfile - vorbisfile is a library that provides a convenient high-level API for decoding and basic manipulation of all Vorbis I audio streams
gmodule-export-2.0             GModule - Dynamic module loader for GLib
graphite2                      Graphite2 - Font rendering engine for Complex Scripts
damageproto                    DamageProto - Damage extension headers
geoclue-2.0                    Geoclue - The Geoinformation Service
dri                            dri - Direct Rendering Infrastructure
x11                            X11 - X Library
dri3proto                      DRI3Proto - DRI3 extension headers
libjpeg                        libjpeg - JPEG image codec
cairo-xlib                     cairo-xlib - Xlib surface backend for cairo graphics library
iso-codes                      iso-codes - ISO country, language, script and currency codes and translations
xdamage                        Xdamage - X Damage  Library
usbutils                       usbutils - USB device database
tinfo                          tinfo - ncurses 6.1 terminal interface library
kbproto                        KBProto - KB extension headers
xcb-dri2                       XCB DRI2 - XCB DRI2 Extension
xcb-dri3                       XCB DRI3 - XCB DRI3 Extension
pixman-1                       Pixman - The pixman library (version 1)
cairo-xcb-shm                  cairo-xcb-shm - XCB/SHM functions for cairo graphics library
compositeproto                 CompositeExt - Composite extension headers
gtk+-x11-2.0                   GTK+ - GTK+ Graphical UI Library (x11 target)
xf86driproto                   XF86DRIProto - XF86DRI extension headers
libdrm_amdgpu                  libdrm_amdgpu - Userspace interface to kernel DRM services for amdgpu
reiserfscore                   reiserfscore - ReiserFS Core Library
dri2proto                      DRI2Proto - DRI2 extension headers
xxf86vm                        Xxf86vm - XFree86 Video Mode Extension Library
tomboy-addins                  Tomboy Addin Library - Library providing the interfaces for Tomboy addins
icu-le                         icu-le - ICU Layout Engine API on top of HarfBuzz shaping library
libpcre16                      libpcre16 - PCRE - Perl compatible regular expressions C library with 16 bit character support
gdkglext-x11-1.0               GdkGLExt - OpenGL Extension to GDK (x11 target)
resourceproto                  ResourceProto - Resource extension headers
libdrm_radeon                  libdrm_radeon - Userspace interface to kernel DRM services for radeon
gobject-2.0                    GObject - GLib Type, Object, Parameter and Signal Library
vorbisenc                      vorbisenc - vorbisenc is a library that provides a convenient API for setting up an encoding environment using libvorbis
valgrind                       Valgrind - A dynamic binary instrumentation framework
libpulse-simple                libpulse-simple - PulseAudio Simplified Synchronous Client Interface
libpng                         libpng - Loads and saves PNG files
gthread-2.0                    GThread - Thread support for GLib
cairo-fc                       cairo-fc - Fontconfig font backend for cairo graphics library
xmu                            Xmu - Xmu Library
libcrypto++                    libcrypto++ - General purpose cryptographic shared library
cairo                          cairo - Multi-platform 2D graphics library
ncurses++                      ncurses++ - ncurses 6.1 add-on library
bash-completion                bash-completion - programmable completion for the bash shell
form                           form - ncurses 6.1 add-on library
icu-lx                         icu-lx - International Components for Unicode: Paragraph Layout library (Using HarfBuzz)
poppler-data                   poppler-data - Encoding files for use with poppler
libpcreposix                   libpcreposix - PCREPosix - Posix compatible interface to libpcre
wayland-cursor                 Wayland Cursor - Wayland cursor helper library
fontconfig                     Fontconfig - Font configuration and customization library
tic                            tic - ncurses 6.1 add-on library
gnome-icon-theme               gnome-icon-theme - A collection of icons used as the basis for GNOME themes
pangoxft                       Pango Xft - Xft font support for Pango
mircookie                      mircookie - Mir client library
cairo-ft                       cairo-ft - FreeType font backend for cairo graphics library
gtkglext-x11-1.0               GtkGLExt - OpenGL Extension to GTK+ (x11 target)
wayland-scanner                Wayland Scanner - Wayland scanner
gtkglext-1.0                   GtkGLExt - OpenGL Extension to GTK+ (x11 target)
xft                            Xft - X FreeType library
cairo-xlib-xrender             cairo-xlib-xrender - Xlib Xrender surface backend for cairo graphics library
libdrm_intel                   libdrm_intel - Userspace interface to intel kernel DRM services
atk                            Atk - Accessibility Toolkit
theora                         theora - Theora video codec
theoraenc                      theora - Theora video codec (encoder)
xcmiscproto                    XCMiscProto - XCMisc extension headers
mirclientcpp                   mirclientcpp - C++ wrapper for mirclient
glu                            glu - Mesa OpenGL Utility library
wayland-egl                    wayland-egl - Mesa wayland-egl library
ogg                            ogg - ogg is a library for manipulating ogg bitstreams
icu-uc                         icu-uc - International Components for Unicode: Common and Data libraries
sm                             SM - X Session Management Library
cairo-svg                      cairo-svg - SVG surface backend for cairo graphics library
tbb                            Threading Building Blocks - Intel's parallelism library for C++
shared-mime-info               shared-mime-info - Freedesktop common MIME database
protobuf-lite                  Protocol Buffers - Google's Data Interchange Format
libpulse                       libpulse - PulseAudio Client Interface
scrnsaverproto                 ScrnSaverProto - ScrnSaver extension headers
vorbis                         vorbis - vorbis is the primary Ogg Vorbis library
yelp-xsl                       yelp-xsl - Yelp XSLT Stylesheets
xcb-render                     XCB Render - XCB Render Extension
harfbuzz                       harfbuzz - HarfBuzz text shaping library
icu-i18n                       icu-i18n - International Components for Unicode: Internationalization library
recordproto                    RecordProto - Record extension headers
xkbcommon                      xkbcommon - XKB API common to servers and clients
gdk-x11-2.0                    GDK - GTK+ Drawing Kit (x11 target)
libpcre                        libpcre - PCRE - Perl compatible regular expressions C library with 8 bit character support
panel                          panel - ncurses 6.1 add-on library
libpcre32                      libpcre32 - PCRE - Perl compatible regular expressions C library with 32 bit character support
cairo-png                      cairo-png - PNG functions for cairo graphics library
cairo-script                   cairo-script - script surface backend for cairo graphics library
alsa                           alsa - Advanced Linux Sound Architecture (ALSA) - Library
xkeyboard-config               XKeyboardConfig - X Keyboard configuration data
xineramaproto                  XineramaProto - Xinerama extension headers
cairo-tee                      cairo-tee - tee surface backend for cairo graphics library
libglvnd                       libglvnd - Vendor-neutral OpenGL dispatch library vendor interface
freetype2                      FreeType 2 - A free, high-quality, and portable font engine.
xf86bigfontproto               XF86BigFontProto - XF86BigFont extension headers
xfixes                         Xfixes - X Fixes  Library
mircore                        mircore - Mir core library
pm-utils                       pm-utils - Power management scripts for suspend and hibernate
xcb-xfixes                     XCB XFixes - XCB XFixes Extension
udev                           udev - udev
xtrans                         XTrans - Abstract network code for X
gtk+-2.0                       GTK+ - GTK+ Graphical UI Library (x11 target)
xorg-sgml-doctools             xorg-sgml-doctools - Stylesheets and entities for X.Org documentation
harfbuzz-gobject               harfbuzz - HarfBuzz text shaping library GObject integration
xf86vidmodeproto               XF86VidModeProto - XF86VidMode extension headers
xcb-glx                        XCB GLX - XCB GLX Extension
gdkglext-1.0                   GdkGLExt - OpenGL Extension to GDK (x11 target)

Clang version:

$ clang --version
clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

gcc Version:

$gcc --version
gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

CMake version: 3.10.2

jherico commented 5 years ago

do you have VULKAN_SDK set in your environment variable?

xrombik commented 5 years ago

I think VULKAN_SDK is not set:

$ echo "'$VULKAN_SDK'"                                                                                                                                 
''
$ export | grep VULKAN
$ 

But in any way i do not know what exactly it have to be.

jherico commented 5 years ago

You need to have the Vulkan SDK installed. You can do this either by downloading a package or tarball from LunarG or by using your package manager.

I just tested with Ubuntu 19.04 and I was able to get a build (without downloading anything from LunarG) after I'd installed the following packages:

libvulkan-dev
glslang-tools
glslang-dev
spirv-tools

I don't know if your mint distribution provides these packages or not, so your mileage may vary.

I've also updated the code a bit to account for some changes in the C++ API and fix some compiler issues I encountered with recent GCC versions while testing on Ubuntu.

xrombik commented 5 years ago

libvulkan-dev already installed. But this is not a Vulkan SDK, imho? I'm install a Vulkan SDK, with Vulkan developers provided script:

wget -qO - http://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add -
sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-1.1.106-bionic.list http://packages.lunarg.com/vulkan/1.1.106/lunarg-vulkan-1.1.106-bionic.list
sudo apt update
sudo apt install vulkan-sdk

Then run cmake and make, and everything is fine. But accured another problem while i'm run example:

$ ./bloom
ERROR: [Loader Message] Code 0 : setupLoaderTermPhysDevs:  Failed to detect any valid GPUs in the current config
ERROR: [Loader Message] Code 0 : setupLoaderTrampPhysDevs:  Failed during dispatch call of 'vkEnumeratePhysicalDevices' to lower layers or loader to get count.
terminate called after throwing an instance of 'vk::InitializationFailedError'
  what():  vk::Instance::enumeratePhysicalDevices: ErrorInitializationFailed
Аварийный останов (стек памяти сброшен на диск)

It seems to be a hardware/driver related problem. My Radeon R9 270 run games with Vulkan very well on Windows, but i do not know is there any problem with Linux and Vulkan for Radeon R270.

In any way i think this issue is closed. Thank you for your help.

xrombik commented 5 years ago

In this time i'm do some search to resolve this problem: https://forums.linuxmint.com/viewtopic.php?t=272283

OK. This was helpful. But this time any exmple shows this error:

WARNING: radv is not a conformant vulkan implementation, testing use only.
WARNING: radv is not a conformant vulkan implementation, testing use only.
ERROR: [Validation] Code 0 :  [ VUID-VkFramebufferCreateInfo-pAttachments-00880 ] Object: 0x12 (Type = 18) | vkCreateFramebuffer(): VkFramebufferCreateInfo attachment #0 has format of VK_FORMAT_B8G8R8A8_SRGB that does not match the format of VK_FORMAT_B8G8R8A8_UNORM used by the corresponding attachment for renderPass (0x12). The Vulkan spec states: Each element of pAttachments must have been created with an VkFormat value that matches the VkFormat specified by the corresponding VkAttachmentDescription in renderPass (https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-VkFramebufferCreateInfo-pAttachments-00880)
ERROR: [Validation] Code 0 :  [ VUID-VkFramebufferCreateInfo-pAttachments-00880 ] Object: 0x12 (Type = 18) | vkCreateFramebuffer(): VkFramebufferCreateInfo attachment #0 has format of VK_FORMAT_B8G8R8A8_SRGB that does not match the format of VK_FORMAT_B8G8R8A8_UNORM used by the corresponding attachment for renderPass (0x12). The Vulkan spec states: Each element of pAttachments must have been created with an VkFormat value that matches the VkFormat specified by the corresponding VkAttachmentDescription in renderPass (https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-VkFramebufferCreateInfo-pAttachments-00880)
ERROR: [Validation] Code 0 :  [ VUID-VkFramebufferCreateInfo-pAttachments-00880 ] Object: 0x12 (Type = 18) | vkCreateFramebuffer(): VkFramebufferCreateInfo attachment #0 has format of VK_FORMAT_B8G8R8A8_SRGB that does not match the format of VK_FORMAT_B8G8R8A8_UNORM used by the corresponding attachment for renderPass (0x12). The Vulkan spec states: Each element of pAttachments must have been created with an VkFormat value that matches the VkFormat specified by the corresponding VkAttachmentDescription in renderPass (https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-VkFramebufferCreateInfo-pAttachments-00880)
ERROR: [Validation] Code 0 :  [ VUID_Undefined ] Object: VK_NULL_HANDLE (Type = 0) | vkCreateShaderModule: parameter pCreateInfo->codeSize must be greater than 0.
ERROR: [Validation] Code 0 :  [ UNASSIGNED-CoreValidation-Shader-InconsistentSpirv ] Object: VK_NULL_HANDLE (Type = 0) | SPIR-V module not valid: Invalid SPIR-V magic number.
Ошибка сегментирования (стек памяти сброшен на диск)

SEGFAULT.

example named context, show this output:

$ ./context
WARNING: radv is not a conformant vulkan implementation, testing use only.
WARNING: radv is not a conformant vulkan implementation, testing use only.
Vulkan Context Created
API Version:    1.1.107
Driver Version: 19.1.99
Device Name:    AMD RADV PITCAIRN (LLVM 8.0.0)
Device Type:    DiscreteGpu
Memory Heaps:  3
    Heap 0 flags { DeviceLocal } size 1 GB
    Heap 1 flags { DeviceLocal } size 256 MB
    Heap 2 flags {} size 3 GB

Memory Types:  4
    Type 0 flags { DeviceLocal } heap 0
    Type 1 flags { HostVisible | HostCoherent } heap 2
    Type 2 flags { DeviceLocal | HostVisible | HostCoherent } heap 1
    Type 3 flags { HostVisible | HostCoherent | HostCached } heap 2

Queues:

Queue Family: 0
    Queue Family Flags: { Graphics | Compute | Transfer | SparseBinding }
    Queue Count: 1

Queue Family: 1
    Queue Family Flags: { Compute | Transfer | SparseBinding }
    Queue Count: 2
Press enter to exit

vulkaninfo utility show attached output attachment: vulkaninfo.txt