mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-09-24 04:59:14 -07:00
dev-libs/rocm-opencl-runtime: Fix building with newer opencl-headers
Bug: https://bugs.gentoo.org/789717 Package-Manager: Portage-3.0.20, Repoman-3.0.3 Signed-off-by: Patrick Lauer <patrick@gentoo.org>
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
See bug #789717.
|
||||
|
||||
Once opencl-headers is upgraded to 3.0 or higher this package starts
|
||||
complaining left and right about missing header definitions for
|
||||
CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR. The correct header for this
|
||||
definiton did move as of opencl-headers 3.0 so this makes some sense.
|
||||
(Actually I suspect there is a header-guard mismatch behind this problem).
|
||||
|
||||
Most of this can be fixed by using -isystem instead of -I for the opencl
|
||||
headers. Although not terribly well documented, -isystem in lieu of -I
|
||||
comports with best practices for overriding 3rd-party header files in
|
||||
system include directories according to the gcc info pages. Why and how
|
||||
are apparently undocumented and appear to be somewhere inside the gcc
|
||||
fixincludes rabbit-hole.
|
||||
|
||||
This still leaves a similar issue compiling the amdocl files which
|
||||
is addressed here with an extra #include.
|
||||
|
||||
-gmt
|
||||
|
||||
diff -urpN ROCm-OpenCL-Runtime-rocm-4.1.0.orig/amdocl/CMakeLists.txt ROCm-OpenCL-Runtime-rocm-4.1.0/amdocl/CMakeLists.txt
|
||||
--- ROCm-OpenCL-Runtime-rocm-4.1.0.orig/amdocl/CMakeLists.txt 2021-06-26 14:52:32.446875129 -0700
|
||||
+++ ROCm-OpenCL-Runtime-rocm-4.1.0/amdocl/CMakeLists.txt 2021-06-26 15:00:30.401582470 -0700
|
||||
@@ -19,10 +19,10 @@ if(CMAKE_BUILD_TYPE MATCHES "^Debug$")
|
||||
add_definitions(-DDEBUG)
|
||||
endif()
|
||||
|
||||
-include_directories(${CMAKE_CURRENT_LIST_DIR}/..)
|
||||
-include_directories(${CMAKE_CURRENT_LIST_DIR}/../khronos)
|
||||
-include_directories(${CMAKE_CURRENT_LIST_DIR}/../khronos/headers)
|
||||
-include_directories(${CMAKE_CURRENT_LIST_DIR}/../khronos/headers/opencl2.2)
|
||||
+include_directories(SYSTEM ${CMAKE_CURRENT_LIST_DIR}/..)
|
||||
+include_directories(SYSTEM ${CMAKE_CURRENT_LIST_DIR}/../khronos)
|
||||
+include_directories(SYSTEM ${CMAKE_CURRENT_LIST_DIR}/../khronos/headers)
|
||||
+include_directories(SYSTEM ${CMAKE_CURRENT_LIST_DIR}/../khronos/headers/opencl2.2)
|
||||
include_directories(/usr/include/rocclr)
|
||||
include_directories(/usr/include/rocclr/compiler/lib/include/)
|
||||
include_directories(/usr/include/rocclr/elf/)
|
||||
diff -urpN ROCm-OpenCL-Runtime-rocm-4.1.0.orig/khronos/icd/CMakeLists.txt ROCm-OpenCL-Runtime-rocm-4.1.0/khronos/icd/CMakeLists.txt
|
||||
--- ROCm-OpenCL-Runtime-rocm-4.1.0.orig/khronos/icd/CMakeLists.txt 2021-06-26 14:52:32.445875109 -0700
|
||||
+++ ROCm-OpenCL-Runtime-rocm-4.1.0/khronos/icd/CMakeLists.txt 2021-06-26 14:59:01.600778554 -0700
|
||||
@@ -121,10 +121,10 @@ else()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
-include_directories (${OPENCL_ICD_LOADER_HEADERS_DIR})
|
||||
+include_directories (SYSTEM ${OPENCL_ICD_LOADER_HEADERS_DIR})
|
||||
add_definitions (-DCL_TARGET_OPENCL_VERSION=220)
|
||||
|
||||
-target_include_directories (OpenCL PRIVATE ${CMAKE_CURRENT_BINARY_DIR} loader)
|
||||
+target_include_directories (OpenCL SYSTEM PRIVATE ${CMAKE_CURRENT_BINARY_DIR} loader)
|
||||
target_link_libraries (OpenCL ${CMAKE_DL_LIBS})
|
||||
|
||||
include (CTest)
|
||||
diff -urpN ROCm-OpenCL-Runtime-rocm-4.1.0.orig/amdocl/cl_common.hpp ROCm-OpenCL-Runtime-rocm-4.1.0/amdocl/cl_common.hpp
|
||||
--- ROCm-OpenCL-Runtime-rocm-4.1.0.orig/amdocl/cl_common.hpp 2021-02-02 10:01:38.000000000 -0800
|
||||
+++ ROCm-OpenCL-Runtime-rocm-4.1.0/amdocl/cl_common.hpp 2021-06-26 15:40:57.584449532 -0700
|
||||
@@ -21,6 +21,7 @@
|
||||
#ifndef CL_COMMON_HPP_
|
||||
#define CL_COMMON_HPP_
|
||||
|
||||
+#include <CL/cl_gl_ext.h>
|
||||
#ifdef _WIN32
|
||||
#include <CL/cl_d3d11.h>
|
||||
#include <CL/cl_d3d10.h>
|
||||
@@ -36,6 +36,7 @@ PATCHES=(
|
||||
"${FILESDIR}/${PN}-3.5.0-do-not-install-libopencl.patch"
|
||||
"${FILESDIR}/${PN}-3.10.0-add-rocclr-include-directories.patch"
|
||||
"${FILESDIR}/${PN}-3.7.0-amdocl64icd.patch"
|
||||
"${FILESDIR}/${P}-opencl3-header.patch"
|
||||
)
|
||||
|
||||
src_prepare() {
|
||||
|
||||
Reference in New Issue
Block a user