KhronosGroup / KTX-Software

KTX (Khronos Texture) Library and Tools
Other
877 stars 229 forks source link

Error compiling VulkanAppSDL #159

Closed lorenko closed 4 years ago

lorenko commented 4 years ago

Hi, I get a lot of error compiling VulkanAppSDL. I'm using linux Manjaro with gcc 9.

here a little example:

In file included from /usr/include/c++/9.2.0/vector:67, from KTX-Software-3.0/tests/loadtests/appfwSDL/VulkanAppSDL/VulkanAppSDL.h:26, from KTX-Software-3.0/tests/loadtests/appfwSDL/VulkanAppSDL/VulkanAppSDL.cpp:45: /usr/include/c++/9.2.0/bits/stl_vector.h: In instantiation of ‘struct std::_Vector_base<vk::PhysicalDevice, unsigned int>’: /usr/include/c++/9.2.0/bits/stl_vector.h:386:11: required from ‘class std::vector<vk::PhysicalDevice, unsigned int>’ /home/lorenko/Scaricati/KTX-Software-3.0/tests/loadtests/appfwSDL/VulkanAppSDL/VulkanAppSDL.cpp:601:66: required from here /usr/include/c++/9.2.0/bits/stl_vector.h:84:21: error: ‘unsigned int’ is not a class, struct, or union type 84 | rebind<_Tp>::other _Tp_alloc_type; | ^~~~~~ /usr/include/c++/9.2.0/bits/stl_vector.h:86:9: error: ‘unsigned int’ is not a class, struct, or union type 86 | pointer; | ^~~ /usr/include/c++/9.2.0/bits/stl_vector.h: In instantiation of ‘class std::vector<vk::PhysicalDevice, unsigned int>’: KTX-Software-3.0/tests/loadtests/appfwSDL/VulkanAppSDL/VulkanAppSDL.cpp:601:66: required from here /usr/include/c++/9.2.0/bits/stl_vector.h:387:5: error: ‘unsigned int’ is not a class, struct, or union type 387 | { | ^ /usr/include/c++/9.2.0/bits/stl_vector.h:471:20: error: no members matching ‘std::vector<vk::PhysicalDevice, unsigned int>::_Base {aka std::_Vector_base<vk::PhysicalDevice, unsigned int>}::_M_allocate’ in ‘std::vector<vk::PhysicalDevice, unsigned int>::_Base’ {aka ‘struct std::_Vector_base<vk::PhysicalDevice, unsigned int>’} 471 | using _Base::_M_allocate; | ^~~ /usr/include/c++/9.2.0/bits/stl_vector.h:472:20: error: no members matching ‘std::vector<vk::PhysicalDevice, unsigned int>::_Base {aka std::_Vector_base<vk::PhysicalDevice, unsigned int>}::_M_deallocate’ in ‘std::vector<vk::PhysicalDevice, unsigned int>::_Base’ {aka ‘struct std::_Vector_base<vk::PhysicalDevice, unsigned int>’}

and so on...

MarkCallow commented 4 years ago

Is this in master or ktx2?

Are you using the cmake files in build/cmake/linux?

This all builds fine on Ubuntu Bionic using those cmake files. I'll have to boot up my Ubuntu system and check which gcc version I have. I don't have Manjaro linux available. Is there anyway you can narrow down the problem?

lorenko commented 4 years ago

Hi,

in master

gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --man dir=/usr/share/man --infodir=/usr/share/info --with-bugurl= https://bugs.archlinux.org/ --enable-languages =c,c++,ada,fortran,go,lto,objc,obj-c++,d --enable-shared --enable-threads=posix --with-system-zlib --with -isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch -- disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable- install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --enable-multilib --disable -werror --enable-checking=release --enable-default-pie --enable-default-ssp --enable-cet=auto gdc_include _dir=/usr/include/dlang/gdc Thread model: posix gcc version 9.2.0 (GCC)

Il giorno ven 27 dic 2019 alle ore 17:59 Mark Callow < notifications@github.com> ha scritto:

Is this in master or ktx2?

Are you using the cmake files in build/cmake/linux?

This all builds fine on Ubuntu Bionic using those cmake files. I'll have to boot up my Ubuntu system and check which gcc version I have. I don't have Manjaro linux available. Is there anyway you can narrow down the problem?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/KhronosGroup/KTX-Software/issues/159?email_source=notifications&email_token=AIDJYTZ4BXSN4ZHNPBB4CR3Q2YX6FA5CNFSM4J73ZDO2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHXO5TA#issuecomment-569306828, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIDJYT5LZC7BL7NFAAHHR53Q2YX6FANCNFSM4J73ZDOQ .

lorenko commented 4 years ago

the dir is KTX-Software/build/cmake/linux/Debug/

MarkCallow commented 4 years ago

That's the right dir. I have gcc 7.4 on my Ubuntu system. I wonder if I can install 9.2.

This is the only std:vector usage with vk::PhysicalDevice that I can see

        std::vector<vk::PhysicalDevice> gpus;

and there is no unsigned int* in it so I don't understand the error.

What version of the Vulkan SDK you have installed in Manjaro?

lorenko commented 4 years ago

OK I'm posting all output:

[ 32%] Building CXX object CMakeFiles/appfwSDL.dir/home/lorenko/progetti/KTX-Software/tests/loadtests/appfwSDL/VulkanAppSDL/VulkanAppSDL.o In file included from /usr/include/c++/9.2.0/vector:67, from /home/lorenko/progetti/KTX-Software/tests/loadtests/appfwSDL/VulkanAppSDL/VulkanAppSDL.h:26, from /home/lorenko/progetti/KTX-Software/tests/loadtests/appfwSDL/VulkanAppSDL/VulkanAppSDL.cpp:45: /usr/include/c++/9.2.0/bits/stl_vector.h: In instantiation of ‘struct std::_Vector_base<vk::PhysicalDevice, unsigned int>’: /usr/include/c++/9.2.0/bits/stl_vector.h:386:11: required from ‘class std::vector<vk::PhysicalDevice, unsigned int>’ /home/lorenko/progetti/KTX-Software/tests/loadtests/appfwSDL/VulkanAppSDL/VulkanAppSDL.cpp:601:66: required from here /usr/include/c++/9.2.0/bits/stl_vector.h:84:21: error: ‘unsigned int*’ is not a class, struct, or union type 84 rebind<_Tp>::other _Tp_alloc_type; ^~~~~~ /usr/include/c++/9.2.0/bits/stl_vector.h:86:9: error: ‘unsigned int*’ is not a class, struct, or union type 86 pointer; ^~~ /usr/include/c++/9.2.0/bits/stl_vector.h: In instantiation of ‘class std::vector<vk::PhysicalDevice, unsigned int>’: /home/lorenko/progetti/KTX-Software/tests/loadtests/appfwSDL/VulkanAppSDL/VulkanAppSDL.cpp:601:66: required from here /usr/include/c++/9.2.0/bits/stl_vector.h:387:5: error: ‘unsigned int’ is not a class, struct, or union type 387 { ^ /usr/include/c++/9.2.0/bits/stl_vector.h:471:20: error: no members matching ‘std::vector<vk::PhysicalDevice, unsigned int>::_Base {aka std::_Vector_base<vk::PhysicalDevice, unsigned int>}::_M_allocate’ in ‘std::vector<vk::PhysicalDevice, unsigned int>::_Base’ {aka ‘struct std::_Vector_base<vk::PhysicalDevice, unsigned int>’} 471 using _Base::_M_allocate; ^~~ /usr/include/c++/9.2.0/bits/stl_vector.h:472:20: error: no members matching ‘std::vector<vk::PhysicalDevice, unsigned int>::_Base {aka std::_Vector_base<vk::PhysicalDevice, unsigned int>}::_M_deallocate’ in ‘std::vector<vk::PhysicalDevice, unsigned int>::_Base’ {aka ‘struct std::_Vector_base<vk::PhysicalDevice, unsigned int>’} 472 using _Base::_M_deallocate; ^~~~~ /usr/include/c++/9.2.0/bits/stl_vector.h:474:20: error: no members matching ‘std::vector<vk::PhysicalDevice, unsigned int>::_Base {aka std::_Vector_base<vk::PhysicalDevice, unsigned int>}::_M_get_Tp_allocator’ in ‘std::vector<vk::PhysicalDevice, unsigned int>::_Base’ {aka ‘struct std::_Vector_base<vk::PhysicalDevice, unsigned int>’} 474 using _Base::_M_get_Tp_allocator; ^~~~~~~ /home/lorenko/progetti/KTX-Software/tests/loadtests/appfwSDL/VulkanAppSDL/VulkanAppSDL.cpp: In member function ‘bool VulkanAppSDL::findGpu()’: /home/lorenko/progetti/KTX-Software/tests/loadtests/appfwSDL/VulkanAppSDL/VulkanAppSDL.cpp:601:50: error: cannot convert ‘vk::ResultValueType<std::vector<vk::PhysicalDevice, unsigned int> >::type’ {aka ‘std::vector<vk::PhysicalDevice, unsigned int>’} to ‘vk::Result’ in assignment 601 err = vkctx.instance.enumeratePhysicalDevices(&gpuCount, NULL); ~~~~~~~~~^~~~~~~
vk::ResultValueType<std::vector<vk::PhysicalDevice, unsigned int> >::type {aka std::vector<vk::PhysicalDevice, unsigned int>}

/home/lorenko/progetti/KTX-Software/tests/loadtests/appfwSDL/VulkanAppSDL/VulkanAppSDL.cpp: In member function ‘bool VulkanAppSDL::createDevice()’: /home/lorenko/progetti/KTX-Software/tests/loadtests/appfwSDL/VulkanAppSDL/VulkanAppSDL.cpp:727:60: error: call of overloaded ‘enumerateDeviceExtensionProperties(NULL, uint32_t, NULL)’ is ambiguous 727 | NULL); | ^ In file included from /home/lorenko/progetti/KTX-Software/tests/loadtests/appfwSDL/VulkanAppSDL/VulkanAppSDL.h:27, from /home/lorenko/progetti/KTX-Software/tests/loadtests/appfwSDL/VulkanAppSDL/VulkanAppSDL.cpp:45: //home/lorenko/vulkansdk/x86_64/include/vulkan/vulkan.hpp:71626:28: note: candidate: ‘vk::Result vk::PhysicalDevice::enumerateDeviceExtensionProperties(const char, uint32_t, vk::ExtensionProperties, const Dispatch&) const [with Dispatch = vk::DispatchLoaderStatic; uint32_t = unsigned int]’ 71626 | VULKAN_HPP_INLINE Result PhysicalDevice::enumerateDeviceExtensionProperties( const char pLayerName, uint32_t pPropertyCount, vk::ExtensionProperties pProperties, Dispatch const &d) const | ^~~~~~ //home/lorenko/vulkansdk/x86_64/include/vulkan/vulkan.hpp:71654:96: note: candidate: ‘typename vk::ResultValueType<std::vector<vk::ExtensionProperties, Allocator> >::type vk::PhysicalDevice::enumerateDeviceExtensionProperties(vk::Optional<const std::__cxx11::basic_string >, const Allocator&, const Dispatch&) const [with Allocator = unsigned int; Dispatch = long int; typename vk::ResultValueType<std::vector<vk::ExtensionProperties, Allocator> >::type = std::vector<vk::ExtensionProperties, unsigned int*>]’ 71654 | HPP_INLINE typename ResultValueType<std::vector<ExtensionProperties,Allocator>>::type PhysicalDevice::enumerateDeviceExtensionProperties( Optional layerName, Allocator const& vectorAllocator, Dispatch const &d ) const | ^~~~~~

//home/lorenko/vulkansdk/x86_64/include/vulkan/vulkan.hpp: In instantiation of ‘typename vk::ResultValueType<std::vector<vk::PhysicalDevice, Allocator> >::type vk::Instance::enumeratePhysicalDevices(const Allocator&, const Dispatch&) const [with Allocator = unsigned int; Dispatch = long int; typename vk::ResultValueType<std::vector<vk::PhysicalDevice, Allocator> >::type = std::vector<vk::PhysicalDevice, unsigned int>]’: /home/lorenko/progetti/KTX-Software/tests/loadtests/appfwSDL/VulkanAppSDL/VulkanAppSDL.cpp:601:66: required from here //home/lorenko/vulkansdk/x86_64/include/vulkan/vulkan.hpp:71525:39: error: request for member ‘vkEnumeratePhysicalDevices’ in ‘d’, which is of non-class type ‘const long int’ 71525 | result = static_cast( d.vkEnumeratePhysicalDevices( m_instance, &physicalDeviceCount, nullptr ) ); | ^~~~~~~~ //home/lorenko/vulkansdk/x86_64/include/vulkan/vulkan.hpp:71529:41: error: request for member ‘vkEnumeratePhysicalDevices’ in ‘d’, which is of non-class type ‘const long int’ 71529 | result = static_cast( d.vkEnumeratePhysicalDevices( m_instance, &physicalDeviceCount, reinterpret_cast<VkPhysicalDevice*>( physicalDevices.data() ) ) );

  |                                       ~~^~~~~~~~~~~~~~~~~~~~~~~~~~

In file included from /usr/include/c++/9.2.0/vector:67, from /home/lorenko/progetti/KTX-Software/tests/loadtests/appfwSDL/VulkanAppSDL/VulkanAppSDL.h:26, from /home/lorenko/progetti/KTX-Software/tests/loadtests/appfwSDL/VulkanAppSDL/VulkanAppSDL.cpp:45: /usr/include/c++/9.2.0/bits/stl_vector.h: In instantiation of ‘std::vector<_Tp, _Alloc>::~vector() [with _Tp = vk::PhysicalDevice; _Alloc = unsigned int]’: /home/lorenko/progetti/KTX-Software/tests/loadtests/appfwSDL/VulkanAppSDL/VulkanAppSDL.cpp:601:66: required from here /usr/include/c++/9.2.0/bits/stl_vector.h:677:30: error: ‘struct std::_Vector_base<vk::PhysicalDevice, unsigned int>::_Vector_impl’ has no member named ‘_M_start’ 677 | std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish, | ~~~~^~ /usr/include/c++/9.2.0/bits/stl_vector.h:677:54: error: ‘struct std::_Vector_base<vk::PhysicalDevice, unsigned int>::_Vector_impl’ has no member named ‘_M_finish’ 677 | std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish, | ~~~~^~~ /usr/include/c++/9.2.0/bits/stl_vector.h:678:28: error: ‘_M_get_Tp_allocator’ was not declared in this scope; did you mean ‘get_allocator’? 678 | _M_get_Tp_allocator()); | ~~~~~~~^~ | get_allocator /usr/include/c++/9.2.0/bits/stl_vector.h: In instantiation of ‘std::_Vector_base<_Tp, _Alloc>::_Vector_base(const allocator_type&) [with _Tp = vk::PhysicalDevice; _Alloc = unsigned int; std::_Vector_base<_Tp, _Alloc>::allocator_type = unsigned int]’: /usr/include/c++/9.2.0/bits/stl_vector.h:495:18: required from ‘std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = vk::PhysicalDevice; _Alloc = unsigned int; std::vector<_Tp, _Alloc>::allocator_type = unsigned int]’ //home/lorenko/vulkansdk/x86_64/include/vulkan/vulkan.hpp:71520:43: required from ‘typename vk::ResultValueType<std::vector<vk::PhysicalDevice, Allocator> >::type vk::Instance::enumeratePhysicalDevices(const Allocator&, const Dispatch&) const [with Allocator = unsigned int; Dispatch = long int; typename vk::ResultValueType<std::vector<vk::PhysicalDevice, Allocator> >::type = std::vector<vk::PhysicalDevice, unsigned int>]’ /home/lorenko/progetti/KTX-Software/tests/loadtests/appfwSDL/VulkanAppSDL/VulkanAppSDL.cpp:601:66: required from here /usr/include/c++/9.2.0/bits/stl_vector.h:291:20: error: no matching function for call to ‘std::_Vector_base<vk::PhysicalDevice, unsigned int>::_Vector_impl::_Vector_impl(unsigned int const&)’ 291 | : _M_impl(__a) { } | ^ /usr/include/c++/9.2.0/bits/stl_vector.h:140:2: note: candidate: ‘std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_Vector_impl(std::_Vector_base<_Tp, _Alloc>::_Vector_impl&&) [with _Tp = vk::PhysicalDevice; _Alloc = unsigned int]’ 140 | _Vector_impl(_Vector_impl&& x) noexcept | ^~~~ /usr/include/c++/9.2.0/bits/stl_vector.h:140:30: note: no known conversion for argument 1 from ‘const allocator_type’ {aka ‘unsigned int const’} to ‘std::_Vector_base<vk::PhysicalDevice, unsigned int>::_Vector_impl&&’ 140 | _Vector_impl(_Vector_impl&& x) noexcept | ~~~^~~ /usr/include/c++/9.2.0/bits/stl_vector.h:128:2: note: candidate: ‘std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_Vector_impl() [with _Tp = vk::PhysicalDevice; _Alloc = unsigned int*]’ 128 | _Vector_impl() _GLIBCXX_NOEXCEPT_IF( | ^~~~ /usr/include/c++/9.2.0/bits/stl_vector.h:128:2: note: candidate expects 0 arguments, 1 provided make[2]: [CMakeFiles/appfwSDL.dir/build.make:102: CMakeFiles/appfwSDL.dir/home/lorenko/progetti/KTX-Software/tests/loadtests/appfwSDL/VulkanAppSDL/VulkanAppSDL.o] Error 1 make[1]: [CMakeFiles/Makefile2:766: CMakeFiles/appfwSDL.dir/all] Error 2 make: *** [Makefile:84: all] Error 2

vulkan SDK version is:

VULKANINFO

Vulkan Instance Version: 1.1.126

justinian-balaskas commented 4 years ago

Bump? Same issue. I'll try the ktx2 branch.

Edit: No dice, same issue.

MarkCallow commented 4 years ago

Sorry, I haven't had time to investigate. The problem may be related to using a later version of the Vulkan SDK & vullkan.hpp than is in Bionic and not to gcc 9.2. I'll try to look at this soon.

MarkCallow commented 4 years ago

I've just pushed commit #91f6b69 to master that might fix this issue. Please give it a try and report back. I do not have a more recent compiler to try nor a more recent Vulkan SDK hence my request.

lorenko commented 4 years ago

Thank you very much for your kindly reply, cannot reproduce for some days. I-ll do as soon as possible. thx

Il giorno mar 4 feb 2020 alle ore 10:00 Mark Callow < notifications@github.com> ha scritto:

I've just pushed commit #91f6b69 to master that might fix this issue. Please give it a try and report back. I do not have a more recent compiler to try nor a more recent Vulkan SDK hence my request.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/KhronosGroup/KTX-Software/issues/159?email_source=notifications&email_token=AIDJYT6SADU2GRVNO3BWE4LRBEVDTA5CNFSM4J73ZDO2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKW2ZPQ#issuecomment-581807294, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIDJYT3H2O2DB74CEPRGIEDRBEVDTANCNFSM4J73ZDOQ .

MarkCallow commented 4 years ago

Ping. Please try the latest code.

lorenko commented 4 years ago

Sorry, I'm not at home this is my last:

[ 43%] Built target testimages [ 50%] Built target vkloadtestsfrag2spirv [ 52%] Built target vkloadtestscopies [ 60%] Built target vkloadtests__vert2spirv [ 61%] Linking CXX executable vkloadtests /usr/bin/ld:/home/lorenko/progetti/KTX-Software/build/cmake/linux/Debug/../../../../other_lib/linux/Debug-x64/libSDL2-2.0.so: file format not recognized; treating as linker script /usr/bin/ld:/home/lorenko/progetti/KTX-Software/build/cmake/linux/Debug/../../../../other_lib/linux/Debug-x64/libSDL2-2.0.so:1: syntax error collect2: error: ld returned 1 exit status make[2]: [CMakeFiles/vkloadtests.dir/build.make:236: vkloadtests] Error 1 make[1]: [CMakeFiles/Makefile2:158: CMakeFiles/vkloadtests.dir/all] Error 2 make: *** [Makefile:84: all] Error 2

MarkCallow commented 4 years ago

Thank you @lorenko.

I think this problem is because you either haven't installed or haven't initialized git lfs so the linker is seeing the text stubs rather than the binary file. The good news is that, in getting this far, it has passed the compilation stage so the commit does fix the original problem.

You can install Git LFS from here. After install and init you will need to do git lfs checkout other_lib in order to retrieve the binaries. After this a regular git checkout is sufficient.

lorenko commented 4 years ago

you are right, thank you very much

Il giorno mar 11 feb 2020 alle ore 02:14 Mark Callow < notifications@github.com> ha scritto:

Thank you @lorenko https://github.com/lorenko.

I think this problem is because you either haven't installed or haven't initialized git lfs so the linker is seeing the text stubs rather than the binary file. The good news is that, in getting this far, it has passed the compilation stage so the commit does fix the original problem.

You can install Git LFS from here https://github.com/github/git-lfs. After install and init you will need to do git lfs checkout other_lib in order to retrieve the binaries. After this a regular git checkout` is sufficient.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/KhronosGroup/KTX-Software/issues/159?email_source=notifications&email_token=AIDJYT2CC7BAPLZV37QS3J3RCH3YDA5CNFSM4J73ZDO2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELK47TI#issuecomment-584437709, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIDJYTZXOVZQE6SXBK3FL73RCH3YDANCNFSM4J73ZDOQ .

MarkCallow commented 4 years ago

Fixed by 91f6b69 (master) and f3c2743 (ktx).