GPUOpen-Tools / gpu_performance_api

GPU Performance API for AMD GPUs
MIT License
251 stars 46 forks source link

build error on Ubuntu 18.04.03 LTS #45

Closed pemgithub closed 3 years ago

pemgithub commented 5 years ago

I ran the following:

python PreBuild.py 
cd CMakeBuild/x64/debug
make

I get build errors including:

[ 73%] Linking CXX shared library ../../../../../Output/release/libGPUPerfAPIGL.so
[ 73%] Built target GPUPerfAPIGL
Scanning dependencies of target GPUPerfAPIVK
[ 73%] Building CXX object Src/GPUPerfAPIVk/CMakeFiles/GPUPerfAPIVK.dir/VkCommandListSwQueries.cpp.o
In file included from /home/pemgithub/pemCode/GPUOpen/GPA/Src/GPUPerfAPIVk/VkIncludes.h:19:0,
                 from /home/pemgithub/pemCode/GPUOpen/GPA/Src/GPUPerfAPIVk/VkSoftwareCountersResults.h:11,
                 from /home/pemgithub/pemCode/GPUOpen/GPA/Src/GPUPerfAPIVk/VkCommandListSWQueryGroup.h:12,
                 from /home/pemgithub/pemCode/GPUOpen/GPA/Src/GPUPerfAPIVk/VkCommandListSwQueries.h:13,
                 from /home/pemgithub/pemCode/GPUOpen/GPA/Src/GPUPerfAPIVk/VkCommandListSwQueries.cpp:9:
/home/pemgithub/pemCode/GPUOpen/GPA/../Common/Src/AmdVkExt/vk_amd_shader_core_properties2.h:59:16: error: redefinition of ‘struct VkPhysicalDeviceShaderCoreProperties2AMD’
 typedef struct VkPhysicalDeviceShaderCoreProperties2AMD {
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/vulkan/vulkan.h:21:0,
                 from /home/pemgithub/pemCode/GPUOpen/GPA/Src/GPUPerfAPIVk/VkIncludes.h:11,
                 from /home/pemgithub/pemCode/GPUOpen/GPA/Src/GPUPerfAPIVk/VkSoftwareCountersResults.h:11,
                 from /home/pemgithub/pemCode/GPUOpen/GPA/Src/GPUPerfAPIVk/VkCommandListSWQueryGroup.h:12,
                 from /home/pemgithub/pemCode/GPUOpen/GPA/Src/GPUPerfAPIVk/VkCommandListSwQueries.h:13,
                 from /home/pemgithub/pemCode/GPUOpen/GPA/Src/GPUPerfAPIVk/VkCommandListSwQueries.cpp:9:
/usr/include/vulkan/vulkan_core.h:9569:16: note: previous definition of ‘struct VkPhysicalDeviceShaderCoreProperties2AMD’
 typedef struct VkPhysicalDeviceShaderCoreProperties2AMD {
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/pemgithub/pemCode/GPUOpen/GPA/Src/GPUPerfAPIVk/VkIncludes.h:19:0,
                 from /home/pemgithub/pemCode/GPUOpen/GPA/Src/GPUPerfAPIVk/VkSoftwareCountersResults.h:11,
                 from /home/pemgithub/pemCode/GPUOpen/GPA/Src/GPUPerfAPIVk/VkCommandListSWQueryGroup.h:12,
                 from /home/pemgithub/pemCode/GPUOpen/GPA/Src/GPUPerfAPIVk/VkCommandListSwQueries.h:13,
                 from /home/pemgithub/pemCode/GPUOpen/GPA/Src/GPUPerfAPIVk/VkCommandListSwQueries.cpp:9:
/home/pemgithub/pemCode/GPUOpen/GPA/../Common/Src/AmdVkExt/vk_amd_shader_core_properties2.h:64:3: error: conflicting declaration ‘typedef int VkPhysicalDeviceShaderCoreProperties2AMD’
 } VkPhysicalDeviceShaderCoreProperties2AMD;
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/vulkan/vulkan.h:21:0,
                 from /home/pemgithub/pemCode/GPUOpen/GPA/Src/GPUPerfAPIVk/VkIncludes.h:11,
                 from /home/pemgithub/pemCode/GPUOpen/GPA/Src/GPUPerfAPIVk/VkSoftwareCountersResults.h:11,
                 from /home/pemgithub/pemCode/GPUOpen/GPA/Src/GPUPerfAPIVk/VkCommandListSWQueryGroup.h:12,
                 from /home/pemgithub/pemCode/GPUOpen/GPA/Src/GPUPerfAPIVk/VkCommandListSwQueries.h:13,
                 from /home/pemgithub/pemCode/GPUOpen/GPA/Src/GPUPerfAPIVk/VkCommandListSwQueries.cpp:9:
/usr/include/vulkan/vulkan_core.h:9574:3: note: previous declaration as ‘typedef struct VkPhysicalDeviceShaderCoreProperties2AMD VkPhysicalDeviceShaderCoreProperties2AMD’
 } VkPhysicalDeviceShaderCoreProperties2AMD;
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Src/GPUPerfAPIVk/CMakeFiles/GPUPerfAPIVK.dir/build.make:62: recipe for target 'Src/GPUPerfAPIVk/CMakeFiles/GPUPerfAPIVK.dir/VkCommandListSwQueries.cpp.o' failed
make[2]: *** [Src/GPUPerfAPIVk/CMakeFiles/GPUPerfAPIVK.dir/VkCommandListSwQueries.cpp.o] Error 1
CMakeFiles/Makefile2:420: recipe for target 'Src/GPUPerfAPIVk/CMakeFiles/GPUPerfAPIVK.dir/all' failed
make[1]: *** [Src/GPUPerfAPIVk/CMakeFiles/GPUPerfAPIVK.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
pemgithub commented 5 years ago

My issue was an incompatibility with the latest Vulkan SDK on Ubuntu 18.04.03 LTS.

GPUOpen/GPA/Src/GPUPerfAPIVk/VkIncludes.h includes <vulkan/vulkan.h> and . GPUOpen/Common/Src/AmdVkExt/vk_amd_shader_core_properties2.h defines struct VkPhysicalDeviceShaderCoreProperties2AMD. However, struct VkPhysicalDeviceShaderCoreProperties2AMD is already defined in /usr/include/vulkan/vulkan_core.h (from Vulkan SDK).

As a workaround, I commented out VkPhysicalDeviceShaderCoreProperties2AMD definition in vk_amd_shader_core_properties2.h. From vk_amd_shader_core_properties2.h:

* @brief Temporary internal header for shader core properties2. Should be removed once the extension is published
*        and the API gets included in the official Vulkan header.
PLohrmannAMD commented 3 years ago

Thank you for reporting this issue. It was resolved in GPA v3.5 released in December 2019.