All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v4 0/7] Adding RustiCL
@ 2024-02-02  9:36 Antoine Coutant
  2024-02-02  9:36 ` [Buildroot] [PATCH v4 1/7] package/meson: bump version to 1.3.1 Antoine Coutant
                   ` (6 more replies)
  0 siblings, 7 replies; 22+ messages in thread
From: Antoine Coutant @ 2024-02-02  9:36 UTC (permalink / raw)
  To: buildroot; +Cc: sebastian.weyer, Antoine Coutant, bernd, romain.naour

RustiCL requires meson >= 1.2.1 and will soon require meson >= 1.3.1
(when mesa will be upgraded to version 24.0.x). The problems that
appeared with host-qemu don't exist anymore. So, I think that meson
must be upgraded.

While testing RustiCL on the khadas vim3, I encountered a problem
with mesa clc cross-compilation and made a merge request that just
got accepted. The 3 added patches are from this MR.
(https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25568.)  

This new version of the patch series changes the way OpenCL is
selected. When an implementation is available (Clover or Rusticl),
a menuconfig appears. Then, it is possible to select Clover and/or
RustiCL. Both can be selected at the same time thanks to
OpenCL-ICD-Loader.

RusitCL have been tested on the khadas vim 3. Using
“khadas_vim3_defconfig” with bootlin toolchain
“aarch64 glibc bleeding-edge 2023.11-1”.

I hope that this series will be merged during the FOSDEM buildroot
meeting. Indeed, I'm not sure that I will have time to work on
this after the 5th of march.

Also, I wrote an article in French to explain how RustiCL works.
It can allow (French speakers) to understand what it does and why
it requires its dependencies.
https://www.linuxembedded.fr/2024/01/introduction-a-opencl-et-rusticl 

Antoine Coutant (2):
  package/meson: bump version to 1.3.1
  package/llvm-project: add opencl-c-base.h on target

Romain Naour (3):
  package/pkg-meson.mk: add rust cross-compiler support
  package/spirv-llvm-translator: add target variant to provide
    LLVMSPIRVLib
  package/mesa3d: add RustiCL support

Sebastian Weyer (2):
  package/opencl-headers: new package
  package/opencl-icd-loader: new package

 DEVELOPERS                                    |  2 +
 package/Config.in                             |  3 +
 package/llvm-project/clang/clang.mk           |  9 ++
 ...ncl-external-clang-headers-option-an.patch | 72 ++++++++++++++++
 ...or-every-user-when-using-shared-LLVM.patch | 40 +++++++++
 ...lc-retrieve-libclang-path-at-runtime.patch | 86 +++++++++++++++++++
 package/mesa3d/Config.in                      | 50 +++++++++--
 package/mesa3d/mesa3d.mk                      | 18 +++-
 ...dencies-base.py-add-pkg_config_stati.patch | 29 ++++---
 package/meson/meson.hash                      |  4 +-
 package/meson/meson.mk                        |  2 +-
 package/opencl-headers/Config.in              |  7 ++
 package/opencl-headers/opencl-headers.hash    |  3 +
 package/opencl-headers/opencl-headers.mk      | 22 +++++
 package/opencl-icd-loader/Config.in           | 12 +++
 .../opencl-icd-loader/opencl-icd-loader.hash  |  3 +
 .../opencl-icd-loader/opencl-icd-loader.mk    | 19 ++++
 package/pkg-meson.mk                          | 13 +++
 package/spirv-llvm-translator/Config.in       | 22 +++++
 .../spirv-llvm-translator.mk                  | 12 ++-
 support/misc/cross-compilation.conf.in        |  4 +-
 21 files changed, 406 insertions(+), 26 deletions(-)
 create mode 100644 package/mesa3d/0006-meson-remove-opencl-external-clang-headers-option-an.patch
 create mode 100644 package/mesa3d/0007-clc-force-fPIC-for-every-user-when-using-shared-LLVM.patch
 create mode 100644 package/mesa3d/0008-clc-retrieve-libclang-path-at-runtime.patch
 create mode 100644 package/opencl-headers/Config.in
 create mode 100644 package/opencl-headers/opencl-headers.hash
 create mode 100644 package/opencl-headers/opencl-headers.mk
 create mode 100644 package/opencl-icd-loader/Config.in
 create mode 100644 package/opencl-icd-loader/opencl-icd-loader.hash
 create mode 100644 package/opencl-icd-loader/opencl-icd-loader.mk
 create mode 100644 package/spirv-llvm-translator/Config.in

-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [Buildroot] [PATCH v4 1/7] package/meson: bump version to 1.3.1
  2024-02-02  9:36 [Buildroot] [PATCH v4 0/7] Adding RustiCL Antoine Coutant
@ 2024-02-02  9:36 ` Antoine Coutant
  2024-02-07 15:23   ` Yann E. MORIN
  2024-02-07 15:30   ` Yann E. MORIN
  2024-02-02  9:36 ` [Buildroot] [PATCH v4 2/7] package/pkg-meson.mk: add rust cross-compiler support Antoine Coutant
                   ` (5 subsequent siblings)
  6 siblings, 2 replies; 22+ messages in thread
From: Antoine Coutant @ 2024-02-02  9:36 UTC (permalink / raw)
  To: buildroot; +Cc: sebastian.weyer, Antoine Coutant, bernd, romain.naour

The meson upgrade from 1.1.1 to 1.2.0 have been reverted
because host-qemu (version v8.0.3) was searching
libraries in the build machine instead of buildroot host
directory [1].
$ grep -r LINK_ARGS  * | grep "\-L/usr"
build.ninja: LINK_ARGS =
    -L/usr/lib/gcc/x86_64-linux-gnu/10 \
    -L/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu \
    -L/usr/lib/gcc/x86_64-linux-gnu/10/../../../../lib -L/usr/lib \
    -L/lib/x86_64-linux-gnu \
    -L/lib/../lib \
    -L/usr/lib/../lib \
    -L/usr/lib/gcc/x86_64-linux-gnu/10/../../.. \
    -L/lib \
    -I/[...]/host/include \
    -L/[...]/host/lib \
    -I/[...]/host/include/libfdt \
    ...

Upgrading qemu to version v8.1.0 solves the problem:
$ grep -r LINK_ARGS  * | grep "\-L/usr"
build.ninja: LINK_ARGS =
    -I/[...]/host/include \
    -L/[...]/host/lib \
    -I/[...]/host/include/libfdt \
    ...

Those two tests were done with the same buildroot version
(2023.08) on the same machine were the bug appeared. Using,
git bisect, in this environment, it was found that the
problem was fixed in qemu by the commit [2].

Thus, it is possible that the problem was introduced by
improper use of meson by qemu <= v8.0.3. Also, meson has
been updated to version 1.2.1 and 1.3.0 in yocto and it
doesn't seem to create any issue. [3]

The original problem is no longer present and some
projects require meson > 1.1.1 (e.g. rusticl requires
meson 1.2.0 since mesa 23.3.0 and meson 1.3.1 since mesa
24.0.0).

"pkgconfig" field is deprecated by meson 1.3.0 and
replaced by "pkg-config". See: [4]

The patch that adds the pkg_config_static property has
been rebased.

[1] https://gitlab.com/buildroot.org/buildroot/-/commit/acfdf21f0b752e844a33c70a0fd2f82f4534a5a0
[2] https://gitlab.com/qemu-project/qemu/-/commit/Fc9a809e0d28417fa1e7f7efc19f845bda4c1be9
[3] https://github.com/yoctoproject/poky/commits/master/meta/recipes-devtools/meson
[4] https://mesonbuild.com/Release-notes-for-1-3-0.html#machine-files-pkgconfig-field-deprecated-and-replaced-by-pkgconfig

Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
---
Changes v3 -> v4:
	- cross-compilation.conf.in have been changed.
	- Bump version from 1.3.0 to 1.3.1.

Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
---
 ...dencies-base.py-add-pkg_config_stati.patch | 29 ++++++++++---------
 package/meson/meson.hash                      |  4 +--
 package/meson/meson.mk                        |  2 +-
 support/misc/cross-compilation.conf.in        |  2 +-
 4 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/package/meson/0002-mesonbuild-dependencies-base.py-add-pkg_config_stati.patch b/package/meson/0002-mesonbuild-dependencies-base.py-add-pkg_config_stati.patch
index 8e15d3210c..49a0ef93dc 100644
--- a/package/meson/0002-mesonbuild-dependencies-base.py-add-pkg_config_stati.patch
+++ b/package/meson/0002-mesonbuild-dependencies-base.py-add-pkg_config_stati.patch
@@ -1,4 +1,4 @@
-From 3d6a2db2270346236dd6247e0648ea0c949ba468 Mon Sep 17 00:00:00 2001
+From 59934e2116e025ecfe23baf6febc4a0eb85f60cd Mon Sep 17 00:00:00 2001
 From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
 Date: Sat, 15 Feb 2020 15:13:59 +0100
 Subject: [PATCH] mesonbuild/dependencies/base.py: add pkg_config_static
@@ -20,24 +20,25 @@ Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
 Signed-off-by: Romain Naour <romain.naour@gmail.com>
 [Rebased on 0.57.1]
 Signed-off-by: Peter Seiderer <ps.report@gmx.net>
+[rebased on 1.3.0]
+Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
 ---
- mesonbuild/dependencies/pkgconfig.py | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
+ mesonbuild/dependencies/pkgconfig.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/mesonbuild/dependencies/pkgconfig.py b/mesonbuild/dependencies/pkgconfig.py
-index 1e8d9132e..d902ba215 100644
+index e86206b88..94888657d 100644
 --- a/mesonbuild/dependencies/pkgconfig.py
 +++ b/mesonbuild/dependencies/pkgconfig.py
-@@ -338,7 +338,8 @@ class PkgConfigDependency(ExternalDependency):
-         env = None
-         libcmd = ['--libs']
- 
--        if self.static:
-+        if self.static or \
-+            (self.env.properties[self.for_machine].get('pkg_config_static', None) == 'true'):
-             libcmd.append('--static')
- 
-         libcmd.append(self.name)
+@@ -169,7 +169,7 @@ class PkgConfigCLI(PkgConfigInterface):
+             env['PKG_CONFIG_ALLOW_SYSTEM_LIBS'] = '1'
+         args: T.List[str] = []
+         args += self._define_variable_args(define_variable)
+-        if static:
++        if static or (self.env.properties[self.for_machine].get('pkg_config_static', None) == 'true'):
+             args.append('--static')
+         args += ['--libs', name]
+         ret, out, err = self._call_pkgbin(args, env=env)
 -- 
 2.25.1
 
diff --git a/package/meson/meson.hash b/package/meson/meson.hash
index cb36b674fa..150fd6d1bb 100644
--- a/package/meson/meson.hash
+++ b/package/meson/meson.hash
@@ -1,4 +1,4 @@
 # Locally calculated after checking pgp signature
-# https://github.com/mesonbuild/meson/releases/download/1.1.1/meson-1.1.1.tar.gz.asc
-sha256  d04b541f97ca439fb82fab7d0d480988be4bd4e62563a5ca35fadb5400727b1c  meson-1.1.1.tar.gz
+# https://github.com/mesonbuild/meson/releases/download/1.3.1/meson-1.3.1.tar.gz.asc
+sha256  6020568bdede1643d4fb41e28215be38eff5d52da28ac7d125457c59e0032ad7  meson-1.3.1.tar.gz
 sha256  cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30  COPYING
diff --git a/package/meson/meson.mk b/package/meson/meson.mk
index 503aca8c25..467569d28b 100644
--- a/package/meson/meson.mk
+++ b/package/meson/meson.mk
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-MESON_VERSION = 1.1.1
+MESON_VERSION = 1.3.1
 MESON_SITE = https://github.com/mesonbuild/meson/releases/download/$(MESON_VERSION)
 MESON_LICENSE = Apache-2.0
 MESON_LICENSE_FILES = COPYING
diff --git a/support/misc/cross-compilation.conf.in b/support/misc/cross-compilation.conf.in
index 7053df472b..a58ab553d0 100644
--- a/support/misc/cross-compilation.conf.in
+++ b/support/misc/cross-compilation.conf.in
@@ -10,7 +10,7 @@ ar = '@TARGET_AR@'
 strip = '@TARGET_STRIP@'
 cmake = '@BR2_CMAKE@'
 fortran = '@TARGET_FC@'
-pkgconfig = '@PKGCONF_HOST_BINARY@'
+pkg-config = '@PKGCONF_HOST_BINARY@'
 g-ir-compiler = '@STAGING_DIR@/usr/bin/g-ir-compiler'
 g-ir-scanner = '@STAGING_DIR@/usr/bin/g-ir-scanner'
 
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [Buildroot] [PATCH v4 2/7] package/pkg-meson.mk: add rust cross-compiler support
  2024-02-02  9:36 [Buildroot] [PATCH v4 0/7] Adding RustiCL Antoine Coutant
  2024-02-02  9:36 ` [Buildroot] [PATCH v4 1/7] package/meson: bump version to 1.3.1 Antoine Coutant
@ 2024-02-02  9:36 ` Antoine Coutant
  2024-02-07 15:13   ` Yann E. MORIN
  2024-02-02  9:36 ` [Buildroot] [PATCH v4 3/7] package/spirv-llvm-translator: add target variant to provide LLVMSPIRVLib Antoine Coutant
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 22+ messages in thread
From: Antoine Coutant @ 2024-02-02  9:36 UTC (permalink / raw)
  To: buildroot; +Cc: sebastian.weyer, Antoine Coutant, bernd, romain.naour

From: Romain Naour <romain.naour@smile.fr>

This change is needed to be able to build target packages requiring
rust. If a package has rust in its project or in an add_language()
call in their meson.build file, meson will try to find a suitable
compiler for this language[1]. If the language is classified as
required but not found, it will abort the build.

It is necessary to specify rust and rust_ld separately in
support/misc/cross-compilation.conf.in. If you specify it in one line
just as "rust", it will generate the following warning:
    WARNING: Please do not put -C linker= in your compiler command,
    set rust_ld=command in your cross file or use the RUST_LD environment
    variable, otherwise meson will override your selection.

[1] https://mesonbuild.com/Reference-manual_functions.html#add_languages

Signed-off-by: Romain Naour <romain.naour@smile.fr>
Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
---
 package/pkg-meson.mk                   | 13 +++++++++++++
 support/misc/cross-compilation.conf.in |  2 ++
 2 files changed, 15 insertions(+)

diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
index 65cabf23ba..25dd4f0d7f 100644
--- a/package/pkg-meson.mk
+++ b/package/pkg-meson.mk
@@ -82,6 +82,16 @@ else
 PKG_MESON_TARGET_FC = /bin/false
 endif
 
+ifeq ($(BR2_PACKAGE_HOST_RUSTC),y)
+PKG_MESON_TARGET_RUSTC = $(HOST_DIR)/bin/rustc
+PKG_MESON_TARGET_RUSTC_LINKER = $(notdir $(TARGET_CROSS))gcc
+PKG_MESON_TARGET_RUSTC_TARGET_NAME = $(RUSTC_TARGET_NAME)
+else
+PKG_MESON_TARGET_RUSTC = /bin/false
+PKG_MESON_TARGET_RUSTC_LINKER = /bin/false
+PKG_MESON_TARGET_RUSTC_TARGET_NAME =
+endif
+
 # Generates sed patterns for patching the cross-compilation.conf template,
 # since Flags might contain commas the arguments are passed indirectly by
 # variable name (stripped to deal with whitespaces).
@@ -91,6 +101,7 @@ define PKG_MESON_CROSSCONFIG_SED
         -e "s%@TARGET_CXX@%$(PKG_MESON_TARGET_CXX)%g" \
         -e "s%@TARGET_AR@%$(TARGET_AR)%g" \
         -e "s%@TARGET_FC@%$(PKG_MESON_TARGET_FC)%g" \
+        -e "s%@TARGET_RUSTC@%$(PKG_MESON_TARGET_RUSTC)%g" \
         -e "s%@TARGET_STRIP@%$(TARGET_STRIP)%g" \
         -e "s%@TARGET_ARCH@%$(PKG_MESON_TARGET_CPU_FAMILY)%g" \
         -e "s%@TARGET_CPU@%$(GCC_TARGET_CPU)%g" \
@@ -99,6 +110,8 @@ define PKG_MESON_CROSSCONFIG_SED
         -e "s%@TARGET_CFLAGS@%$(call make-sq-comma-list,$($(strip $(1))))%g" \
         -e "s%@TARGET_LDFLAGS@%$(call make-sq-comma-list,$($(strip $(3))))%g" \
         -e "s%@TARGET_CXXFLAGS@%$(call make-sq-comma-list,$($(strip $(2))))%g" \
+        -e "s%@TARGET_RUSTC_LINKER@%$(PKG_MESON_TARGET_RUSTC_LINKER)%g" \
+        -e "s%@RUSTC_TARGET_NAME@%$(PKG_MESON_TARGET_RUSTC_TARGET_NAME)%g" \
         -e "s%@BR2_CMAKE@%$(BR2_CMAKE)%g" \
         -e "s%@PKGCONF_HOST_BINARY@%$(HOST_DIR)/bin/pkgconf%g" \
         -e "s%@HOST_DIR@%$(HOST_DIR)%g" \
diff --git a/support/misc/cross-compilation.conf.in b/support/misc/cross-compilation.conf.in
index a58ab553d0..21cec10b82 100644
--- a/support/misc/cross-compilation.conf.in
+++ b/support/misc/cross-compilation.conf.in
@@ -13,6 +13,8 @@ fortran = '@TARGET_FC@'
 pkg-config = '@PKGCONF_HOST_BINARY@'
 g-ir-compiler = '@STAGING_DIR@/usr/bin/g-ir-compiler'
 g-ir-scanner = '@STAGING_DIR@/usr/bin/g-ir-scanner'
+rust = ['@TARGET_RUSTC@', '--target', '@RUSTC_TARGET_NAME@' ]
+rust_ld = '@TARGET_RUSTC_LINKER@'
 
 [built-in options]
 c_args = [@TARGET_CFLAGS@]
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [Buildroot] [PATCH v4 3/7] package/spirv-llvm-translator: add target variant to provide LLVMSPIRVLib
  2024-02-02  9:36 [Buildroot] [PATCH v4 0/7] Adding RustiCL Antoine Coutant
  2024-02-02  9:36 ` [Buildroot] [PATCH v4 1/7] package/meson: bump version to 1.3.1 Antoine Coutant
  2024-02-02  9:36 ` [Buildroot] [PATCH v4 2/7] package/pkg-meson.mk: add rust cross-compiler support Antoine Coutant
@ 2024-02-02  9:36 ` Antoine Coutant
  2024-02-07 15:08   ` Yann E. MORIN
  2024-02-02  9:36 ` [Buildroot] [PATCH v4 4/7] package/opencl-headers: new package Antoine Coutant
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 22+ messages in thread
From: Antoine Coutant @ 2024-02-02  9:36 UTC (permalink / raw)
  To: buildroot; +Cc: sebastian.weyer, Antoine Coutant, bernd, romain.naour

From: Romain Naour <romain.naour@smile.fr>

This target version is needed for Rusticl which is an LLVM based OpenCL
framework[1]. Rusticl allow programs to compile OpenCL C/C++ code
at runtime with Clang. Clang generates LLVM IR which is translated into
SPIR-V by spirv-llvm-translator. Finally, mesa can use its internal
tools to manage SPIR-V.

[1]: https://docs.mesa3d.org/rusticl.html

Signed-off-by: Romain Naour <romain.naour@smile.fr>
Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
---
Changes v2 -> v3:
	- resolution of the conflict created by adding spirv-llvm-translator
	to package/Config.in
	- resolution of the conflict created by adding spirv-headers and zlib
	to spirv-llvm-translator dependencies

Changes v3 -> v4:
	- explain why the target version is needed in the commit log.

Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
---
 package/Config.in                             |  1 +
 package/spirv-llvm-translator/Config.in       | 22 +++++++++++++++++++
 .../spirv-llvm-translator.mk                  | 12 +++++++++-
 3 files changed, 34 insertions(+), 1 deletion(-)
 create mode 100644 package/spirv-llvm-translator/Config.in

diff --git a/package/Config.in b/package/Config.in
index 426bd7d090..9324d1e4c8 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -334,6 +334,7 @@ comment "Graphic applications"
 	source "package/pngquant/Config.in"
 	source "package/qt5cinex/Config.in"
 	source "package/rrdtool/Config.in"
+	source "package/spirv-llvm-translator/Config.in"
 	source "package/spirv-tools/Config.in"
 	source "package/stellarium/Config.in"
 	source "package/sway/Config.in"
diff --git a/package/spirv-llvm-translator/Config.in b/package/spirv-llvm-translator/Config.in
new file mode 100644
index 0000000000..73ca787d8a
--- /dev/null
+++ b/package/spirv-llvm-translator/Config.in
@@ -0,0 +1,22 @@
+config BR2_PACKAGE_SPIRV_LLVM_TRANSLATOR
+	bool "spirv-translator"
+	depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_7
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_INSTALL_LIBSTDCPP
+	depends on !BR2_STATIC_LIBS
+	depends on BR2_HOST_GCC_AT_LEAST_7 # host-llvm
+	select BR2_PACKAGE_LLVM
+	select BR2_PACKAGE_SPIRV_HEADERS
+	select BR2_PACKAGE_ZLIB
+	help
+	  LLVM/SPIR-V Bi-Directional Translator is a library and tool
+	  for translation between LLVM IR and SPIR-V.
+
+	  https://github.com/khronosGroup/SPIRV-LLVM-Translator
+
+comment "spirv-translator needs a toolchain w/ threads, C++, gcc >= 7, dynamic library, host gcc >= 7"
+	depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
+	depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP || \
+		!BR2_TOOLCHAIN_GCC_AT_LEAST_7 \
+		|| BR2_STATIC_LIBS || !BR2_HOST_GCC_AT_LEAST_7
diff --git a/package/spirv-llvm-translator/spirv-llvm-translator.mk b/package/spirv-llvm-translator/spirv-llvm-translator.mk
index 523890a986..8361a74c59 100644
--- a/package/spirv-llvm-translator/spirv-llvm-translator.mk
+++ b/package/spirv-llvm-translator/spirv-llvm-translator.mk
@@ -10,7 +10,7 @@ SPIRV_LLVM_TRANSLATOR_VERSION = v15.0.0-46-ge82ecc2bd7295604fcf1824e47c95fa6a09c
 SPIRV_LLVM_TRANSLATOR_SITE = $(call github,KhronosGroup,SPIRV-LLVM-Translator,$(SPIRV_LLVM_TRANSLATOR_VERSION))
 SPIRV_LLVM_TRANSLATOR_LICENSE = NCSA
 SPIRV_LLVM_TRANSLATOR_LICENSE_FILES = LICENSE.TXT
-HOST_SPIRV_LLVM_TRANSLATOR_DEPENDENCIES = host-clang host-llvm host-spirv-headers
+HOST_SPIRV_LLVM_TRANSLATOR_DEPENDENCIES = host-clang host-llvm host-spirv-headers spirv-headers zlib
 HOST_SPIRV_LLVM_TRANSLATOR_CONF_OPTS = \
 	-DLLVM_BUILD_TOOLS=ON \
 	-DLLVM_DIR=$(HOST_DIR)/lib/cmake/llvm \
@@ -19,4 +19,14 @@ HOST_SPIRV_LLVM_TRANSLATOR_CONF_OPTS = \
 	-DLLVM_EXTERNAL_PROJECTS="SPIRV-Headers" \
 	-DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=$(HOST_DIR)/include
 
+SPIRV_LLVM_TRANSLATOR_INSTALL_STAGING = YES
+SPIRV_LLVM_TRANSLATOR_DEPENDENCIES = host-clang host-llvm llvm
+SPIRV_LLVM_TRANSLATOR_CONF_OPTS = \
+	-DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=${STAGING_DIR}/usr \
+	-DLLVM_BUILD_TOOLS=ON \
+	-DLLVM_DIR=$(STAGING_DIR)/lib/cmake/llvm \
+	-DLLVM_SPIRV_BUILD_EXTERNAL=YES \
+	-DLLVM_SPIRV_INCLUDE_TESTS=OFF
+
+$(eval $(cmake-package))
 $(eval $(host-cmake-package))
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [Buildroot] [PATCH v4 4/7] package/opencl-headers: new package
  2024-02-02  9:36 [Buildroot] [PATCH v4 0/7] Adding RustiCL Antoine Coutant
                   ` (2 preceding siblings ...)
  2024-02-02  9:36 ` [Buildroot] [PATCH v4 3/7] package/spirv-llvm-translator: add target variant to provide LLVMSPIRVLib Antoine Coutant
@ 2024-02-02  9:36 ` Antoine Coutant
  2024-02-07 15:58   ` Yann E. MORIN
  2024-02-02  9:36 ` [Buildroot] [PATCH v4 5/7] package/opencl-icd-loader: " Antoine Coutant
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 22+ messages in thread
From: Antoine Coutant @ 2024-02-02  9:36 UTC (permalink / raw)
  To: buildroot; +Cc: sebastian.weyer, Antoine Coutant, bernd, romain.naour

From: Sebastian Weyer <sebastian.weyer@smile.fr>

These headers provide the C language API bindings. It is a complement to
the C++ bindings already available in opencl-clhpp. This package is
required to build opencl-icd-loader:

https://github.com/KhronosGroup/OpenCL-ICD-Loader#dependencies

Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
---
Changes v2 -> v3:
	- resolution of the conflict created by adding opencl-headers
	under Sebastian Weyer in DEVELOPERS
	- resolution of the conflict created by adding opencl-headers
	to package/Config.in

Changes v3 -> v4:
	- bump version from v2023.04.17 to v2023.12.14:
	add cl_function_types.h to the header files to keep
	this header added in commit e049b16b5f157e2f28e7b5c301e71e1ccb3fe288
	- remove the list of headers to install as it is exhaustive.
	Instead, select all files with "*".

Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
---
 DEVELOPERS                                 |  1 +
 package/Config.in                          |  1 +
 package/opencl-headers/Config.in           |  7 +++++++
 package/opencl-headers/opencl-headers.hash |  3 +++
 package/opencl-headers/opencl-headers.mk   | 22 ++++++++++++++++++++++
 5 files changed, 34 insertions(+)
 create mode 100644 package/opencl-headers/Config.in
 create mode 100644 package/opencl-headers/opencl-headers.hash
 create mode 100644 package/opencl-headers/opencl-headers.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index cc9bc5b5cc..79c46c3539 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2693,6 +2693,7 @@ F:	package/ripgrep/
 N:	Sebastian Weyer <sebastian.weyer@smile.fr>
 F:      package/amlogic-boot-fip/
 F:	package/nushell/
+F:	package/opencl-headers
 F:	package/rust-bindgen/
 F:	package/spirv-headers/
 F:	support/testing/tests/package/sample_nu.nu
diff --git a/package/Config.in b/package/Config.in
index 9324d1e4c8..dfbd20e889 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1696,6 +1696,7 @@ menu "Graphics"
 	source "package/menu-cache/Config.in"
 	source "package/onevpl-intel-gpu/Config.in"
 	source "package/opencl-clhpp/Config.in"
+	source "package/opencl-headers/Config.in"
 	source "package/opencv3/Config.in"
 	source "package/opencv4/Config.in"
 	source "package/opencv4-contrib/Config.in"
diff --git a/package/opencl-headers/Config.in b/package/opencl-headers/Config.in
new file mode 100644
index 0000000000..092d8a2a4d
--- /dev/null
+++ b/package/opencl-headers/Config.in
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_OPENCL_HEADERS
+	bool "opencl-headers"
+	depends on BR2_PACKAGE_HAS_LIBOPENCL
+	help
+	  C language headers for the OpenCL API
+
+	  https://github.com/KhronosGroup/OpenCL-Headers
diff --git a/package/opencl-headers/opencl-headers.hash b/package/opencl-headers/opencl-headers.hash
new file mode 100644
index 0000000000..802ed05450
--- /dev/null
+++ b/package/opencl-headers/opencl-headers.hash
@@ -0,0 +1,3 @@
+#Locally generated
+sha256  407d5e109a70ec1b6cd3380ce357c21e3d3651a91caae6d0d8e1719c69a1791d  OpenCL-Headers-2023.12.14.tar.gz
+sha256  cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30  LICENSE
diff --git a/package/opencl-headers/opencl-headers.mk b/package/opencl-headers/opencl-headers.mk
new file mode 100644
index 0000000000..7aa0e0d168
--- /dev/null
+++ b/package/opencl-headers/opencl-headers.mk
@@ -0,0 +1,22 @@
+################################################################################
+#
+# opencl-headers
+#
+################################################################################
+
+OPENCL_HEADERS_VERSION = 2023.12.14
+OPENCL_HEADERS_SOURCE = OpenCL-Headers-$(OPENCL_HEADERS_VERSION).tar.gz
+OPENCL_HEADERS_SITE = $(call github,KhronosGroup,OpenCL-Headers,v$(OPENCL_HEADERS_VERSION))
+OPENCL_HEADERS_LICENSE = Apache-2.0
+OPENCL_HEADERS_LICENSE_FILES = LICENSE
+OPENCL_HEADERS_INSTALL_STAGING = YES
+
+OPENCL_HEADERS_INSTALL_TARGET = NO
+
+define OPENCL_HEADERS_INSTALL_STAGING_CMDS
+	mkdir -p $(STAGING_DIR)/usr/include/CL
+	$(INSTALL) -D -m 0644 $(@D)/CL/* \
+		$(STAGING_DIR)/usr/include/CL
+endef
+
+$(eval $(generic-package))
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [Buildroot] [PATCH v4 5/7] package/opencl-icd-loader: new package
  2024-02-02  9:36 [Buildroot] [PATCH v4 0/7] Adding RustiCL Antoine Coutant
                   ` (3 preceding siblings ...)
  2024-02-02  9:36 ` [Buildroot] [PATCH v4 4/7] package/opencl-headers: new package Antoine Coutant
@ 2024-02-02  9:36 ` Antoine Coutant
  2024-02-07 16:01   ` Yann E. MORIN
  2024-02-02  9:36 ` [Buildroot] [PATCH v4 6/7] package/llvm-project: add opencl-c-base.h on target Antoine Coutant
  2024-02-02  9:36 ` [Buildroot] [PATCH v4 7/7] package/mesa3d: add RustiCL support Antoine Coutant
  6 siblings, 1 reply; 22+ messages in thread
From: Antoine Coutant @ 2024-02-02  9:36 UTC (permalink / raw)
  To: buildroot; +Cc: sebastian.weyer, Antoine Coutant, bernd, romain.naour

From: Sebastian Weyer <sebastian.weyer@smile.fr>

With this package it is possible to have multiple implementations of
OpenCL at the same time. This package provides a libOpenCL.so file that
captures the OpenCL API calls and forwards them to the correct
implementation of OpenCL. OpenCL implementations can be manually
registered by creating a file containing its full file path in
/etc/OpenCL/vendors/<implementation>.icd[1]

This package is required by certain OpenCL implementations, for example
Mesa3D's Clover implementation if it is not built in standalone mode.

[1] https://github.com/KhronosGroup/OpenCL-ICD-Loader#registering-icds

Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
---
Changes v2 -> v3:
	-resolution of the conflict created by adding opencl-icd-loader
	under Sebastian Weyer in DEVELOPERS
	- resolution of the conflict created by adding opencl-icd-loader
	to package/Config.in

Changes v3 -> v4:
	- bump version from v2023.04.17 to v2023.12.14

Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
---
 DEVELOPERS                                    |  1 +
 package/Config.in                             |  1 +
 package/opencl-icd-loader/Config.in           | 12 ++++++++++++
 .../opencl-icd-loader/opencl-icd-loader.hash  |  3 +++
 .../opencl-icd-loader/opencl-icd-loader.mk    | 19 +++++++++++++++++++
 5 files changed, 36 insertions(+)
 create mode 100644 package/opencl-icd-loader/Config.in
 create mode 100644 package/opencl-icd-loader/opencl-icd-loader.hash
 create mode 100644 package/opencl-icd-loader/opencl-icd-loader.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index 79c46c3539..907a29f53b 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2694,6 +2694,7 @@ N:	Sebastian Weyer <sebastian.weyer@smile.fr>
 F:      package/amlogic-boot-fip/
 F:	package/nushell/
 F:	package/opencl-headers
+F:	package/opencl-icd-loader
 F:	package/rust-bindgen/
 F:	package/spirv-headers/
 F:	support/testing/tests/package/sample_nu.nu
diff --git a/package/Config.in b/package/Config.in
index dfbd20e889..7b1324306c 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1697,6 +1697,7 @@ menu "Graphics"
 	source "package/onevpl-intel-gpu/Config.in"
 	source "package/opencl-clhpp/Config.in"
 	source "package/opencl-headers/Config.in"
+	source "package/opencl-icd-loader/Config.in"
 	source "package/opencv3/Config.in"
 	source "package/opencv4/Config.in"
 	source "package/opencv4-contrib/Config.in"
diff --git a/package/opencl-icd-loader/Config.in b/package/opencl-icd-loader/Config.in
new file mode 100644
index 0000000000..405dc5401a
--- /dev/null
+++ b/package/opencl-icd-loader/Config.in
@@ -0,0 +1,12 @@
+config BR2_PACKAGE_OPENCL_ICD_LOADER
+	bool "OpenCL-ICD-Loader"
+	depends on BR2_INSTALL_LIBSTDCPP
+	depends on BR2_PACKAGE_HAS_LIBOPENCL
+	select BR2_PACKAGE_OPENCL_HEADERS
+	help
+	  OpenCL defines an Installable Client Driver (ICD) mechanism to
+	  allow developers to build applications against an Installable
+	  Client Driver loader (ICD loader) rather than linking their
+	  applications against a specific OpenCL implementation.
+
+	  https://github.com/KhronosGroup/OpenCL-ICD-Loader
diff --git a/package/opencl-icd-loader/opencl-icd-loader.hash b/package/opencl-icd-loader/opencl-icd-loader.hash
new file mode 100644
index 0000000000..1c894f1293
--- /dev/null
+++ b/package/opencl-icd-loader/opencl-icd-loader.hash
@@ -0,0 +1,3 @@
+# locally generated
+sha256  af8df96f1e1030329e8d4892ba3aa761b923838d4c689ef52d97822ab0bd8917  OpenCL-ICD-Loader-2023.12.14.tar.gz
+sha256  c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4  LICENSE
diff --git a/package/opencl-icd-loader/opencl-icd-loader.mk b/package/opencl-icd-loader/opencl-icd-loader.mk
new file mode 100644
index 0000000000..04f6fb4b85
--- /dev/null
+++ b/package/opencl-icd-loader/opencl-icd-loader.mk
@@ -0,0 +1,19 @@
+################################################################################
+#
+# opencl-icd-loader
+#
+################################################################################
+
+OPENCL_ICD_LOADER_VERSION = 2023.12.14
+OPENCL_ICD_LOADER_SOURCE = OpenCL-ICD-Loader-$(OPENCL_ICD_LOADER_VERSION).tar.gz
+OPENCL_ICD_LOADER_SITE = $(call github,KhronosGroup,OpenCL-ICD-Loader,v$(OPENCL_ICD_LOADER_VERSION))
+OPENCL_ICD_LOADER_LICENSE = Apache-2.0
+OPENCL_ICD_LOADER_LICENSE_FILES = LICENSE
+OPENCL_ICD_LOADER_INSTALL_STAGING = YES
+
+OPENCL_ICD_LOADER_DEPENDENCIES = opencl-headers
+
+OPENCL_ICD_LOADER_CONF_OPTS += -DOPENCL_ICD_LOADER_HEADERS_DIR=$(STAGING_DIR)/usr/include
+
+$(eval $(cmake-package))
+$(eval $(host-cmake-package))
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [Buildroot] [PATCH v4 6/7] package/llvm-project: add opencl-c-base.h on target
  2024-02-02  9:36 [Buildroot] [PATCH v4 0/7] Adding RustiCL Antoine Coutant
                   ` (4 preceding siblings ...)
  2024-02-02  9:36 ` [Buildroot] [PATCH v4 5/7] package/opencl-icd-loader: " Antoine Coutant
@ 2024-02-02  9:36 ` Antoine Coutant
  2024-02-07 19:07   ` Yann E. MORIN
  2024-02-02  9:36 ` [Buildroot] [PATCH v4 7/7] package/mesa3d: add RustiCL support Antoine Coutant
  6 siblings, 1 reply; 22+ messages in thread
From: Antoine Coutant @ 2024-02-02  9:36 UTC (permalink / raw)
  To: buildroot; +Cc: sebastian.weyer, Antoine Coutant, bernd, romain.naour

rusticl depends on the mesa clc_compile_to_llvm_module function.
This function requires opencl-c-base.h when LLVM version >= 15.

The header is deleted automatically by CLANG_FILES_TO_REMOVE
post install target hook in llvm-project/clang package.
When rusticl is enabled, after the whole clang directory has
been removed, the header is copied back to
/usr/lib/clang/$(LLVM_PROJECT_VERSION)/include/

By default, the mesa3d variable used to retrieve the header
is set to the staging directory on the host machine. A merge
request on mesa's gitlab solved this problem. See:

https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25568

The patches have been backported to mesa 23.3.4.

Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
---
Changes v3 -> v4:
	- Add patches merged by mesa upstream.
---
Running an app that uses rusticl leads to an error.
Example:

RUSTICL_ENABLE=panfrost clpeak

Platform: rusticl
  Device: Mali-G52 (Panfrost)
    Driver version  : 23.3.4 (Linux ARM64)
    Compute units   : 2
    Clock frequency : 800 MHz
    Build Log: <built-in>:1:10: fatal error: 'opencl-c-base.h' file not found
Error executing LLVM compilation action.

Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
---
 package/llvm-project/clang/clang.mk           |  9 ++
 ...ncl-external-clang-headers-option-an.patch | 72 ++++++++++++++++
 ...or-every-user-when-using-shared-LLVM.patch | 40 +++++++++
 ...lc-retrieve-libclang-path-at-runtime.patch | 86 +++++++++++++++++++
 4 files changed, 207 insertions(+)
 create mode 100644 package/mesa3d/0006-meson-remove-opencl-external-clang-headers-option-an.patch
 create mode 100644 package/mesa3d/0007-clc-force-fPIC-for-every-user-when-using-shared-LLVM.patch
 create mode 100644 package/mesa3d/0008-clc-retrieve-libclang-path-at-runtime.patch

diff --git a/package/llvm-project/clang/clang.mk b/package/llvm-project/clang/clang.mk
index 0bafd6461b..09aac7f0ec 100644
--- a/package/llvm-project/clang/clang.mk
+++ b/package/llvm-project/clang/clang.mk
@@ -90,6 +90,15 @@ define HOST_CLANG_INSTALL_CLANG_TBLGEN
 endef
 HOST_CLANG_POST_INSTALL_HOOKS = HOST_CLANG_INSTALL_CLANG_TBLGEN
 
+# Rusticl needs opencl-c-base.h to be present on the target.
+define CLANG_OPENCL_C_BASE_HEADER_TO_TARGET
+	mkdir -p $(TARGET_DIR)/usr/lib/clang/$(LLVM_PROJECT_VERSION)/include
+	$(INSTALL) -D -m 0644 $(@D)/lib/Headers/opencl-c-base.h $(TARGET_DIR)/usr/lib/clang/$(LLVM_PROJECT_VERSION)/include/opencl-c-base.h
+endef
+ifeq ($(BR2_PACKAGE_MESA3D_RUSTICL),y)
+CLANG_POST_INSTALL_TARGET_HOOKS += CLANG_OPENCL_C_BASE_HEADER_TO_TARGET
+endif
+
 # This option must be enabled to link libclang dynamically against libLLVM.so
 HOST_CLANG_CONF_OPTS += -DLLVM_LINK_LLVM_DYLIB=ON
 CLANG_CONF_OPTS += -DLLVM_LINK_LLVM_DYLIB=ON
diff --git a/package/mesa3d/0006-meson-remove-opencl-external-clang-headers-option-an.patch b/package/mesa3d/0006-meson-remove-opencl-external-clang-headers-option-an.patch
new file mode 100644
index 0000000000..ebe3542627
--- /dev/null
+++ b/package/mesa3d/0006-meson-remove-opencl-external-clang-headers-option-an.patch
@@ -0,0 +1,72 @@
+From b7f2ada31d85dfd2e9906a7343d14a3b0b85cf14 Mon Sep 17 00:00:00 2001
+From: Karol Herbst <kherbst@redhat.com>
+Date: Tue, 2 Jan 2024 22:58:39 +0100
+Subject: [PATCH 1/3] meson: remove opencl-external-clang-headers option and
+ rely on shared-llvm
+
+Setting opencl-external-clang-headers to enabled while using shared LLVM
+was broken and this option was mostly used for windows to force static
+inclusion of opencl base headers.
+
+Simply relying on the shared-llvm option here is enough to get what we
+want.
+
+Signed-off-by: Karol Herbst <kherbst@redhat.com>
+Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
+Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25568>
+[antoine.coutant@smile.fr: backported to mesa-23.3.4]
+Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
+---
+ .gitlab-ci/windows/mesa_build.ps1 | 1 -
+ meson_options.txt                 | 7 -------
+ src/compiler/clc/meson.build      | 4 +---
+ 3 files changed, 1 insertion(+), 11 deletions(-)
+
+diff --git a/.gitlab-ci/windows/mesa_build.ps1 b/.gitlab-ci/windows/mesa_build.ps1
+index a4f87c4eadb..e79eb6b6587 100644
+--- a/.gitlab-ci/windows/mesa_build.ps1
++++ b/.gitlab-ci/windows/mesa_build.ps1
+@@ -59,7 +59,6 @@ meson setup `
+ -Dopencl-spirv=true `
+ -Dmicrosoft-clc=enabled `
+ -Dstatic-libclc=all `
+--Dopencl-external-clang-headers=disabled `
+ -Dspirv-to-dxil=true `
+ -Dbuild-tests=true `
+ -Dwerror=true `
+diff --git a/meson_options.txt b/meson_options.txt
+index e885ba61a8a..537ba797407 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -191,13 +191,6 @@ option(
+   description : 'Link libclc SPIR-V statically.',
+ )
+ 
+-option(
+-  'opencl-external-clang-headers',
+-  type : 'feature',
+-  description : 'Use system Clang headers at runtime for OpenCL kernel ' +
+-                'compilation.',
+-)
+-
+ option(
+   'd3d-drivers-path',
+   type : 'string',
+diff --git a/src/compiler/clc/meson.build b/src/compiler/clc/meson.build
+index 3e4f1a7f441..81345225768 100644
+--- a/src/compiler/clc/meson.build
++++ b/src/compiler/clc/meson.build
+@@ -30,9 +30,7 @@ _libmesaclc_c_args = []
+ _libmesaclc_cpp_args = ['-DLLVM_LIB_DIR="@0@"'.format(llvm_libdir)]
+ _libmesaclc_sources = []
+ 
+-if get_option('opencl-external-clang-headers') \
+-   .disable_auto_if(host_machine.system() == 'windows') \
+-   .disabled()
++if not _shared_llvm
+   # LLVM 16 moved clang header path from using full version to only major version
+   if dep_llvm.version().version_compare('< 16')
+     # Prior to LLVM 16, this path used a full version
+-- 
+2.25.1
+
diff --git a/package/mesa3d/0007-clc-force-fPIC-for-every-user-when-using-shared-LLVM.patch b/package/mesa3d/0007-clc-force-fPIC-for-every-user-when-using-shared-LLVM.patch
new file mode 100644
index 0000000000..3560f6805f
--- /dev/null
+++ b/package/mesa3d/0007-clc-force-fPIC-for-every-user-when-using-shared-LLVM.patch
@@ -0,0 +1,40 @@
+From 56c85c4c7a757a9ba3d8ac08e6c4c4c7f19e6cab Mon Sep 17 00:00:00 2001
+From: Karol Herbst <kherbst@redhat.com>
+Date: Thu, 11 Jan 2024 14:55:46 +0100
+Subject: [PATCH 2/3] clc: force fPIC for every user when using shared LLVM
+
+As we want to start using `dladdr`, this is needed to prevent `dladdr`
+returning information of the wrong file.
+
+Fixes tag as it's required by the actual fix.
+
+Signed-off-by: Karol Herbst <kherbst@redhat.com>
+Fixes: e22491c8326 ("clc: fetch clang resource dir at runtime")
+Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25568>
+[antoine.coutant@smile.fr: backported to mesa-23.3.4]
+Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
+---
+ src/compiler/clc/meson.build | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/src/compiler/clc/meson.build b/src/compiler/clc/meson.build
+index 81345225768..442a583065b 100644
+--- a/src/compiler/clc/meson.build
++++ b/src/compiler/clc/meson.build
+@@ -123,7 +123,13 @@ _libmesaclc = static_library(
+                  idep_mesautil, dep_spirv_tools]
+ )
+ 
++_idep_mesaclc_link_args = []
++if _shared_llvm
++  _idep_mesaclc_link_args += cc.get_supported_link_arguments('-fPIC')
++endif
++
+ idep_mesaclc = declare_dependency(
+   link_with : _libmesaclc,
+   include_directories : include_directories('.'),
++  link_args : _idep_mesaclc_link_args,
+ )
+-- 
+2.25.1
+
diff --git a/package/mesa3d/0008-clc-retrieve-libclang-path-at-runtime.patch b/package/mesa3d/0008-clc-retrieve-libclang-path-at-runtime.patch
new file mode 100644
index 0000000000..c19ba7d2b7
--- /dev/null
+++ b/package/mesa3d/0008-clc-retrieve-libclang-path-at-runtime.patch
@@ -0,0 +1,86 @@
+From fa2c045e04370beb454951c32bccc087638e04c7 Mon Sep 17 00:00:00 2001
+From: Antoine Coutant <antoine.coutant@smile.fr>
+Date: Thu, 30 Nov 2023 11:10:20 +0100
+Subject: [PATCH 3/3] clc: retrieve libclang path at runtime.
+
+LLVM_LIB_DIR is a variable used for runtime compilations.
+When cross compiling, LLVM_LIB_DIR must be set to the
+libclang path on the target. So, this path should not
+be retrieved during compilation but at runtime.
+
+dladdr uses an address to search for a loaded library.
+If a library is found, it returns information about it.
+The path to the libclang library can therefore be
+retrieved using one of its functions. This is useful
+because we don't know the name of the libclang library
+(libclang.so.X or libclang-cpp.so.X)
+
+v2 (Karol): use clang::CompilerInvocation::CreateFromArgs for dladdr
+v3 (Karol): follow symlinks to fix errors on debian
+
+Fixes: e22491c8326 ("clc: fetch clang resource dir at runtime")
+Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
+Reviewed-by: Karol Herbst <kherbst@redhat.com>
+Reviewed-by (v1): Jesse Natalie <jenatali@microsoft.com>
+[antoine.coutant@smile.fr: backported to mesa-23.3.4]
+
+Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25568>
+---
+ src/compiler/clc/clc_helpers.cpp | 24 +++++++++++++++++++++---
+ 1 file changed, 21 insertions(+), 3 deletions(-)
+
+diff --git a/src/compiler/clc/clc_helpers.cpp b/src/compiler/clc/clc_helpers.cpp
+index 55287f22683..22eb3495be9 100644
+--- a/src/compiler/clc/clc_helpers.cpp
++++ b/src/compiler/clc/clc_helpers.cpp
+@@ -23,6 +23,7 @@
+ // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ // OTHER DEALINGS IN THE SOFTWARE.
+ 
++#include <cstdlib>
+ #include <filesystem>
+ #include <sstream>
+ #include <mutex>
+@@ -57,6 +58,10 @@
+ 
+ #include "spirv.h"
+ 
++#if DETECT_OS_UNIX
++#include <dlfcn.h>
++#endif
++
+ #ifdef USE_STATIC_OPENCL_C_H
+ #if LLVM_VERSION_MAJOR < 15
+ #include "opencl-c.h.h"
+@@ -876,12 +881,25 @@ clc_compile_to_llvm_module(LLVMContext &llvm_ctx,
+ #endif
+    }
+ #else
++
++   Dl_info info;
++   if (dladdr((void *)clang::CompilerInvocation::CreateFromArgs, &info) == 0) {
++      clc_error(logger, "Couldn't find libclang path.\n");
++      return {};
++   }
++
++   char *clang_path = realpath(info.dli_fname, NULL);
++   if (clang_path == nullptr) {
++      clc_error(logger, "Couldn't find libclang path.\n");
++      return {};
++   }
++
+    // GetResourcePath is a way to retrive the actual libclang resource dir based on a given binary
+-   // or library. The path doesn't even need to exist, we just have to put something in there,
+-   // because we might have linked clang statically.
++   // or library.
+    auto libclang_path = fs::path(LLVM_LIB_DIR) / "libclang.so";
+    auto clang_res_path =
+-      fs::path(Driver::GetResourcesPath(libclang_path.string(), CLANG_RESOURCE_DIR)) / "include";
++      fs::path(Driver::GetResourcesPath(std::string(clang_path), CLANG_RESOURCE_DIR)) / "include";
++   free(clang_path);
+ 
+    c->getHeaderSearchOpts().UseBuiltinIncludes = true;
+    c->getHeaderSearchOpts().UseStandardSystemIncludes = true;
+-- 
+2.25.1
+
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [Buildroot] [PATCH v4 7/7] package/mesa3d: add RustiCL support
  2024-02-02  9:36 [Buildroot] [PATCH v4 0/7] Adding RustiCL Antoine Coutant
                   ` (5 preceding siblings ...)
  2024-02-02  9:36 ` [Buildroot] [PATCH v4 6/7] package/llvm-project: add opencl-c-base.h on target Antoine Coutant
@ 2024-02-02  9:36 ` Antoine Coutant
  6 siblings, 0 replies; 22+ messages in thread
From: Antoine Coutant @ 2024-02-02  9:36 UTC (permalink / raw)
  To: buildroot; +Cc: sebastian.weyer, Antoine Coutant, bernd, romain.naour

From: Romain Naour <romain.naour@smile.fr>

To build Rusticl you need to satisfy the following build dependencies:

    rustc
    rustfmt (highly recommended, but only required for CI builds or when authoring patches)
    bindgen
    LLVM built with libclc and -DLLVM_ENABLE_DUMP=ON.
    SPIRV-Tools
    SPIRV-LLVM-Translator for a libLLVMSPIRVLib.so matching your version of LLVM, i.e. if you’re using LLVM 15 (libLLVM.so.15), then you need a libLLVMSPIRVLib.so.15.

See:
https://docs.mesa3d.org/rusticl.html

Since rusticl is an implementation of OpenCL, make it a provider of
OpenCL.

We need to use opencl-icd-loader in order to be able to capture API
calls and forward them to the correct implementation of OpenCL (RustiCL
in this case)

opencl-icd-loader needs to be installed in the toolchain's sysroot
as well to be able to compile packages depending on libopencl since
otherwise there's only for example libRustiOpenCL.so and no
libOpenCL.so

Many Gallium drivers are compatible with rusticl. However, tests were
performed with panfrost. Thus only panfrost is actived for the moment.
To activate another driver, make it select
BR2_PACKAGE_MESA3D_RUSTICL_SUPPORTED_DRIVER. The list of all
compatible drivers can be found here:

https://docs.mesa3d.org/envvars.html#envvar-RUSTICL_ENABLE

Signed-off-by: Romain Naour <romain.naour@smile.fr>
Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
---
v2: change commit header -> RustiCL support is not experimental

Changes v3 -> v4:
	- Add a menuconfig to select OpenCL implementation
	between Clover and RustiCL
	- Add BR2_PACKAGE_MESA3D_RUSTICL_SUPPORTED_DRIVER.

Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
---
 package/mesa3d/Config.in | 50 ++++++++++++++++++++++++++++++++++++----
 package/mesa3d/mesa3d.mk | 18 +++++++++++++--
 2 files changed, 61 insertions(+), 7 deletions(-)

diff --git a/package/mesa3d/Config.in b/package/mesa3d/Config.in
index 39a4f706e2..84d281a0a9 100644
--- a/package/mesa3d/Config.in
+++ b/package/mesa3d/Config.in
@@ -44,17 +44,56 @@ comment "llvm support needs a toolchain not affected by GCC bug 64735"
 	depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
 	depends on BR2_TOOLCHAIN_HAS_GCC_BUG_64735
 
-# clang and libclc dependencies are satisfied by
-# BR2_PACKAGE_MESA3D_LLVM
-config BR2_PACKAGE_MESA3D_OPENCL
+menuconfig BR2_PACKAGE_MESA3D_OPENCL
 	bool "OpenCL support"
+	default n
 	depends on BR2_PACKAGE_MESA3D_LLVM
 	depends on BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_R600 || \
-		BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_RADEONSI
+		BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_RADEONSI || \
+		BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS && \
+		BR2_PACKAGE_MESA3D_RUSTICL_SUPPORTED_DRIVER
 	select BR2_PACKAGE_LLVM_RTTI
 	select BR2_PACKAGE_CLANG
 	select BR2_PACKAGE_LIBCLC
 	select BR2_PACKAGE_HAS_LIBOPENCL
+	help
+	  OpenCL is a standard for parallel programming of heterogeneous
+	  systems (CPUs, GPUs, DSPs, FPGAs, etc.)
+
+	  http://www.khronos.org/opencl/
+
+if BR2_PACKAGE_MESA3D_OPENCL
+
+# clang and libclc dependencies are satisfied by
+# BR2_PACKAGE_MESA3D_LLVM
+config BR2_PACKAGE_MESA3D_CLOVER
+	bool "Clover"
+	depends on BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_R600 || \
+		BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_RADEONSI
+
+# libclc dependency is satisfied by
+# BR2_PACKAGE_MESA3D_LLVM
+config BR2_PACKAGE_MESA3D_RUSTICL
+	bool "RustiCL"
+	depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
+	depends on BR2_PACKAGE_MESA3D_RUSTICL_SUPPORTED_DRIVER
+	select BR2_PACKAGE_HOST_RUSTC
+	select BR2_PACKAGE_LLVM_DUMP
+	select BR2_PACKAGE_OPENCL_ICD_LOADER
+	select BR2_PACKAGE_SPIRV_TOOLS
+	select BR2_PACKAGE_SPIRV_LLVM_TRANSLATOR
+	help
+	  RustiCL is an OpenCL implementation written in Rust.
+
+	  By default devices are disabled in RustiCL. If you want to enable a device,
+	  you need to set the environment variable RUSTICL_ENABLE to the driver you
+	  are using.
+	  ref: https://docs.mesa3d.org/envvars.html#envvar-RUSTICL_ENABLE
+
+endif # BR2_PACKAGE_MESA3D_OPENCL
+
+config BR2_PACKAGE_MESA3D_RUSTICL_SUPPORTED_DRIVER
+	bool
 
 # inform the .mk file of gallium, dri, dri3 or vulkan driver selection
 config BR2_PACKAGE_MESA3D_DRI3
@@ -160,6 +199,7 @@ config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_PANFROST
 	depends on (BR2_TOOLCHAIN_HAS_SYNC_4 && !BR2_RISCV_32) || !BR2_PACKAGE_XORG7 # libxshmfence
 	select BR2_PACKAGE_MESA3D_DRI3 if BR2_PACKAGE_XORG7
 	select BR2_PACKAGE_MESA3D_GALLIUM_DRIVER
+	select BR2_PACKAGE_MESA3D_RUSTICL_SUPPORTED_DRIVER
 	help
 	  Mesa driver for ARM Mali Midgard and Bifrost GPUs.
 
@@ -396,7 +436,7 @@ config BR2_PACKAGE_PROVIDES_LIBGLES
 	default "mesa3d" if BR2_PACKAGE_MESA3D_OPENGL_ES && !BR2_PACKAGE_LIBGLVND
 
 config BR2_PACKAGE_PROVIDES_LIBOPENCL
-	default "mesa3d" if BR2_PACKAGE_MESA3D_OPENCL
+	default "mesa3d" if BR2_PACKAGE_MESA3D_CLOVER || BR2_PACKAGE_MESA3D_RUSTICL
 
 endif # BR2_PACKAGE_MESA3D
 
diff --git a/package/mesa3d/mesa3d.mk b/package/mesa3d/mesa3d.mk
index d8d8fb8dd6..9a86fdacd7 100644
--- a/package/mesa3d/mesa3d.mk
+++ b/package/mesa3d/mesa3d.mk
@@ -58,15 +58,29 @@ else
 MESA3D_CONF_OPTS += -Dllvm=disabled
 endif
 
-# Disable opencl-icd: OpenCL lib will be named libOpenCL instead of
-# libMesaOpenCL and CL headers are installed
 ifeq ($(BR2_PACKAGE_MESA3D_OPENCL),y)
 MESA3D_PROVIDES += libopencl
 MESA3D_DEPENDENCIES += clang libclc
+ifeq ($(BR2_PACKAGE_MESA3D_CLOVER),y)
+ifeq ($(BR2_PACKAGE_OPENCL_ICD_LOADER),y)
+MESA3D_CONF_OPTS += -Dgallium-opencl=icd
+MESA3D_DEPENDENCIES +=  opencl-icd-loader
+else
+# Disable opencl-icd: OpenCL lib will be named libOpenCL instead of
+# libMesaOpenCL and CL headers are installed
 MESA3D_CONF_OPTS += -Dgallium-opencl=standalone
+endif
 else
 MESA3D_CONF_OPTS += -Dgallium-opencl=disabled
 endif
+ifeq ($(BR2_PACKAGE_MESA3D_RUSTICL),y)
+MESA3D_DEPENDENCIES += host-rustc host-rust-bindgen opencl-icd-loader spirv-tools spirv-llvm-translator
+# -Drust_std=2021: known meson bug (https://github.com/mesonbuild/meson/issues/10664)
+MESA3D_CONF_OPTS += -Dgallium-rusticl=true -Drust_std=2021
+else
+MESA3D_CONF_OPTS += -Dgallium-rusticl=false
+endif
+endif
 
 ifeq ($(BR2_PACKAGE_MESA3D_NEEDS_ELFUTILS),y)
 MESA3D_DEPENDENCIES += elfutils
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [Buildroot] [PATCH v4 3/7] package/spirv-llvm-translator: add target variant to provide LLVMSPIRVLib
  2024-02-02  9:36 ` [Buildroot] [PATCH v4 3/7] package/spirv-llvm-translator: add target variant to provide LLVMSPIRVLib Antoine Coutant
@ 2024-02-07 15:08   ` Yann E. MORIN
  2024-02-07 15:15     ` Arnout Vandecappelle via buildroot
  0 siblings, 1 reply; 22+ messages in thread
From: Yann E. MORIN @ 2024-02-07 15:08 UTC (permalink / raw)
  To: Antoine Coutant; +Cc: sebastian.weyer, bernd, romain.naour, buildroot

Antoine, All,

On 2024-02-02 10:36 +0100, Antoine Coutant spake thusly:
> From: Romain Naour <romain.naour@smile.fr>
> 
> This target version is needed for Rusticl which is an LLVM based OpenCL
> framework[1]. Rusticl allow programs to compile OpenCL C/C++ code
> at runtime with Clang. Clang generates LLVM IR which is translated into
> SPIR-V by spirv-llvm-translator. Finally, mesa can use its internal
> tools to manage SPIR-V.
> 
> [1]: https://docs.mesa3d.org/rusticl.html
> 
> Signed-off-by: Romain Naour <romain.naour@smile.fr>
> Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
> Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
> ---
[--SNIP--]
> diff --git a/package/spirv-llvm-translator/spirv-llvm-translator.mk b/package/spirv-llvm-translator/spirv-llvm-translator.mk
> index 523890a986..8361a74c59 100644
> --- a/package/spirv-llvm-translator/spirv-llvm-translator.mk
> +++ b/package/spirv-llvm-translator/spirv-llvm-translator.mk
> @@ -10,7 +10,7 @@ SPIRV_LLVM_TRANSLATOR_VERSION = v15.0.0-46-ge82ecc2bd7295604fcf1824e47c95fa6a09c
>  SPIRV_LLVM_TRANSLATOR_SITE = $(call github,KhronosGroup,SPIRV-LLVM-Translator,$(SPIRV_LLVM_TRANSLATOR_VERSION))
>  SPIRV_LLVM_TRANSLATOR_LICENSE = NCSA
>  SPIRV_LLVM_TRANSLATOR_LICENSE_FILES = LICENSE.TXT
> -HOST_SPIRV_LLVM_TRANSLATOR_DEPENDENCIES = host-clang host-llvm host-spirv-headers
> +HOST_SPIRV_LLVM_TRANSLATOR_DEPENDENCIES = host-clang host-llvm host-spirv-headers spirv-headers zlib

It looks dubious that a host package, host-spirv-llvm-translator,
depends on target packages, spirv-headers and zlib.

If this is really the case, then this would require a good explanation
in the commit log.

>  HOST_SPIRV_LLVM_TRANSLATOR_CONF_OPTS = \
>  	-DLLVM_BUILD_TOOLS=ON \
>  	-DLLVM_DIR=$(HOST_DIR)/lib/cmake/llvm \
> @@ -19,4 +19,14 @@ HOST_SPIRV_LLVM_TRANSLATOR_CONF_OPTS = \
>  	-DLLVM_EXTERNAL_PROJECTS="SPIRV-Headers" \
>  	-DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=$(HOST_DIR)/include
>  
> +SPIRV_LLVM_TRANSLATOR_INSTALL_STAGING = YES
> +SPIRV_LLVM_TRANSLATOR_DEPENDENCIES = host-clang host-llvm llvm
> +SPIRV_LLVM_TRANSLATOR_CONF_OPTS = \
> +	-DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=${STAGING_DIR}/usr \

    $ ./utils/docker-run make check-package
    package/spirv-llvm-translator/spirv-llvm-translator.mk:25: use $() to delimit variables, not ${}

Regards,
Yann E. MORIN.

> +	-DLLVM_BUILD_TOOLS=ON \
> +	-DLLVM_DIR=$(STAGING_DIR)/lib/cmake/llvm \
> +	-DLLVM_SPIRV_BUILD_EXTERNAL=YES \
> +	-DLLVM_SPIRV_INCLUDE_TESTS=OFF
> +
> +$(eval $(cmake-package))
>  $(eval $(host-cmake-package))
> -- 
> 2.25.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Buildroot] [PATCH v4 2/7] package/pkg-meson.mk: add rust cross-compiler support
  2024-02-02  9:36 ` [Buildroot] [PATCH v4 2/7] package/pkg-meson.mk: add rust cross-compiler support Antoine Coutant
@ 2024-02-07 15:13   ` Yann E. MORIN
  2024-02-08 10:25     ` Antoine Coutant
  0 siblings, 1 reply; 22+ messages in thread
From: Yann E. MORIN @ 2024-02-07 15:13 UTC (permalink / raw)
  To: Antoine Coutant; +Cc: sebastian.weyer, bernd, romain.naour, buildroot

Antoine, All,

On 2024-02-02 10:36 +0100, Antoine Coutant spake thusly:
> From: Romain Naour <romain.naour@smile.fr>
> 
> This change is needed to be able to build target packages requiring
> rust. If a package has rust in its project or in an add_language()
> call in their meson.build file, meson will try to find a suitable
> compiler for this language[1]. If the language is classified as
> required but not found, it will abort the build.
> 
> It is necessary to specify rust and rust_ld separately in
> support/misc/cross-compilation.conf.in. If you specify it in one line
> just as "rust", it will generate the following warning:
>     WARNING: Please do not put -C linker= in your compiler command,
>     set rust_ld=command in your cross file or use the RUST_LD environment
>     variable, otherwise meson will override your selection.
> 
> [1] https://mesonbuild.com/Reference-manual_functions.html#add_languages
> 
> Signed-off-by: Romain Naour <romain.naour@smile.fr>
> Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
> Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
> ---
>  package/pkg-meson.mk                   | 13 +++++++++++++
>  support/misc/cross-compilation.conf.in |  2 ++
>  2 files changed, 15 insertions(+)
> 
> diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
> index 65cabf23ba..25dd4f0d7f 100644
> --- a/package/pkg-meson.mk
> +++ b/package/pkg-meson.mk
> @@ -82,6 +82,16 @@ else
>  PKG_MESON_TARGET_FC = /bin/false
>  endif
>  
> +ifeq ($(BR2_PACKAGE_HOST_RUSTC),y)
> +PKG_MESON_TARGET_RUSTC = $(HOST_DIR)/bin/rustc
> +PKG_MESON_TARGET_RUSTC_LINKER = $(notdir $(TARGET_CROSS))gcc

Why can't PKG_MESON_TARGET_RUSTC_LINKER be an absolute path, when
PKG_MESON_TARGET_RUSTC is one, and [...]

> +PKG_MESON_TARGET_RUSTC_TARGET_NAME = $(RUSTC_TARGET_NAME)
> +else
> +PKG_MESON_TARGET_RUSTC = /bin/false
> +PKG_MESON_TARGET_RUSTC_LINKER = /bin/false

[...] especially since here PKG_MESON_TARGET_RUSTC_LINKER is an absolute
path?

Regards,
Yann E. MORIN.

> +PKG_MESON_TARGET_RUSTC_TARGET_NAME =
> +endif
> +
>  # Generates sed patterns for patching the cross-compilation.conf template,
>  # since Flags might contain commas the arguments are passed indirectly by
>  # variable name (stripped to deal with whitespaces).
> @@ -91,6 +101,7 @@ define PKG_MESON_CROSSCONFIG_SED
>          -e "s%@TARGET_CXX@%$(PKG_MESON_TARGET_CXX)%g" \
>          -e "s%@TARGET_AR@%$(TARGET_AR)%g" \
>          -e "s%@TARGET_FC@%$(PKG_MESON_TARGET_FC)%g" \
> +        -e "s%@TARGET_RUSTC@%$(PKG_MESON_TARGET_RUSTC)%g" \
>          -e "s%@TARGET_STRIP@%$(TARGET_STRIP)%g" \
>          -e "s%@TARGET_ARCH@%$(PKG_MESON_TARGET_CPU_FAMILY)%g" \
>          -e "s%@TARGET_CPU@%$(GCC_TARGET_CPU)%g" \
> @@ -99,6 +110,8 @@ define PKG_MESON_CROSSCONFIG_SED
>          -e "s%@TARGET_CFLAGS@%$(call make-sq-comma-list,$($(strip $(1))))%g" \
>          -e "s%@TARGET_LDFLAGS@%$(call make-sq-comma-list,$($(strip $(3))))%g" \
>          -e "s%@TARGET_CXXFLAGS@%$(call make-sq-comma-list,$($(strip $(2))))%g" \
> +        -e "s%@TARGET_RUSTC_LINKER@%$(PKG_MESON_TARGET_RUSTC_LINKER)%g" \
> +        -e "s%@RUSTC_TARGET_NAME@%$(PKG_MESON_TARGET_RUSTC_TARGET_NAME)%g" \
>          -e "s%@BR2_CMAKE@%$(BR2_CMAKE)%g" \
>          -e "s%@PKGCONF_HOST_BINARY@%$(HOST_DIR)/bin/pkgconf%g" \
>          -e "s%@HOST_DIR@%$(HOST_DIR)%g" \
> diff --git a/support/misc/cross-compilation.conf.in b/support/misc/cross-compilation.conf.in
> index a58ab553d0..21cec10b82 100644
> --- a/support/misc/cross-compilation.conf.in
> +++ b/support/misc/cross-compilation.conf.in
> @@ -13,6 +13,8 @@ fortran = '@TARGET_FC@'
>  pkg-config = '@PKGCONF_HOST_BINARY@'
>  g-ir-compiler = '@STAGING_DIR@/usr/bin/g-ir-compiler'
>  g-ir-scanner = '@STAGING_DIR@/usr/bin/g-ir-scanner'
> +rust = ['@TARGET_RUSTC@', '--target', '@RUSTC_TARGET_NAME@' ]
> +rust_ld = '@TARGET_RUSTC_LINKER@'
>  
>  [built-in options]
>  c_args = [@TARGET_CFLAGS@]
> -- 
> 2.25.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Buildroot] [PATCH v4 3/7] package/spirv-llvm-translator: add target variant to provide LLVMSPIRVLib
  2024-02-07 15:08   ` Yann E. MORIN
@ 2024-02-07 15:15     ` Arnout Vandecappelle via buildroot
  0 siblings, 0 replies; 22+ messages in thread
From: Arnout Vandecappelle via buildroot @ 2024-02-07 15:15 UTC (permalink / raw)
  To: Yann E. MORIN, Antoine Coutant
  Cc: sebastian.weyer, bernd, romain.naour, buildroot



On 07/02/2024 16:08, Yann E. MORIN wrote:
> Antoine, All,
> 
> On 2024-02-02 10:36 +0100, Antoine Coutant spake thusly:
>> From: Romain Naour <romain.naour@smile.fr>
>>
>> This target version is needed for Rusticl which is an LLVM based OpenCL
>> framework[1]. Rusticl allow programs to compile OpenCL C/C++ code
>> at runtime with Clang. Clang generates LLVM IR which is translated into
>> SPIR-V by spirv-llvm-translator. Finally, mesa can use its internal
>> tools to manage SPIR-V.
>>
>> [1]: https://docs.mesa3d.org/rusticl.html
>>
>> Signed-off-by: Romain Naour <romain.naour@smile.fr>
>> Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
>> Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
>> ---
> [--SNIP--]
>> diff --git a/package/spirv-llvm-translator/spirv-llvm-translator.mk b/package/spirv-llvm-translator/spirv-llvm-translator.mk
>> index 523890a986..8361a74c59 100644
>> --- a/package/spirv-llvm-translator/spirv-llvm-translator.mk
>> +++ b/package/spirv-llvm-translator/spirv-llvm-translator.mk
>> @@ -10,7 +10,7 @@ SPIRV_LLVM_TRANSLATOR_VERSION = v15.0.0-46-ge82ecc2bd7295604fcf1824e47c95fa6a09c
>>   SPIRV_LLVM_TRANSLATOR_SITE = $(call github,KhronosGroup,SPIRV-LLVM-Translator,$(SPIRV_LLVM_TRANSLATOR_VERSION))
>>   SPIRV_LLVM_TRANSLATOR_LICENSE = NCSA
>>   SPIRV_LLVM_TRANSLATOR_LICENSE_FILES = LICENSE.TXT
>> -HOST_SPIRV_LLVM_TRANSLATOR_DEPENDENCIES = host-clang host-llvm host-spirv-headers
>> +HOST_SPIRV_LLVM_TRANSLATOR_DEPENDENCIES = host-clang host-llvm host-spirv-headers spirv-headers zlib
> 
> It looks dubious that a host package, host-spirv-llvm-translator,
> depends on target packages, spirv-headers and zlib.

  Purely based on the names of the packages, it sounds similar to hos 
host-gcc-final depends on target glibc, or host-rust depends on target toolchain.

  "host" often means "cross", so it _can_ indeed depend on target packages.


> If this is really the case, then this would require a good explanation
> in the commit log.
> 

  That is absolutely true!

  Regards,
  Arnout

>>   HOST_SPIRV_LLVM_TRANSLATOR_CONF_OPTS = \
>>   	-DLLVM_BUILD_TOOLS=ON \
>>   	-DLLVM_DIR=$(HOST_DIR)/lib/cmake/llvm \
>> @@ -19,4 +19,14 @@ HOST_SPIRV_LLVM_TRANSLATOR_CONF_OPTS = \
>>   	-DLLVM_EXTERNAL_PROJECTS="SPIRV-Headers" \
>>   	-DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=$(HOST_DIR)/include
>>   
>> +SPIRV_LLVM_TRANSLATOR_INSTALL_STAGING = YES
>> +SPIRV_LLVM_TRANSLATOR_DEPENDENCIES = host-clang host-llvm llvm
>> +SPIRV_LLVM_TRANSLATOR_CONF_OPTS = \
>> +	-DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=${STAGING_DIR}/usr \
> 
>      $ ./utils/docker-run make check-package
>      package/spirv-llvm-translator/spirv-llvm-translator.mk:25: use $() to delimit variables, not ${}
> 
> Regards,
> Yann E. MORIN.
> 
>> +	-DLLVM_BUILD_TOOLS=ON \
>> +	-DLLVM_DIR=$(STAGING_DIR)/lib/cmake/llvm \
>> +	-DLLVM_SPIRV_BUILD_EXTERNAL=YES \
>> +	-DLLVM_SPIRV_INCLUDE_TESTS=OFF
>> +
>> +$(eval $(cmake-package))
>>   $(eval $(host-cmake-package))
>> -- 
>> 2.25.1
>>
>> _______________________________________________
>> buildroot mailing list
>> buildroot@buildroot.org
>> https://lists.buildroot.org/mailman/listinfo/buildroot
> 
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Buildroot] [PATCH v4 1/7] package/meson: bump version to 1.3.1
  2024-02-02  9:36 ` [Buildroot] [PATCH v4 1/7] package/meson: bump version to 1.3.1 Antoine Coutant
@ 2024-02-07 15:23   ` Yann E. MORIN
  2024-02-07 15:30   ` Yann E. MORIN
  1 sibling, 0 replies; 22+ messages in thread
From: Yann E. MORIN @ 2024-02-07 15:23 UTC (permalink / raw)
  To: Antoine Coutant; +Cc: sebastian.weyer, bernd, romain.naour, buildroot

Antoine, All,

On 2024-02-02 10:36 +0100, Antoine Coutant spake thusly:
> The meson upgrade from 1.1.1 to 1.2.0 have been reverted
> because host-qemu (version v8.0.3) was searching
> libraries in the build machine instead of buildroot host
> directory [1].
> $ grep -r LINK_ARGS  * | grep "\-L/usr"
> build.ninja: LINK_ARGS =
>     -L/usr/lib/gcc/x86_64-linux-gnu/10 \
>     -L/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu \
>     -L/usr/lib/gcc/x86_64-linux-gnu/10/../../../../lib -L/usr/lib \
>     -L/lib/x86_64-linux-gnu \
>     -L/lib/../lib \
>     -L/usr/lib/../lib \
>     -L/usr/lib/gcc/x86_64-linux-gnu/10/../../.. \
>     -L/lib \
>     -I/[...]/host/include \
>     -L/[...]/host/lib \
>     -I/[...]/host/include/libfdt \
>     ...
> 
> Upgrading qemu to version v8.1.0 solves the problem:
> $ grep -r LINK_ARGS  * | grep "\-L/usr"
> build.ninja: LINK_ARGS =
>     -I/[...]/host/include \
>     -L/[...]/host/lib \
>     -I/[...]/host/include/libfdt \
>     ...
> 
> Those two tests were done with the same buildroot version
> (2023.08) on the same machine were the bug appeared. Using,
> git bisect, in this environment, it was found that the
> problem was fixed in qemu by the commit [2].
> 
> Thus, it is possible that the problem was introduced by
> improper use of meson by qemu <= v8.0.3. Also, meson has
> been updated to version 1.2.1 and 1.3.0 in yocto and it
> doesn't seem to create any issue. [3]
> 
> The original problem is no longer present and some
> projects require meson > 1.1.1 (e.g. rusticl requires
> meson 1.2.0 since mesa 23.3.0 and meson 1.3.1 since mesa
> 24.0.0).
> 
> "pkgconfig" field is deprecated by meson 1.3.0 and
> replaced by "pkg-config". See: [4]
> 
> The patch that adds the pkg_config_static property has
> been rebased.
> 
> [1] https://gitlab.com/buildroot.org/buildroot/-/commit/acfdf21f0b752e844a33c70a0fd2f82f4534a5a0
> [2] https://gitlab.com/qemu-project/qemu/-/commit/Fc9a809e0d28417fa1e7f7efc19f845bda4c1be9
> [3] https://github.com/yoctoproject/poky/commits/master/meta/recipes-devtools/meson
> [4] https://mesonbuild.com/Release-notes-for-1-3-0.html#machine-files-pkgconfig-field-deprecated-and-replaced-by-pkgconfig
> 
> Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>

Applied to master, thanks.

Regards,
Yann E. MORIN.

> ---
> Changes v3 -> v4:
> 	- cross-compilation.conf.in have been changed.
> 	- Bump version from 1.3.0 to 1.3.1.
> 
> Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
> ---
>  ...dencies-base.py-add-pkg_config_stati.patch | 29 ++++++++++---------
>  package/meson/meson.hash                      |  4 +--
>  package/meson/meson.mk                        |  2 +-
>  support/misc/cross-compilation.conf.in        |  2 +-
>  4 files changed, 19 insertions(+), 18 deletions(-)
> 
> diff --git a/package/meson/0002-mesonbuild-dependencies-base.py-add-pkg_config_stati.patch b/package/meson/0002-mesonbuild-dependencies-base.py-add-pkg_config_stati.patch
> index 8e15d3210c..49a0ef93dc 100644
> --- a/package/meson/0002-mesonbuild-dependencies-base.py-add-pkg_config_stati.patch
> +++ b/package/meson/0002-mesonbuild-dependencies-base.py-add-pkg_config_stati.patch
> @@ -1,4 +1,4 @@
> -From 3d6a2db2270346236dd6247e0648ea0c949ba468 Mon Sep 17 00:00:00 2001
> +From 59934e2116e025ecfe23baf6febc4a0eb85f60cd Mon Sep 17 00:00:00 2001
>  From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
>  Date: Sat, 15 Feb 2020 15:13:59 +0100
>  Subject: [PATCH] mesonbuild/dependencies/base.py: add pkg_config_static
> @@ -20,24 +20,25 @@ Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
>  Signed-off-by: Romain Naour <romain.naour@gmail.com>
>  [Rebased on 0.57.1]
>  Signed-off-by: Peter Seiderer <ps.report@gmx.net>
> +[rebased on 1.3.0]
> +Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
>  ---
> - mesonbuild/dependencies/pkgconfig.py | 3 ++-
> - 1 file changed, 2 insertions(+), 1 deletion(-)
> + mesonbuild/dependencies/pkgconfig.py | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
>  
>  diff --git a/mesonbuild/dependencies/pkgconfig.py b/mesonbuild/dependencies/pkgconfig.py
> -index 1e8d9132e..d902ba215 100644
> +index e86206b88..94888657d 100644
>  --- a/mesonbuild/dependencies/pkgconfig.py
>  +++ b/mesonbuild/dependencies/pkgconfig.py
> -@@ -338,7 +338,8 @@ class PkgConfigDependency(ExternalDependency):
> -         env = None
> -         libcmd = ['--libs']
> - 
> --        if self.static:
> -+        if self.static or \
> -+            (self.env.properties[self.for_machine].get('pkg_config_static', None) == 'true'):
> -             libcmd.append('--static')
> - 
> -         libcmd.append(self.name)
> +@@ -169,7 +169,7 @@ class PkgConfigCLI(PkgConfigInterface):
> +             env['PKG_CONFIG_ALLOW_SYSTEM_LIBS'] = '1'
> +         args: T.List[str] = []
> +         args += self._define_variable_args(define_variable)
> +-        if static:
> ++        if static or (self.env.properties[self.for_machine].get('pkg_config_static', None) == 'true'):
> +             args.append('--static')
> +         args += ['--libs', name]
> +         ret, out, err = self._call_pkgbin(args, env=env)
>  -- 
>  2.25.1
>  
> diff --git a/package/meson/meson.hash b/package/meson/meson.hash
> index cb36b674fa..150fd6d1bb 100644
> --- a/package/meson/meson.hash
> +++ b/package/meson/meson.hash
> @@ -1,4 +1,4 @@
>  # Locally calculated after checking pgp signature
> -# https://github.com/mesonbuild/meson/releases/download/1.1.1/meson-1.1.1.tar.gz.asc
> -sha256  d04b541f97ca439fb82fab7d0d480988be4bd4e62563a5ca35fadb5400727b1c  meson-1.1.1.tar.gz
> +# https://github.com/mesonbuild/meson/releases/download/1.3.1/meson-1.3.1.tar.gz.asc
> +sha256  6020568bdede1643d4fb41e28215be38eff5d52da28ac7d125457c59e0032ad7  meson-1.3.1.tar.gz
>  sha256  cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30  COPYING
> diff --git a/package/meson/meson.mk b/package/meson/meson.mk
> index 503aca8c25..467569d28b 100644
> --- a/package/meson/meson.mk
> +++ b/package/meson/meson.mk
> @@ -4,7 +4,7 @@
>  #
>  ################################################################################
>  
> -MESON_VERSION = 1.1.1
> +MESON_VERSION = 1.3.1
>  MESON_SITE = https://github.com/mesonbuild/meson/releases/download/$(MESON_VERSION)
>  MESON_LICENSE = Apache-2.0
>  MESON_LICENSE_FILES = COPYING
> diff --git a/support/misc/cross-compilation.conf.in b/support/misc/cross-compilation.conf.in
> index 7053df472b..a58ab553d0 100644
> --- a/support/misc/cross-compilation.conf.in
> +++ b/support/misc/cross-compilation.conf.in
> @@ -10,7 +10,7 @@ ar = '@TARGET_AR@'
>  strip = '@TARGET_STRIP@'
>  cmake = '@BR2_CMAKE@'
>  fortran = '@TARGET_FC@'
> -pkgconfig = '@PKGCONF_HOST_BINARY@'
> +pkg-config = '@PKGCONF_HOST_BINARY@'
>  g-ir-compiler = '@STAGING_DIR@/usr/bin/g-ir-compiler'
>  g-ir-scanner = '@STAGING_DIR@/usr/bin/g-ir-scanner'
>  
> -- 
> 2.25.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Buildroot] [PATCH v4 1/7] package/meson: bump version to 1.3.1
  2024-02-02  9:36 ` [Buildroot] [PATCH v4 1/7] package/meson: bump version to 1.3.1 Antoine Coutant
  2024-02-07 15:23   ` Yann E. MORIN
@ 2024-02-07 15:30   ` Yann E. MORIN
  1 sibling, 0 replies; 22+ messages in thread
From: Yann E. MORIN @ 2024-02-07 15:30 UTC (permalink / raw)
  To: Antoine Coutant; +Cc: sebastian.weyer, bernd, romain.naour, buildroot

Antoine, All,

(sorry, I sent too fast, here are a bit more details below...)

On 2024-02-02 10:36 +0100, Antoine Coutant spake thusly:
> The meson upgrade from 1.1.1 to 1.2.0 have been reverted
> because host-qemu (version v8.0.3) was searching
> libraries in the build machine instead of buildroot host
> directory [1].
> $ grep -r LINK_ARGS  * | grep "\-L/usr"
> build.ninja: LINK_ARGS =
>     -L/usr/lib/gcc/x86_64-linux-gnu/10 \
>     -L/usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu \
>     -L/usr/lib/gcc/x86_64-linux-gnu/10/../../../../lib -L/usr/lib \
>     -L/lib/x86_64-linux-gnu \
>     -L/lib/../lib \
>     -L/usr/lib/../lib \
>     -L/usr/lib/gcc/x86_64-linux-gnu/10/../../.. \
>     -L/lib \
>     -I/[...]/host/include \
>     -L/[...]/host/lib \
>     -I/[...]/host/include/libfdt \
>     ...
> 
> Upgrading qemu to version v8.1.0 solves the problem:
> $ grep -r LINK_ARGS  * | grep "\-L/usr"
> build.ninja: LINK_ARGS =
>     -I/[...]/host/include \
>     -L/[...]/host/lib \
>     -I/[...]/host/include/libfdt \
>     ...
> 
> Those two tests were done with the same buildroot version
> (2023.08) on the same machine were the bug appeared. Using,
> git bisect, in this environment, it was found that the
> problem was fixed in qemu by the commit [2].
> 
> Thus, it is possible that the problem was introduced by
> improper use of meson by qemu <= v8.0.3. Also, meson has
> been updated to version 1.2.1 and 1.3.0 in yocto and it
> doesn't seem to create any issue. [3]
> 
> The original problem is no longer present and some
> projects require meson > 1.1.1 (e.g. rusticl requires
> meson 1.2.0 since mesa 23.3.0 and meson 1.3.1 since mesa
> 24.0.0).
> 
> "pkgconfig" field is deprecated by meson 1.3.0 and
> replaced by "pkg-config". See: [4]
> 
> The patch that adds the pkg_config_static property has
> been rebased.

I reflowed the commit log to approach the 72-char limit on line length
(I needed soemthing to do while there aas a test-build on-going!)

> [1] https://gitlab.com/buildroot.org/buildroot/-/commit/acfdf21f0b752e844a33c70a0fd2f82f4534a5a0
> [2] https://gitlab.com/qemu-project/qemu/-/commit/Fc9a809e0d28417fa1e7f7efc19f845bda4c1be9
> [3] https://github.com/yoctoproject/poky/commits/master/meta/recipes-devtools/meson
> [4] https://mesonbuild.com/Release-notes-for-1-3-0.html#machine-files-pkgconfig-field-deprecated-and-replaced-by-pkgconfig
> 
> Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
> ---
[--SNIP--]
>  diff --git a/mesonbuild/dependencies/pkgconfig.py b/mesonbuild/dependencies/pkgconfig.py
> -index 1e8d9132e..d902ba215 100644
> +index e86206b88..94888657d 100644
>  --- a/mesonbuild/dependencies/pkgconfig.py
>  +++ b/mesonbuild/dependencies/pkgconfig.py
> -@@ -338,7 +338,8 @@ class PkgConfigDependency(ExternalDependency):
> -         env = None
> -         libcmd = ['--libs']
> - 
> --        if self.static:
> -+        if self.static or \
> -+            (self.env.properties[self.for_machine].get('pkg_config_static', None) == 'true'):
> -             libcmd.append('--static')
> - 
> -         libcmd.append(self.name)
> +@@ -169,7 +169,7 @@ class PkgConfigCLI(PkgConfigInterface):
> +             env['PKG_CONFIG_ALLOW_SYSTEM_LIBS'] = '1'
> +         args: T.List[str] = []
> +         args += self._define_variable_args(define_variable)
> +-        if static:
> ++        if static or (self.env.properties[self.for_machine].get('pkg_config_static', None) == 'true'):

I changed that code back to have our addition on a separate line, so
that it stands out better when updating the patch.

Applied to master, thanks.

Regards,
Yann E. MORIN.

> +             args.append('--static')
> +         args += ['--libs', name]
> +         ret, out, err = self._call_pkgbin(args, env=env)
>  -- 
>  2.25.1
>  
> diff --git a/package/meson/meson.hash b/package/meson/meson.hash
> index cb36b674fa..150fd6d1bb 100644
> --- a/package/meson/meson.hash
> +++ b/package/meson/meson.hash
> @@ -1,4 +1,4 @@
>  # Locally calculated after checking pgp signature
> -# https://github.com/mesonbuild/meson/releases/download/1.1.1/meson-1.1.1.tar.gz.asc
> -sha256  d04b541f97ca439fb82fab7d0d480988be4bd4e62563a5ca35fadb5400727b1c  meson-1.1.1.tar.gz
> +# https://github.com/mesonbuild/meson/releases/download/1.3.1/meson-1.3.1.tar.gz.asc
> +sha256  6020568bdede1643d4fb41e28215be38eff5d52da28ac7d125457c59e0032ad7  meson-1.3.1.tar.gz
>  sha256  cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30  COPYING
> diff --git a/package/meson/meson.mk b/package/meson/meson.mk
> index 503aca8c25..467569d28b 100644
> --- a/package/meson/meson.mk
> +++ b/package/meson/meson.mk
> @@ -4,7 +4,7 @@
>  #
>  ################################################################################
>  
> -MESON_VERSION = 1.1.1
> +MESON_VERSION = 1.3.1
>  MESON_SITE = https://github.com/mesonbuild/meson/releases/download/$(MESON_VERSION)
>  MESON_LICENSE = Apache-2.0
>  MESON_LICENSE_FILES = COPYING
> diff --git a/support/misc/cross-compilation.conf.in b/support/misc/cross-compilation.conf.in
> index 7053df472b..a58ab553d0 100644
> --- a/support/misc/cross-compilation.conf.in
> +++ b/support/misc/cross-compilation.conf.in
> @@ -10,7 +10,7 @@ ar = '@TARGET_AR@'
>  strip = '@TARGET_STRIP@'
>  cmake = '@BR2_CMAKE@'
>  fortran = '@TARGET_FC@'
> -pkgconfig = '@PKGCONF_HOST_BINARY@'
> +pkg-config = '@PKGCONF_HOST_BINARY@'
>  g-ir-compiler = '@STAGING_DIR@/usr/bin/g-ir-compiler'
>  g-ir-scanner = '@STAGING_DIR@/usr/bin/g-ir-scanner'
>  
> -- 
> 2.25.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Buildroot] [PATCH v4 4/7] package/opencl-headers: new package
  2024-02-02  9:36 ` [Buildroot] [PATCH v4 4/7] package/opencl-headers: new package Antoine Coutant
@ 2024-02-07 15:58   ` Yann E. MORIN
  2024-02-12 13:44     ` Antoine Coutant
  0 siblings, 1 reply; 22+ messages in thread
From: Yann E. MORIN @ 2024-02-07 15:58 UTC (permalink / raw)
  To: Antoine Coutant; +Cc: sebastian.weyer, bernd, romain.naour, buildroot

Antoine, All,

On 2024-02-02 10:36 +0100, Antoine Coutant spake thusly:
> From: Sebastian Weyer <sebastian.weyer@smile.fr>
> 
> These headers provide the C language API bindings. It is a complement to
> the C++ bindings already available in opencl-clhpp. This package is
> required to build opencl-icd-loader:
> 
> https://github.com/KhronosGroup/OpenCL-ICD-Loader#dependencies
> 
> Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
> Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
> ---
[--SNIP--]
> diff --git a/package/opencl-headers/Config.in b/package/opencl-headers/Config.in
> new file mode 100644
> index 0000000000..092d8a2a4d
> --- /dev/null
> +++ b/package/opencl-headers/Config.in
> @@ -0,0 +1,7 @@
> +config BR2_PACKAGE_OPENCL_HEADERS
> +	bool "opencl-headers"
> +	depends on BR2_PACKAGE_HAS_LIBOPENCL

BR2_PACKAGE_HAS_LIBOPENCL can be set by mesa3d when BR2_PACKAGE_MESA3D_OPENCL
is enabled. In this case, will mesa3d install its own headers? If so,
that will generate a conflict.

Furthermore, this will also conflict with mesa3d-headers, and it also
installs CL headers.

So, why do we need opencl-headers and can't rely on the existing
mesa3d-headers package?

Regards,
Yann E. MORIN.

> +	help
> +	  C language headers for the OpenCL API
> +
> +	  https://github.com/KhronosGroup/OpenCL-Headers
> diff --git a/package/opencl-headers/opencl-headers.hash b/package/opencl-headers/opencl-headers.hash
> new file mode 100644
> index 0000000000..802ed05450
> --- /dev/null
> +++ b/package/opencl-headers/opencl-headers.hash
> @@ -0,0 +1,3 @@
> +#Locally generated
> +sha256  407d5e109a70ec1b6cd3380ce357c21e3d3651a91caae6d0d8e1719c69a1791d  OpenCL-Headers-2023.12.14.tar.gz
> +sha256  cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30  LICENSE
> diff --git a/package/opencl-headers/opencl-headers.mk b/package/opencl-headers/opencl-headers.mk
> new file mode 100644
> index 0000000000..7aa0e0d168
> --- /dev/null
> +++ b/package/opencl-headers/opencl-headers.mk
> @@ -0,0 +1,22 @@
> +################################################################################
> +#
> +# opencl-headers
> +#
> +################################################################################
> +
> +OPENCL_HEADERS_VERSION = 2023.12.14
> +OPENCL_HEADERS_SOURCE = OpenCL-Headers-$(OPENCL_HEADERS_VERSION).tar.gz
> +OPENCL_HEADERS_SITE = $(call github,KhronosGroup,OpenCL-Headers,v$(OPENCL_HEADERS_VERSION))
> +OPENCL_HEADERS_LICENSE = Apache-2.0
> +OPENCL_HEADERS_LICENSE_FILES = LICENSE
> +OPENCL_HEADERS_INSTALL_STAGING = YES
> +
> +OPENCL_HEADERS_INSTALL_TARGET = NO
> +
> +define OPENCL_HEADERS_INSTALL_STAGING_CMDS
> +	mkdir -p $(STAGING_DIR)/usr/include/CL
> +	$(INSTALL) -D -m 0644 $(@D)/CL/* \
> +		$(STAGING_DIR)/usr/include/CL
> +endef
> +
> +$(eval $(generic-package))
> -- 
> 2.25.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Buildroot] [PATCH v4 5/7] package/opencl-icd-loader: new package
  2024-02-02  9:36 ` [Buildroot] [PATCH v4 5/7] package/opencl-icd-loader: " Antoine Coutant
@ 2024-02-07 16:01   ` Yann E. MORIN
  2024-02-12 14:19     ` Antoine Coutant
  0 siblings, 1 reply; 22+ messages in thread
From: Yann E. MORIN @ 2024-02-07 16:01 UTC (permalink / raw)
  To: Antoine Coutant; +Cc: sebastian.weyer, bernd, romain.naour, buildroot

Antoine, All,

On 2024-02-02 10:36 +0100, Antoine Coutant spake thusly:
> From: Sebastian Weyer <sebastian.weyer@smile.fr>
> 
> With this package it is possible to have multiple implementations of
> OpenCL at the same time. This package provides a libOpenCL.so file that
> captures the OpenCL API calls and forwards them to the correct
> implementation of OpenCL. OpenCL implementations can be manually
> registered by creating a file containing its full file path in
> /etc/OpenCL/vendors/<implementation>.icd[1]
> 
> This package is required by certain OpenCL implementations, for example
> Mesa3D's Clover implementation if it is not built in standalone mode.
> 
> [1] https://github.com/KhronosGroup/OpenCL-ICD-Loader#registering-icds
> 
> Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
> Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
> ---
[--SNIP--]
> diff --git a/package/opencl-icd-loader/Config.in b/package/opencl-icd-loader/Config.in
> new file mode 100644
> index 0000000000..405dc5401a
> --- /dev/null
> +++ b/package/opencl-icd-loader/Config.in
> @@ -0,0 +1,12 @@
> +config BR2_PACKAGE_OPENCL_ICD_LOADER
> +	bool "OpenCL-ICD-Loader"
> +	depends on BR2_INSTALL_LIBSTDCPP
> +	depends on BR2_PACKAGE_HAS_LIBOPENCL
> +	select BR2_PACKAGE_OPENCL_HEADERS

Following on the review of the previous patch: maybe that could rely on
mesa3d-headers, and if so, we'ds not need to introduce a new
opencl-headers package.

Regards,
Yann E. MORIN.

> +	help
> +	  OpenCL defines an Installable Client Driver (ICD) mechanism to
> +	  allow developers to build applications against an Installable
> +	  Client Driver loader (ICD loader) rather than linking their
> +	  applications against a specific OpenCL implementation.
> +
> +	  https://github.com/KhronosGroup/OpenCL-ICD-Loader
> diff --git a/package/opencl-icd-loader/opencl-icd-loader.hash b/package/opencl-icd-loader/opencl-icd-loader.hash
> new file mode 100644
> index 0000000000..1c894f1293
> --- /dev/null
> +++ b/package/opencl-icd-loader/opencl-icd-loader.hash
> @@ -0,0 +1,3 @@
> +# locally generated
> +sha256  af8df96f1e1030329e8d4892ba3aa761b923838d4c689ef52d97822ab0bd8917  OpenCL-ICD-Loader-2023.12.14.tar.gz
> +sha256  c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4  LICENSE
> diff --git a/package/opencl-icd-loader/opencl-icd-loader.mk b/package/opencl-icd-loader/opencl-icd-loader.mk
> new file mode 100644
> index 0000000000..04f6fb4b85
> --- /dev/null
> +++ b/package/opencl-icd-loader/opencl-icd-loader.mk
> @@ -0,0 +1,19 @@
> +################################################################################
> +#
> +# opencl-icd-loader
> +#
> +################################################################################
> +
> +OPENCL_ICD_LOADER_VERSION = 2023.12.14
> +OPENCL_ICD_LOADER_SOURCE = OpenCL-ICD-Loader-$(OPENCL_ICD_LOADER_VERSION).tar.gz
> +OPENCL_ICD_LOADER_SITE = $(call github,KhronosGroup,OpenCL-ICD-Loader,v$(OPENCL_ICD_LOADER_VERSION))
> +OPENCL_ICD_LOADER_LICENSE = Apache-2.0
> +OPENCL_ICD_LOADER_LICENSE_FILES = LICENSE
> +OPENCL_ICD_LOADER_INSTALL_STAGING = YES
> +
> +OPENCL_ICD_LOADER_DEPENDENCIES = opencl-headers
> +
> +OPENCL_ICD_LOADER_CONF_OPTS += -DOPENCL_ICD_LOADER_HEADERS_DIR=$(STAGING_DIR)/usr/include
> +
> +$(eval $(cmake-package))
> +$(eval $(host-cmake-package))
> -- 
> 2.25.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Buildroot] [PATCH v4 6/7] package/llvm-project: add opencl-c-base.h on target
  2024-02-02  9:36 ` [Buildroot] [PATCH v4 6/7] package/llvm-project: add opencl-c-base.h on target Antoine Coutant
@ 2024-02-07 19:07   ` Yann E. MORIN
  2024-02-12 14:54     ` Antoine Coutant
  0 siblings, 1 reply; 22+ messages in thread
From: Yann E. MORIN @ 2024-02-07 19:07 UTC (permalink / raw)
  To: Antoine Coutant; +Cc: sebastian.weyer, bernd, romain.naour, buildroot

Antoine, All,

On 2024-02-02 10:36 +0100, Antoine Coutant spake thusly:
> rusticl depends on the mesa clc_compile_to_llvm_module function.
> This function requires opencl-c-base.h when LLVM version >= 15.
> 
> The header is deleted automatically by CLANG_FILES_TO_REMOVE
> post install target hook in llvm-project/clang package.
> When rusticl is enabled, after the whole clang directory has
> been removed, the header is copied back to
> /usr/lib/clang/$(LLVM_PROJECT_VERSION)/include/
> 
> By default, the mesa3d variable used to retrieve the header
> is set to the staging directory on the host machine. A merge
> request on mesa's gitlab solved this problem. See:
> 
> https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25568
> 
> The patches have been backported to mesa 23.3.4.
> 
> Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
> ---
> Changes v3 -> v4:
> 	- Add patches merged by mesa upstream.

Adding those patches has nothing to do in this commit, but should in the
next one, that adds rusticl support in mesa3d, right?

Regards,
Yann E. MORIN.

> ---
> Running an app that uses rusticl leads to an error.
> Example:
> 
> RUSTICL_ENABLE=panfrost clpeak
> 
> Platform: rusticl
>   Device: Mali-G52 (Panfrost)
>     Driver version  : 23.3.4 (Linux ARM64)
>     Compute units   : 2
>     Clock frequency : 800 MHz
>     Build Log: <built-in>:1:10: fatal error: 'opencl-c-base.h' file not found
> Error executing LLVM compilation action.
> 
> Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
> ---
>  package/llvm-project/clang/clang.mk           |  9 ++
>  ...ncl-external-clang-headers-option-an.patch | 72 ++++++++++++++++
>  ...or-every-user-when-using-shared-LLVM.patch | 40 +++++++++
>  ...lc-retrieve-libclang-path-at-runtime.patch | 86 +++++++++++++++++++
>  4 files changed, 207 insertions(+)
>  create mode 100644 package/mesa3d/0006-meson-remove-opencl-external-clang-headers-option-an.patch
>  create mode 100644 package/mesa3d/0007-clc-force-fPIC-for-every-user-when-using-shared-LLVM.patch
>  create mode 100644 package/mesa3d/0008-clc-retrieve-libclang-path-at-runtime.patch
> 
> diff --git a/package/llvm-project/clang/clang.mk b/package/llvm-project/clang/clang.mk
> index 0bafd6461b..09aac7f0ec 100644
> --- a/package/llvm-project/clang/clang.mk
> +++ b/package/llvm-project/clang/clang.mk
> @@ -90,6 +90,15 @@ define HOST_CLANG_INSTALL_CLANG_TBLGEN
>  endef
>  HOST_CLANG_POST_INSTALL_HOOKS = HOST_CLANG_INSTALL_CLANG_TBLGEN
>  
> +# Rusticl needs opencl-c-base.h to be present on the target.
> +define CLANG_OPENCL_C_BASE_HEADER_TO_TARGET
> +	mkdir -p $(TARGET_DIR)/usr/lib/clang/$(LLVM_PROJECT_VERSION)/include
> +	$(INSTALL) -D -m 0644 $(@D)/lib/Headers/opencl-c-base.h $(TARGET_DIR)/usr/lib/clang/$(LLVM_PROJECT_VERSION)/include/opencl-c-base.h
> +endef
> +ifeq ($(BR2_PACKAGE_MESA3D_RUSTICL),y)
> +CLANG_POST_INSTALL_TARGET_HOOKS += CLANG_OPENCL_C_BASE_HEADER_TO_TARGET
> +endif
> +
>  # This option must be enabled to link libclang dynamically against libLLVM.so
>  HOST_CLANG_CONF_OPTS += -DLLVM_LINK_LLVM_DYLIB=ON
>  CLANG_CONF_OPTS += -DLLVM_LINK_LLVM_DYLIB=ON
> diff --git a/package/mesa3d/0006-meson-remove-opencl-external-clang-headers-option-an.patch b/package/mesa3d/0006-meson-remove-opencl-external-clang-headers-option-an.patch
> new file mode 100644
> index 0000000000..ebe3542627
> --- /dev/null
> +++ b/package/mesa3d/0006-meson-remove-opencl-external-clang-headers-option-an.patch
> @@ -0,0 +1,72 @@
> +From b7f2ada31d85dfd2e9906a7343d14a3b0b85cf14 Mon Sep 17 00:00:00 2001
> +From: Karol Herbst <kherbst@redhat.com>
> +Date: Tue, 2 Jan 2024 22:58:39 +0100
> +Subject: [PATCH 1/3] meson: remove opencl-external-clang-headers option and
> + rely on shared-llvm
> +
> +Setting opencl-external-clang-headers to enabled while using shared LLVM
> +was broken and this option was mostly used for windows to force static
> +inclusion of opencl base headers.
> +
> +Simply relying on the shared-llvm option here is enough to get what we
> +want.
> +
> +Signed-off-by: Karol Herbst <kherbst@redhat.com>
> +Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
> +Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25568>
> +[antoine.coutant@smile.fr: backported to mesa-23.3.4]
> +Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
> +---
> + .gitlab-ci/windows/mesa_build.ps1 | 1 -
> + meson_options.txt                 | 7 -------
> + src/compiler/clc/meson.build      | 4 +---
> + 3 files changed, 1 insertion(+), 11 deletions(-)
> +
> +diff --git a/.gitlab-ci/windows/mesa_build.ps1 b/.gitlab-ci/windows/mesa_build.ps1
> +index a4f87c4eadb..e79eb6b6587 100644
> +--- a/.gitlab-ci/windows/mesa_build.ps1
> ++++ b/.gitlab-ci/windows/mesa_build.ps1
> +@@ -59,7 +59,6 @@ meson setup `
> + -Dopencl-spirv=true `
> + -Dmicrosoft-clc=enabled `
> + -Dstatic-libclc=all `
> +--Dopencl-external-clang-headers=disabled `
> + -Dspirv-to-dxil=true `
> + -Dbuild-tests=true `
> + -Dwerror=true `
> +diff --git a/meson_options.txt b/meson_options.txt
> +index e885ba61a8a..537ba797407 100644
> +--- a/meson_options.txt
> ++++ b/meson_options.txt
> +@@ -191,13 +191,6 @@ option(
> +   description : 'Link libclc SPIR-V statically.',
> + )
> + 
> +-option(
> +-  'opencl-external-clang-headers',
> +-  type : 'feature',
> +-  description : 'Use system Clang headers at runtime for OpenCL kernel ' +
> +-                'compilation.',
> +-)
> +-
> + option(
> +   'd3d-drivers-path',
> +   type : 'string',
> +diff --git a/src/compiler/clc/meson.build b/src/compiler/clc/meson.build
> +index 3e4f1a7f441..81345225768 100644
> +--- a/src/compiler/clc/meson.build
> ++++ b/src/compiler/clc/meson.build
> +@@ -30,9 +30,7 @@ _libmesaclc_c_args = []
> + _libmesaclc_cpp_args = ['-DLLVM_LIB_DIR="@0@"'.format(llvm_libdir)]
> + _libmesaclc_sources = []
> + 
> +-if get_option('opencl-external-clang-headers') \
> +-   .disable_auto_if(host_machine.system() == 'windows') \
> +-   .disabled()
> ++if not _shared_llvm
> +   # LLVM 16 moved clang header path from using full version to only major version
> +   if dep_llvm.version().version_compare('< 16')
> +     # Prior to LLVM 16, this path used a full version
> +-- 
> +2.25.1
> +
> diff --git a/package/mesa3d/0007-clc-force-fPIC-for-every-user-when-using-shared-LLVM.patch b/package/mesa3d/0007-clc-force-fPIC-for-every-user-when-using-shared-LLVM.patch
> new file mode 100644
> index 0000000000..3560f6805f
> --- /dev/null
> +++ b/package/mesa3d/0007-clc-force-fPIC-for-every-user-when-using-shared-LLVM.patch
> @@ -0,0 +1,40 @@
> +From 56c85c4c7a757a9ba3d8ac08e6c4c4c7f19e6cab Mon Sep 17 00:00:00 2001
> +From: Karol Herbst <kherbst@redhat.com>
> +Date: Thu, 11 Jan 2024 14:55:46 +0100
> +Subject: [PATCH 2/3] clc: force fPIC for every user when using shared LLVM
> +
> +As we want to start using `dladdr`, this is needed to prevent `dladdr`
> +returning information of the wrong file.
> +
> +Fixes tag as it's required by the actual fix.
> +
> +Signed-off-by: Karol Herbst <kherbst@redhat.com>
> +Fixes: e22491c8326 ("clc: fetch clang resource dir at runtime")
> +Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25568>
> +[antoine.coutant@smile.fr: backported to mesa-23.3.4]
> +Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
> +---
> + src/compiler/clc/meson.build | 6 ++++++
> + 1 file changed, 6 insertions(+)
> +
> +diff --git a/src/compiler/clc/meson.build b/src/compiler/clc/meson.build
> +index 81345225768..442a583065b 100644
> +--- a/src/compiler/clc/meson.build
> ++++ b/src/compiler/clc/meson.build
> +@@ -123,7 +123,13 @@ _libmesaclc = static_library(
> +                  idep_mesautil, dep_spirv_tools]
> + )
> + 
> ++_idep_mesaclc_link_args = []
> ++if _shared_llvm
> ++  _idep_mesaclc_link_args += cc.get_supported_link_arguments('-fPIC')
> ++endif
> ++
> + idep_mesaclc = declare_dependency(
> +   link_with : _libmesaclc,
> +   include_directories : include_directories('.'),
> ++  link_args : _idep_mesaclc_link_args,
> + )
> +-- 
> +2.25.1
> +
> diff --git a/package/mesa3d/0008-clc-retrieve-libclang-path-at-runtime.patch b/package/mesa3d/0008-clc-retrieve-libclang-path-at-runtime.patch
> new file mode 100644
> index 0000000000..c19ba7d2b7
> --- /dev/null
> +++ b/package/mesa3d/0008-clc-retrieve-libclang-path-at-runtime.patch
> @@ -0,0 +1,86 @@
> +From fa2c045e04370beb454951c32bccc087638e04c7 Mon Sep 17 00:00:00 2001
> +From: Antoine Coutant <antoine.coutant@smile.fr>
> +Date: Thu, 30 Nov 2023 11:10:20 +0100
> +Subject: [PATCH 3/3] clc: retrieve libclang path at runtime.
> +
> +LLVM_LIB_DIR is a variable used for runtime compilations.
> +When cross compiling, LLVM_LIB_DIR must be set to the
> +libclang path on the target. So, this path should not
> +be retrieved during compilation but at runtime.
> +
> +dladdr uses an address to search for a loaded library.
> +If a library is found, it returns information about it.
> +The path to the libclang library can therefore be
> +retrieved using one of its functions. This is useful
> +because we don't know the name of the libclang library
> +(libclang.so.X or libclang-cpp.so.X)
> +
> +v2 (Karol): use clang::CompilerInvocation::CreateFromArgs for dladdr
> +v3 (Karol): follow symlinks to fix errors on debian
> +
> +Fixes: e22491c8326 ("clc: fetch clang resource dir at runtime")
> +Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
> +Reviewed-by: Karol Herbst <kherbst@redhat.com>
> +Reviewed-by (v1): Jesse Natalie <jenatali@microsoft.com>
> +[antoine.coutant@smile.fr: backported to mesa-23.3.4]
> +
> +Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25568>
> +---
> + src/compiler/clc/clc_helpers.cpp | 24 +++++++++++++++++++++---
> + 1 file changed, 21 insertions(+), 3 deletions(-)
> +
> +diff --git a/src/compiler/clc/clc_helpers.cpp b/src/compiler/clc/clc_helpers.cpp
> +index 55287f22683..22eb3495be9 100644
> +--- a/src/compiler/clc/clc_helpers.cpp
> ++++ b/src/compiler/clc/clc_helpers.cpp
> +@@ -23,6 +23,7 @@
> + // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> + // OTHER DEALINGS IN THE SOFTWARE.
> + 
> ++#include <cstdlib>
> + #include <filesystem>
> + #include <sstream>
> + #include <mutex>
> +@@ -57,6 +58,10 @@
> + 
> + #include "spirv.h"
> + 
> ++#if DETECT_OS_UNIX
> ++#include <dlfcn.h>
> ++#endif
> ++
> + #ifdef USE_STATIC_OPENCL_C_H
> + #if LLVM_VERSION_MAJOR < 15
> + #include "opencl-c.h.h"
> +@@ -876,12 +881,25 @@ clc_compile_to_llvm_module(LLVMContext &llvm_ctx,
> + #endif
> +    }
> + #else
> ++
> ++   Dl_info info;
> ++   if (dladdr((void *)clang::CompilerInvocation::CreateFromArgs, &info) == 0) {
> ++      clc_error(logger, "Couldn't find libclang path.\n");
> ++      return {};
> ++   }
> ++
> ++   char *clang_path = realpath(info.dli_fname, NULL);
> ++   if (clang_path == nullptr) {
> ++      clc_error(logger, "Couldn't find libclang path.\n");
> ++      return {};
> ++   }
> ++
> +    // GetResourcePath is a way to retrive the actual libclang resource dir based on a given binary
> +-   // or library. The path doesn't even need to exist, we just have to put something in there,
> +-   // because we might have linked clang statically.
> ++   // or library.
> +    auto libclang_path = fs::path(LLVM_LIB_DIR) / "libclang.so";
> +    auto clang_res_path =
> +-      fs::path(Driver::GetResourcesPath(libclang_path.string(), CLANG_RESOURCE_DIR)) / "include";
> ++      fs::path(Driver::GetResourcesPath(std::string(clang_path), CLANG_RESOURCE_DIR)) / "include";
> ++   free(clang_path);
> + 
> +    c->getHeaderSearchOpts().UseBuiltinIncludes = true;
> +    c->getHeaderSearchOpts().UseStandardSystemIncludes = true;
> +-- 
> +2.25.1
> +
> -- 
> 2.25.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Buildroot] [PATCH v4 2/7] package/pkg-meson.mk: add rust cross-compiler support
  2024-02-07 15:13   ` Yann E. MORIN
@ 2024-02-08 10:25     ` Antoine Coutant
  0 siblings, 0 replies; 22+ messages in thread
From: Antoine Coutant @ 2024-02-08 10:25 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: sebastian.weyer, bernd, romain.naour, buildroot


On 07/02/2024 16:13, Yann E. MORIN wrote:
> Antoine, All,
>
> On 2024-02-02 10:36 +0100, Antoine Coutant spake thusly:
>> From: Romain Naour <romain.naour@smile.fr>
>>
>> This change is needed to be able to build target packages requiring
>> rust. If a package has rust in its project or in an add_language()
>> call in their meson.build file, meson will try to find a suitable
>> compiler for this language[1]. If the language is classified as
>> required but not found, it will abort the build.
>>
>> It is necessary to specify rust and rust_ld separately in
>> support/misc/cross-compilation.conf.in. If you specify it in one line
>> just as "rust", it will generate the following warning:
>>      WARNING: Please do not put -C linker= in your compiler command,
>>      set rust_ld=command in your cross file or use the RUST_LD environment
>>      variable, otherwise meson will override your selection.
>>
>> [1] https://mesonbuild.com/Reference-manual_functions.html#add_languages
>>
>> Signed-off-by: Romain Naour <romain.naour@smile.fr>
>> Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
>> Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
>> ---
>>   package/pkg-meson.mk                   | 13 +++++++++++++
>>   support/misc/cross-compilation.conf.in |  2 ++
>>   2 files changed, 15 insertions(+)
>>
>> diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
>> index 65cabf23ba..25dd4f0d7f 100644
>> --- a/package/pkg-meson.mk
>> +++ b/package/pkg-meson.mk
>> @@ -82,6 +82,16 @@ else
>>   PKG_MESON_TARGET_FC = /bin/false
>>   endif
>>   
>> +ifeq ($(BR2_PACKAGE_HOST_RUSTC),y)
>> +PKG_MESON_TARGET_RUSTC = $(HOST_DIR)/bin/rustc
>> +PKG_MESON_TARGET_RUSTC_LINKER = $(notdir $(TARGET_CROSS))gcc
> Why can't PKG_MESON_TARGET_RUSTC_LINKER be an absolute path, when
> PKG_MESON_TARGET_RUSTC is one, and [...]

I tested with an absolute path and it worked. I don't know

why I chose to use a relative path.


Thanks for the report, I will make the change in the v5.


Regards,

Antoine Coutant

>> +PKG_MESON_TARGET_RUSTC_TARGET_NAME = $(RUSTC_TARGET_NAME)
>> +else
>> +PKG_MESON_TARGET_RUSTC = /bin/false
>> +PKG_MESON_TARGET_RUSTC_LINKER = /bin/false
> [...] especially since here PKG_MESON_TARGET_RUSTC_LINKER is an absolute
> path?
>
> Regards,
> Yann E. MORIN.
>
>> +PKG_MESON_TARGET_RUSTC_TARGET_NAME =
>> +endif
>> +
>>   # Generates sed patterns for patching the cross-compilation.conf template,
>>   # since Flags might contain commas the arguments are passed indirectly by
>>   # variable name (stripped to deal with whitespaces).
>> @@ -91,6 +101,7 @@ define PKG_MESON_CROSSCONFIG_SED
>>           -e "s%@TARGET_CXX@%$(PKG_MESON_TARGET_CXX)%g" \
>>           -e "s%@TARGET_AR@%$(TARGET_AR)%g" \
>>           -e "s%@TARGET_FC@%$(PKG_MESON_TARGET_FC)%g" \
>> +        -e "s%@TARGET_RUSTC@%$(PKG_MESON_TARGET_RUSTC)%g" \
>>           -e "s%@TARGET_STRIP@%$(TARGET_STRIP)%g" \
>>           -e "s%@TARGET_ARCH@%$(PKG_MESON_TARGET_CPU_FAMILY)%g" \
>>           -e "s%@TARGET_CPU@%$(GCC_TARGET_CPU)%g" \
>> @@ -99,6 +110,8 @@ define PKG_MESON_CROSSCONFIG_SED
>>           -e "s%@TARGET_CFLAGS@%$(call make-sq-comma-list,$($(strip $(1))))%g" \
>>           -e "s%@TARGET_LDFLAGS@%$(call make-sq-comma-list,$($(strip $(3))))%g" \
>>           -e "s%@TARGET_CXXFLAGS@%$(call make-sq-comma-list,$($(strip $(2))))%g" \
>> +        -e "s%@TARGET_RUSTC_LINKER@%$(PKG_MESON_TARGET_RUSTC_LINKER)%g" \
>> +        -e "s%@RUSTC_TARGET_NAME@%$(PKG_MESON_TARGET_RUSTC_TARGET_NAME)%g" \
>>           -e "s%@BR2_CMAKE@%$(BR2_CMAKE)%g" \
>>           -e "s%@PKGCONF_HOST_BINARY@%$(HOST_DIR)/bin/pkgconf%g" \
>>           -e "s%@HOST_DIR@%$(HOST_DIR)%g" \
>> diff --git a/support/misc/cross-compilation.conf.in b/support/misc/cross-compilation.conf.in
>> index a58ab553d0..21cec10b82 100644
>> --- a/support/misc/cross-compilation.conf.in
>> +++ b/support/misc/cross-compilation.conf.in
>> @@ -13,6 +13,8 @@ fortran = '@TARGET_FC@'
>>   pkg-config = '@PKGCONF_HOST_BINARY@'
>>   g-ir-compiler = '@STAGING_DIR@/usr/bin/g-ir-compiler'
>>   g-ir-scanner = '@STAGING_DIR@/usr/bin/g-ir-scanner'
>> +rust = ['@TARGET_RUSTC@', '--target', '@RUSTC_TARGET_NAME@' ]
>> +rust_ld = '@TARGET_RUSTC_LINKER@'
>>   
>>   [built-in options]
>>   c_args = [@TARGET_CFLAGS@]
>> -- 
>> 2.25.1
>>
>> _______________________________________________
>> buildroot mailing list
>> buildroot@buildroot.org
>> https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Buildroot] [PATCH v4 4/7] package/opencl-headers: new package
  2024-02-07 15:58   ` Yann E. MORIN
@ 2024-02-12 13:44     ` Antoine Coutant
  2024-02-21 13:26       ` Antoine Coutant
  2024-02-21 16:55       ` Antoine Coutant
  0 siblings, 2 replies; 22+ messages in thread
From: Antoine Coutant @ 2024-02-12 13:44 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: sebastian.weyer, bernd, romain.naour, buildroot


[-- Attachment #1.1: Type: text/plain, Size: 4756 bytes --]

Yann, All,

On 07/02/2024 16:58, Yann E. MORIN wrote:
> Antoine, All,
>
> On 2024-02-02 10:36 +0100, Antoine Coutant spake thusly:
>> From: Sebastian Weyer<sebastian.weyer@smile.fr>
>>
>> These headers provide the C language API bindings. It is a complement to
>> the C++ bindings already available in opencl-clhpp. This package is
>> required to build opencl-icd-loader:
>>
>> https://github.com/KhronosGroup/OpenCL-ICD-Loader#dependencies
>>
>> Signed-off-by: Sebastian Weyer<sebastian.weyer@smile.fr>
>> Signed-off-by: Antoine Coutant<antoine.coutant@smile.fr>
>> ---
> [--SNIP--]
>> diff --git a/package/opencl-headers/Config.in b/package/opencl-headers/Config.in
>> new file mode 100644
>> index 0000000000..092d8a2a4d
>> --- /dev/null
>> +++ b/package/opencl-headers/Config.in
>> @@ -0,0 +1,7 @@
>> +config BR2_PACKAGE_OPENCL_HEADERS
>> +	bool "opencl-headers"
>> +	depends on BR2_PACKAGE_HAS_LIBOPENCL
> BR2_PACKAGE_HAS_LIBOPENCL can be set by mesa3d when BR2_PACKAGE_MESA3D_OPENCL
> is enabled. In this case, will mesa3d install its own headers? If so,
> that will generate a conflict.

BR2_PACKAGE_HAS_LIBOPENCL doesn't guarantee that CL headers

will be installed. Mesa3d install headers if Clover is enabled and

opencl-icd is disabled [1]. So you are right, it will generate conflict in

case OpenCL-Headers and Clover are built without icd mode.

> Furthermore, this will also conflict with mesa3d-headers, and it also
> installs CL headers.
Yes, this will generate the same conflict here...
>
> So, why do we need opencl-headers and can't rely on the existing
> mesa3d-headers package?

The problem is that the headers installed by mesa differ from those

in the OpenCL-Headers package.

$ diff -q OpenCL-Headers/CL/cl_icd.h mesa/include/CL/cl_icd.h
Files OpenCL-Headers/CL/cl_icd.h and mesa/include/CL/cl_icd.h differ

This diff was performed using OpenCL-Headers v2023.12.14 and

mesa-23.3.4. Moreover, cl_layer.h, cl_half.h and cl_function_types.h 
files are

missing from mesa headers. These differences causes errors when building

opencl-icd-loader:

...

./build/opencl-icd-loader-2023.12.14/loader/icd.c:23:10: fatal error: 
CL/cl_layer.h: No such file or directory

    23 | #include <CL/cl_layer.h>

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

compilation terminated.

./build/opencl-icd-loader-2023.12.14/loader/icd_dispatch.c:26:8: error: 
unknown type name ‘clGetICDLoaderInfoOCLICD_t’

    26 | static clGetICDLoaderInfoOCLICD_t clGetICDLoaderInfoOCLICD;

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

...

This is why we cannot rely on mesa3d headers and why OpenCL-Headers

package is required.

> Regards,
> Yann E. MORIN.

I will add guards to prevent conflicts in the v5. And add some lines

in the commit log to explain why mesa3d headers can't be used to

build OpenCL-ICD-Loader.


Thanks for your feedback !


[1]: 
https://gitlab.freedesktop.org/mesa/mesa/-/blob/23.3/include/meson.build?ref_type=heads#L135


Regards,

Antoine Coutant

>
>> +	help
>> +	  C language headers for the OpenCL API
>> +
>> +	https://github.com/KhronosGroup/OpenCL-Headers
>> diff --git a/package/opencl-headers/opencl-headers.hash b/package/opencl-headers/opencl-headers.hash
>> new file mode 100644
>> index 0000000000..802ed05450
>> --- /dev/null
>> +++ b/package/opencl-headers/opencl-headers.hash
>> @@ -0,0 +1,3 @@
>> +#Locally generated
>> +sha256  407d5e109a70ec1b6cd3380ce357c21e3d3651a91caae6d0d8e1719c69a1791d  OpenCL-Headers-2023.12.14.tar.gz
>> +sha256  cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30  LICENSE
>> diff --git a/package/opencl-headers/opencl-headers.mk b/package/opencl-headers/opencl-headers.mk
>> new file mode 100644
>> index 0000000000..7aa0e0d168
>> --- /dev/null
>> +++ b/package/opencl-headers/opencl-headers.mk
>> @@ -0,0 +1,22 @@
>> +################################################################################
>> +#
>> +# opencl-headers
>> +#
>> +################################################################################
>> +
>> +OPENCL_HEADERS_VERSION = 2023.12.14
>> +OPENCL_HEADERS_SOURCE = OpenCL-Headers-$(OPENCL_HEADERS_VERSION).tar.gz
>> +OPENCL_HEADERS_SITE = $(call github,KhronosGroup,OpenCL-Headers,v$(OPENCL_HEADERS_VERSION))
>> +OPENCL_HEADERS_LICENSE = Apache-2.0
>> +OPENCL_HEADERS_LICENSE_FILES = LICENSE
>> +OPENCL_HEADERS_INSTALL_STAGING = YES
>> +
>> +OPENCL_HEADERS_INSTALL_TARGET = NO
>> +
>> +define OPENCL_HEADERS_INSTALL_STAGING_CMDS
>> +	mkdir -p $(STAGING_DIR)/usr/include/CL
>> +	$(INSTALL) -D -m 0644 $(@D)/CL/* \
>> +		$(STAGING_DIR)/usr/include/CL
>> +endef
>> +
>> +$(eval $(generic-package))
>> -- 
>> 2.25.1
>>
>> _______________________________________________
>> buildroot mailing list
>> buildroot@buildroot.org
>> https://lists.buildroot.org/mailman/listinfo/buildroot

[-- Attachment #1.2: Type: text/html, Size: 13793 bytes --]

[-- Attachment #2: Type: text/plain, Size: 150 bytes --]

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Buildroot] [PATCH v4 5/7] package/opencl-icd-loader: new package
  2024-02-07 16:01   ` Yann E. MORIN
@ 2024-02-12 14:19     ` Antoine Coutant
  0 siblings, 0 replies; 22+ messages in thread
From: Antoine Coutant @ 2024-02-12 14:19 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: sebastian.weyer, bernd, romain.naour, buildroot

Yann, All,


On 07/02/2024 17:01, Yann E. MORIN wrote:
> Antoine, All,
>
> On 2024-02-02 10:36 +0100, Antoine Coutant spake thusly:
>> From: Sebastian Weyer <sebastian.weyer@smile.fr>
>>
>> With this package it is possible to have multiple implementations of
>> OpenCL at the same time. This package provides a libOpenCL.so file that
>> captures the OpenCL API calls and forwards them to the correct
>> implementation of OpenCL. OpenCL implementations can be manually
>> registered by creating a file containing its full file path in
>> /etc/OpenCL/vendors/<implementation>.icd[1]
>>
>> This package is required by certain OpenCL implementations, for example
>> Mesa3D's Clover implementation if it is not built in standalone mode.
>>
>> [1] https://github.com/KhronosGroup/OpenCL-ICD-Loader#registering-icds
>>
>> Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
>> Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
>> ---
> [--SNIP--]
>> diff --git a/package/opencl-icd-loader/Config.in b/package/opencl-icd-loader/Config.in
>> new file mode 100644
>> index 0000000000..405dc5401a
>> --- /dev/null
>> +++ b/package/opencl-icd-loader/Config.in
>> @@ -0,0 +1,12 @@
>> +config BR2_PACKAGE_OPENCL_ICD_LOADER
>> +	bool "OpenCL-ICD-Loader"
>> +	depends on BR2_INSTALL_LIBSTDCPP
>> +	depends on BR2_PACKAGE_HAS_LIBOPENCL
>> +	select BR2_PACKAGE_OPENCL_HEADERS
> Following on the review of the previous patch: maybe that could rely on
> mesa3d-headers, and if so, we'ds not need to introduce a new
> opencl-headers package.

As I answered to the previous patch review, the headers installed

by mesa differ from those installed by OpenCL-Headers. Indeed,

mesa headers are fetched from OpenCL-Headers by [1] but

nothing guarantees that their version will match OpenCL-ICD-Loader

version. Therefore, the OpenCL-ICD-Loader build fails with mesa

headers. That's why we need OpenCL-Headers here.


I'll explain it in the v5 commit message.


[1}: 
https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/bin/khronos-update.py


Regards,

Antoine Coutant

>
> Regards,
> Yann E. MORIN.
>
>> +	help
>> +	  OpenCL defines an Installable Client Driver (ICD) mechanism to
>> +	  allow developers to build applications against an Installable
>> +	  Client Driver loader (ICD loader) rather than linking their
>> +	  applications against a specific OpenCL implementation.
>> +
>> +	  https://github.com/KhronosGroup/OpenCL-ICD-Loader
>> diff --git a/package/opencl-icd-loader/opencl-icd-loader.hash b/package/opencl-icd-loader/opencl-icd-loader.hash
>> new file mode 100644
>> index 0000000000..1c894f1293
>> --- /dev/null
>> +++ b/package/opencl-icd-loader/opencl-icd-loader.hash
>> @@ -0,0 +1,3 @@
>> +# locally generated
>> +sha256  af8df96f1e1030329e8d4892ba3aa761b923838d4c689ef52d97822ab0bd8917  OpenCL-ICD-Loader-2023.12.14.tar.gz
>> +sha256  c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4  LICENSE
>> diff --git a/package/opencl-icd-loader/opencl-icd-loader.mk b/package/opencl-icd-loader/opencl-icd-loader.mk
>> new file mode 100644
>> index 0000000000..04f6fb4b85
>> --- /dev/null
>> +++ b/package/opencl-icd-loader/opencl-icd-loader.mk
>> @@ -0,0 +1,19 @@
>> +################################################################################
>> +#
>> +# opencl-icd-loader
>> +#
>> +################################################################################
>> +
>> +OPENCL_ICD_LOADER_VERSION = 2023.12.14
>> +OPENCL_ICD_LOADER_SOURCE = OpenCL-ICD-Loader-$(OPENCL_ICD_LOADER_VERSION).tar.gz
>> +OPENCL_ICD_LOADER_SITE = $(call github,KhronosGroup,OpenCL-ICD-Loader,v$(OPENCL_ICD_LOADER_VERSION))
>> +OPENCL_ICD_LOADER_LICENSE = Apache-2.0
>> +OPENCL_ICD_LOADER_LICENSE_FILES = LICENSE
>> +OPENCL_ICD_LOADER_INSTALL_STAGING = YES
>> +
>> +OPENCL_ICD_LOADER_DEPENDENCIES = opencl-headers
>> +
>> +OPENCL_ICD_LOADER_CONF_OPTS += -DOPENCL_ICD_LOADER_HEADERS_DIR=$(STAGING_DIR)/usr/include
>> +
>> +$(eval $(cmake-package))
>> +$(eval $(host-cmake-package))
>> -- 
>> 2.25.1
>>
>> _______________________________________________
>> buildroot mailing list
>> buildroot@buildroot.org
>> https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Buildroot] [PATCH v4 6/7] package/llvm-project: add opencl-c-base.h on target
  2024-02-07 19:07   ` Yann E. MORIN
@ 2024-02-12 14:54     ` Antoine Coutant
  0 siblings, 0 replies; 22+ messages in thread
From: Antoine Coutant @ 2024-02-12 14:54 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: sebastian.weyer, bernd, romain.naour, buildroot

Yann, All,

On 07/02/2024 20:07, Yann E. MORIN wrote:
> Antoine, All,
>
> On 2024-02-02 10:36 +0100, Antoine Coutant spake thusly:
>> rusticl depends on the mesa clc_compile_to_llvm_module function.
>> This function requires opencl-c-base.h when LLVM version >= 15.
>>
>> The header is deleted automatically by CLANG_FILES_TO_REMOVE
>> post install target hook in llvm-project/clang package.
>> When rusticl is enabled, after the whole clang directory has
>> been removed, the header is copied back to
>> /usr/lib/clang/$(LLVM_PROJECT_VERSION)/include/
>>
>> By default, the mesa3d variable used to retrieve the header
>> is set to the staging directory on the host machine. A merge
>> request on mesa's gitlab solved this problem. See:
>>
>> https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25568
>>
>> The patches have been backported to mesa 23.3.4.
>>
>> Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
>> ---
>> Changes v3 -> v4:
>> 	- Add patches merged by mesa upstream.
> Adding those patches has nothing to do in this commit, but should in the
> next one, that adds rusticl support in mesa3d, right?

I added them here because they are necessary when using

the missing header. However, you are right, their place is not

in this patch as they are not useful to add the missing header

on the target.


I will move them into the patch that adds rusticl support.


Thanks, for this feedback !


Regards,

Antoine Coutant


>
> Regards,
> Yann E. MORIN.
>
>> ---
>> Running an app that uses rusticl leads to an error.
>> Example:
>>
>> RUSTICL_ENABLE=panfrost clpeak
>>
>> Platform: rusticl
>>    Device: Mali-G52 (Panfrost)
>>      Driver version  : 23.3.4 (Linux ARM64)
>>      Compute units   : 2
>>      Clock frequency : 800 MHz
>>      Build Log: <built-in>:1:10: fatal error: 'opencl-c-base.h' file not found
>> Error executing LLVM compilation action.
>>
>> Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
>> ---
>>   package/llvm-project/clang/clang.mk           |  9 ++
>>   ...ncl-external-clang-headers-option-an.patch | 72 ++++++++++++++++
>>   ...or-every-user-when-using-shared-LLVM.patch | 40 +++++++++
>>   ...lc-retrieve-libclang-path-at-runtime.patch | 86 +++++++++++++++++++
>>   4 files changed, 207 insertions(+)
>>   create mode 100644 package/mesa3d/0006-meson-remove-opencl-external-clang-headers-option-an.patch
>>   create mode 100644 package/mesa3d/0007-clc-force-fPIC-for-every-user-when-using-shared-LLVM.patch
>>   create mode 100644 package/mesa3d/0008-clc-retrieve-libclang-path-at-runtime.patch
>>
>> diff --git a/package/llvm-project/clang/clang.mk b/package/llvm-project/clang/clang.mk
>> index 0bafd6461b..09aac7f0ec 100644
>> --- a/package/llvm-project/clang/clang.mk
>> +++ b/package/llvm-project/clang/clang.mk
>> @@ -90,6 +90,15 @@ define HOST_CLANG_INSTALL_CLANG_TBLGEN
>>   endef
>>   HOST_CLANG_POST_INSTALL_HOOKS = HOST_CLANG_INSTALL_CLANG_TBLGEN
>>   
>> +# Rusticl needs opencl-c-base.h to be present on the target.
>> +define CLANG_OPENCL_C_BASE_HEADER_TO_TARGET
>> +	mkdir -p $(TARGET_DIR)/usr/lib/clang/$(LLVM_PROJECT_VERSION)/include
>> +	$(INSTALL) -D -m 0644 $(@D)/lib/Headers/opencl-c-base.h $(TARGET_DIR)/usr/lib/clang/$(LLVM_PROJECT_VERSION)/include/opencl-c-base.h
>> +endef
>> +ifeq ($(BR2_PACKAGE_MESA3D_RUSTICL),y)
>> +CLANG_POST_INSTALL_TARGET_HOOKS += CLANG_OPENCL_C_BASE_HEADER_TO_TARGET
>> +endif
>> +
>>   # This option must be enabled to link libclang dynamically against libLLVM.so
>>   HOST_CLANG_CONF_OPTS += -DLLVM_LINK_LLVM_DYLIB=ON
>>   CLANG_CONF_OPTS += -DLLVM_LINK_LLVM_DYLIB=ON
>> diff --git a/package/mesa3d/0006-meson-remove-opencl-external-clang-headers-option-an.patch b/package/mesa3d/0006-meson-remove-opencl-external-clang-headers-option-an.patch
>> new file mode 100644
>> index 0000000000..ebe3542627
>> --- /dev/null
>> +++ b/package/mesa3d/0006-meson-remove-opencl-external-clang-headers-option-an.patch
>> @@ -0,0 +1,72 @@
>> +From b7f2ada31d85dfd2e9906a7343d14a3b0b85cf14 Mon Sep 17 00:00:00 2001
>> +From: Karol Herbst <kherbst@redhat.com>
>> +Date: Tue, 2 Jan 2024 22:58:39 +0100
>> +Subject: [PATCH 1/3] meson: remove opencl-external-clang-headers option and
>> + rely on shared-llvm
>> +
>> +Setting opencl-external-clang-headers to enabled while using shared LLVM
>> +was broken and this option was mostly used for windows to force static
>> +inclusion of opencl base headers.
>> +
>> +Simply relying on the shared-llvm option here is enough to get what we
>> +want.
>> +
>> +Signed-off-by: Karol Herbst <kherbst@redhat.com>
>> +Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
>> +Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25568>
>> +[antoine.coutant@smile.fr: backported to mesa-23.3.4]
>> +Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
>> +---
>> + .gitlab-ci/windows/mesa_build.ps1 | 1 -
>> + meson_options.txt                 | 7 -------
>> + src/compiler/clc/meson.build      | 4 +---
>> + 3 files changed, 1 insertion(+), 11 deletions(-)
>> +
>> +diff --git a/.gitlab-ci/windows/mesa_build.ps1 b/.gitlab-ci/windows/mesa_build.ps1
>> +index a4f87c4eadb..e79eb6b6587 100644
>> +--- a/.gitlab-ci/windows/mesa_build.ps1
>> ++++ b/.gitlab-ci/windows/mesa_build.ps1
>> +@@ -59,7 +59,6 @@ meson setup `
>> + -Dopencl-spirv=true `
>> + -Dmicrosoft-clc=enabled `
>> + -Dstatic-libclc=all `
>> +--Dopencl-external-clang-headers=disabled `
>> + -Dspirv-to-dxil=true `
>> + -Dbuild-tests=true `
>> + -Dwerror=true `
>> +diff --git a/meson_options.txt b/meson_options.txt
>> +index e885ba61a8a..537ba797407 100644
>> +--- a/meson_options.txt
>> ++++ b/meson_options.txt
>> +@@ -191,13 +191,6 @@ option(
>> +   description : 'Link libclc SPIR-V statically.',
>> + )
>> +
>> +-option(
>> +-  'opencl-external-clang-headers',
>> +-  type : 'feature',
>> +-  description : 'Use system Clang headers at runtime for OpenCL kernel ' +
>> +-                'compilation.',
>> +-)
>> +-
>> + option(
>> +   'd3d-drivers-path',
>> +   type : 'string',
>> +diff --git a/src/compiler/clc/meson.build b/src/compiler/clc/meson.build
>> +index 3e4f1a7f441..81345225768 100644
>> +--- a/src/compiler/clc/meson.build
>> ++++ b/src/compiler/clc/meson.build
>> +@@ -30,9 +30,7 @@ _libmesaclc_c_args = []
>> + _libmesaclc_cpp_args = ['-DLLVM_LIB_DIR="@0@"'.format(llvm_libdir)]
>> + _libmesaclc_sources = []
>> +
>> +-if get_option('opencl-external-clang-headers') \
>> +-   .disable_auto_if(host_machine.system() == 'windows') \
>> +-   .disabled()
>> ++if not _shared_llvm
>> +   # LLVM 16 moved clang header path from using full version to only major version
>> +   if dep_llvm.version().version_compare('< 16')
>> +     # Prior to LLVM 16, this path used a full version
>> +--
>> +2.25.1
>> +
>> diff --git a/package/mesa3d/0007-clc-force-fPIC-for-every-user-when-using-shared-LLVM.patch b/package/mesa3d/0007-clc-force-fPIC-for-every-user-when-using-shared-LLVM.patch
>> new file mode 100644
>> index 0000000000..3560f6805f
>> --- /dev/null
>> +++ b/package/mesa3d/0007-clc-force-fPIC-for-every-user-when-using-shared-LLVM.patch
>> @@ -0,0 +1,40 @@
>> +From 56c85c4c7a757a9ba3d8ac08e6c4c4c7f19e6cab Mon Sep 17 00:00:00 2001
>> +From: Karol Herbst <kherbst@redhat.com>
>> +Date: Thu, 11 Jan 2024 14:55:46 +0100
>> +Subject: [PATCH 2/3] clc: force fPIC for every user when using shared LLVM
>> +
>> +As we want to start using `dladdr`, this is needed to prevent `dladdr`
>> +returning information of the wrong file.
>> +
>> +Fixes tag as it's required by the actual fix.
>> +
>> +Signed-off-by: Karol Herbst <kherbst@redhat.com>
>> +Fixes: e22491c8326 ("clc: fetch clang resource dir at runtime")
>> +Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25568>
>> +[antoine.coutant@smile.fr: backported to mesa-23.3.4]
>> +Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
>> +---
>> + src/compiler/clc/meson.build | 6 ++++++
>> + 1 file changed, 6 insertions(+)
>> +
>> +diff --git a/src/compiler/clc/meson.build b/src/compiler/clc/meson.build
>> +index 81345225768..442a583065b 100644
>> +--- a/src/compiler/clc/meson.build
>> ++++ b/src/compiler/clc/meson.build
>> +@@ -123,7 +123,13 @@ _libmesaclc = static_library(
>> +                  idep_mesautil, dep_spirv_tools]
>> + )
>> +
>> ++_idep_mesaclc_link_args = []
>> ++if _shared_llvm
>> ++  _idep_mesaclc_link_args += cc.get_supported_link_arguments('-fPIC')
>> ++endif
>> ++
>> + idep_mesaclc = declare_dependency(
>> +   link_with : _libmesaclc,
>> +   include_directories : include_directories('.'),
>> ++  link_args : _idep_mesaclc_link_args,
>> + )
>> +--
>> +2.25.1
>> +
>> diff --git a/package/mesa3d/0008-clc-retrieve-libclang-path-at-runtime.patch b/package/mesa3d/0008-clc-retrieve-libclang-path-at-runtime.patch
>> new file mode 100644
>> index 0000000000..c19ba7d2b7
>> --- /dev/null
>> +++ b/package/mesa3d/0008-clc-retrieve-libclang-path-at-runtime.patch
>> @@ -0,0 +1,86 @@
>> +From fa2c045e04370beb454951c32bccc087638e04c7 Mon Sep 17 00:00:00 2001
>> +From: Antoine Coutant <antoine.coutant@smile.fr>
>> +Date: Thu, 30 Nov 2023 11:10:20 +0100
>> +Subject: [PATCH 3/3] clc: retrieve libclang path at runtime.
>> +
>> +LLVM_LIB_DIR is a variable used for runtime compilations.
>> +When cross compiling, LLVM_LIB_DIR must be set to the
>> +libclang path on the target. So, this path should not
>> +be retrieved during compilation but at runtime.
>> +
>> +dladdr uses an address to search for a loaded library.
>> +If a library is found, it returns information about it.
>> +The path to the libclang library can therefore be
>> +retrieved using one of its functions. This is useful
>> +because we don't know the name of the libclang library
>> +(libclang.so.X or libclang-cpp.so.X)
>> +
>> +v2 (Karol): use clang::CompilerInvocation::CreateFromArgs for dladdr
>> +v3 (Karol): follow symlinks to fix errors on debian
>> +
>> +Fixes: e22491c8326 ("clc: fetch clang resource dir at runtime")
>> +Signed-off-by: Antoine Coutant <antoine.coutant@smile.fr>
>> +Reviewed-by: Karol Herbst <kherbst@redhat.com>
>> +Reviewed-by (v1): Jesse Natalie <jenatali@microsoft.com>
>> +[antoine.coutant@smile.fr: backported to mesa-23.3.4]
>> +
>> +Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25568>
>> +---
>> + src/compiler/clc/clc_helpers.cpp | 24 +++++++++++++++++++++---
>> + 1 file changed, 21 insertions(+), 3 deletions(-)
>> +
>> +diff --git a/src/compiler/clc/clc_helpers.cpp b/src/compiler/clc/clc_helpers.cpp
>> +index 55287f22683..22eb3495be9 100644
>> +--- a/src/compiler/clc/clc_helpers.cpp
>> ++++ b/src/compiler/clc/clc_helpers.cpp
>> +@@ -23,6 +23,7 @@
>> + // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
>> + // OTHER DEALINGS IN THE SOFTWARE.
>> +
>> ++#include <cstdlib>
>> + #include <filesystem>
>> + #include <sstream>
>> + #include <mutex>
>> +@@ -57,6 +58,10 @@
>> +
>> + #include "spirv.h"
>> +
>> ++#if DETECT_OS_UNIX
>> ++#include <dlfcn.h>
>> ++#endif
>> ++
>> + #ifdef USE_STATIC_OPENCL_C_H
>> + #if LLVM_VERSION_MAJOR < 15
>> + #include "opencl-c.h.h"
>> +@@ -876,12 +881,25 @@ clc_compile_to_llvm_module(LLVMContext &llvm_ctx,
>> + #endif
>> +    }
>> + #else
>> ++
>> ++   Dl_info info;
>> ++   if (dladdr((void *)clang::CompilerInvocation::CreateFromArgs, &info) == 0) {
>> ++      clc_error(logger, "Couldn't find libclang path.\n");
>> ++      return {};
>> ++   }
>> ++
>> ++   char *clang_path = realpath(info.dli_fname, NULL);
>> ++   if (clang_path == nullptr) {
>> ++      clc_error(logger, "Couldn't find libclang path.\n");
>> ++      return {};
>> ++   }
>> ++
>> +    // GetResourcePath is a way to retrive the actual libclang resource dir based on a given binary
>> +-   // or library. The path doesn't even need to exist, we just have to put something in there,
>> +-   // because we might have linked clang statically.
>> ++   // or library.
>> +    auto libclang_path = fs::path(LLVM_LIB_DIR) / "libclang.so";
>> +    auto clang_res_path =
>> +-      fs::path(Driver::GetResourcesPath(libclang_path.string(), CLANG_RESOURCE_DIR)) / "include";
>> ++      fs::path(Driver::GetResourcesPath(std::string(clang_path), CLANG_RESOURCE_DIR)) / "include";
>> ++   free(clang_path);
>> +
>> +    c->getHeaderSearchOpts().UseBuiltinIncludes = true;
>> +    c->getHeaderSearchOpts().UseStandardSystemIncludes = true;
>> +--
>> +2.25.1
>> +
>> -- 
>> 2.25.1
>>
>> _______________________________________________
>> buildroot mailing list
>> buildroot@buildroot.org
>> https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Buildroot] [PATCH v4 4/7] package/opencl-headers: new package
  2024-02-12 13:44     ` Antoine Coutant
@ 2024-02-21 13:26       ` Antoine Coutant
  2024-02-21 16:55       ` Antoine Coutant
  1 sibling, 0 replies; 22+ messages in thread
From: Antoine Coutant @ 2024-02-21 13:26 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: sebastian.weyer, bernd, romain.naour, buildroot


[-- Attachment #1.1: Type: text/plain, Size: 3850 bytes --]

Yann, All,

On 12/02/2024 14:44, Antoine Coutant wrote:
>
> Yann, All,
>
> On 07/02/2024 16:58, Yann E. MORIN wrote:
>> Antoine, All,
>>
>> On 2024-02-02 10:36 +0100, Antoine Coutant spake thusly:
>>> From: Sebastian Weyer<sebastian.weyer@smile.fr>
>>>
>>> These headers provide the C language API bindings. It is a complement to
>>> the C++ bindings already available in opencl-clhpp. This package is
>>> required to build opencl-icd-loader:
>>>
>>> https://github.com/KhronosGroup/OpenCL-ICD-Loader#dependencies
>>>
>>> Signed-off-by: Sebastian Weyer<sebastian.weyer@smile.fr>
>>> Signed-off-by: Antoine Coutant<antoine.coutant@smile.fr>
>>> ---
>> [--SNIP--]
>>> diff --git a/package/opencl-headers/Config.in b/package/opencl-headers/Config.in
>>> new file mode 100644
>>> index 0000000000..092d8a2a4d
>>> --- /dev/null
>>> +++ b/package/opencl-headers/Config.in
>>> @@ -0,0 +1,7 @@
>>> +config BR2_PACKAGE_OPENCL_HEADERS
>>> +	bool "opencl-headers"
>>> +	depends on BR2_PACKAGE_HAS_LIBOPENCL
>> BR2_PACKAGE_HAS_LIBOPENCL can be set by mesa3d when BR2_PACKAGE_MESA3D_OPENCL
>> is enabled. In this case, will mesa3d install its own headers? If so,
>> that will generate a conflict.
>
> BR2_PACKAGE_HAS_LIBOPENCL doesn't guarantee that CL headers
>
> will be installed. Mesa3d install headers if Clover is enabled and
>
> opencl-icd is disabled [1]. So you are right, it will generate conflict in
>
> case OpenCL-Headers and Clover are built without icd mode.
>
>> Furthermore, this will also conflict with mesa3d-headers, and it also
>> installs CL headers.
> Yes, this will generate the same conflict here...


Besides, the Mesa build system does not install headers if icd option

is enabled. I think the reason is that OpenCL-ICD-Loader explicitly

depends on OpenCL-Headers [1]. Thus, mesa lets users install the

headers that match opencl-icd-loader version.


Mesa build system is designed to not install CL headers when they

are installed by ICD Loader. However, Buildroot package

mesa3d-headers does not check this condition and install CL headers

as soon as libopencl is present. Thus, I think that I will add a

dependency to prevent mesa3d-headers from installing headers when

OpenCL-Headers package is selected.


[1]: 
https://github.com/KhronosGroup/OpenCL-ICD-Loader?tab=readme-ov-file#dependencies


>> So, why do we need opencl-headers and can't rely on the existing
>> mesa3d-headers package?
>
> The problem is that the headers installed by mesa differ from those
>
> in the OpenCL-Headers package.
>
> $ diff -q OpenCL-Headers/CL/cl_icd.h mesa/include/CL/cl_icd.h
> Files OpenCL-Headers/CL/cl_icd.h and mesa/include/CL/cl_icd.h differ
>
> This diff was performed using OpenCL-Headers v2023.12.14 and
>
> mesa-23.3.4. Moreover, cl_layer.h, cl_half.h and cl_function_types.h 
> files are
>
> missing from mesa headers. These differences causes errors when building
>
> opencl-icd-loader:
>
> ...
>
> ./build/opencl-icd-loader-2023.12.14/loader/icd.c:23:10: fatal error: 
> CL/cl_layer.h: No such file or directory
>
>    23 | #include <CL/cl_layer.h>
>
> | ^~~~~~~~~~~~~~~
>
> compilation terminated.
>
> ./build/opencl-icd-loader-2023.12.14/loader/icd_dispatch.c:26:8: 
> error: unknown type name ‘clGetICDLoaderInfoOCLICD_t’
>
>    26 | static clGetICDLoaderInfoOCLICD_t clGetICDLoaderInfoOCLICD;
>
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~
>
> ...
>
> This is why we cannot rely on mesa3d headers and why OpenCL-Headers
>
> package is required.
>
>> Regards,
>> Yann E. MORIN.
>
> I will add guards to prevent conflicts in the v5. And add some lines
>
> in the commit log to explain why mesa3d headers can't be used to
>
> build OpenCL-ICD-Loader.
>
>
> Thanks for your feedback !
>
>
> [1]: 
> https://gitlab.freedesktop.org/mesa/mesa/-/blob/23.3/include/meson.build?ref_type=heads#L135
>
>
> Regards,
>
> Antoine Coutant
>

[-- Attachment #1.2: Type: text/html, Size: 13404 bytes --]

[-- Attachment #2: Type: text/plain, Size: 150 bytes --]

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Buildroot] [PATCH v4 4/7] package/opencl-headers: new package
  2024-02-12 13:44     ` Antoine Coutant
  2024-02-21 13:26       ` Antoine Coutant
@ 2024-02-21 16:55       ` Antoine Coutant
  1 sibling, 0 replies; 22+ messages in thread
From: Antoine Coutant @ 2024-02-21 16:55 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: sebastian.weyer, bernd, romain.naour, buildroot


[-- Attachment #1.1: Type: text/plain, Size: 5509 bytes --]

Yann, All,

On 12/02/2024 14:44, Antoine Coutant wrote:
>
> Yann, All,
>
> On 07/02/2024 16:58, Yann E. MORIN wrote:
>> Antoine, All,
>>
>> On 2024-02-02 10:36 +0100, Antoine Coutant spake thusly:
>>> From: Sebastian Weyer<sebastian.weyer@smile.fr>
>>>
>>> These headers provide the C language API bindings. It is a complement to
>>> the C++ bindings already available in opencl-clhpp. This package is
>>> required to build opencl-icd-loader:
>>>
>>> https://github.com/KhronosGroup/OpenCL-ICD-Loader#dependencies
>>>
>>> Signed-off-by: Sebastian Weyer<sebastian.weyer@smile.fr>
>>> Signed-off-by: Antoine Coutant<antoine.coutant@smile.fr>
>>> ---

[--SNIP--]

>> So, why do we need opencl-headers and can't rely on the existing
>> mesa3d-headers package?
>
> The problem is that the headers installed by mesa differ from those
>
> in the OpenCL-Headers package.
>
> $ diff -q OpenCL-Headers/CL/cl_icd.h mesa/include/CL/cl_icd.h
> Files OpenCL-Headers/CL/cl_icd.h and mesa/include/CL/cl_icd.h differ
>
> This diff was performed using OpenCL-Headers v2023.12.14 and
>
> mesa-23.3.4. Moreover, cl_layer.h, cl_half.h and cl_function_types.h 
> files are
>
> missing from mesa headers. These differences causes errors when building
>
> opencl-icd-loader:
>
> ...
>
> ./build/opencl-icd-loader-2023.12.14/loader/icd.c:23:10: fatal error: 
> CL/cl_layer.h: No such file or directory
>
>    23 | #include <CL/cl_layer.h>
>
> | ^~~~~~~~~~~~~~~
>
> compilation terminated.
>
> ./build/opencl-icd-loader-2023.12.14/loader/icd_dispatch.c:26:8: 
> error: unknown type name ‘clGetICDLoaderInfoOCLICD_t’
>
>    26 | static clGetICDLoaderInfoOCLICD_t clGetICDLoaderInfoOCLICD;
>
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~
>
> ...
>
> This is why we cannot rely on mesa3d headers and why OpenCL-Headers
>
> package is required.
>

Besides, mesa3d CL headers regroups headers from OpenCL-Headers

and OpenCL-CLHPP [1][2][3]. The opencl-clhpp package already exist.

It have been added in commit 2ae78f1c794c145486baf5c39703443207fead4c

[4] when adding clpeak. Indeed, clpeak was downloading opencl-clhpp

during the configuration phase [5].


It appears that nothing prevent conflicts between opencl-clhpp headers

and mesa3d headers (installed by mesa3d-headers and mesa3d packages).

Moreover, both files are different:

$ md5sum OpenCL-CLHPP/include/CL/opencl.hpp
784d2b2283d605b30ad6c663a08ff71f OpenCL-CLHPP/include/CL/opencl.hpp

$ md5sum mesa/include/CL/opencl.hpp
6afa428040ec96709fc009fe514ef750  mesa/include/CL/opencl.hpp

With opencl-clhpp v2.0.16 and mesa-23.3.5 (versions used in buildroot

when this mail is sent).


I will check if it is possible to rely on mesa3d headers. If it's 
possible I will

remove this package (only used by clpeak) and rely on mesa3d headers.

If it's not possible, i will add guards to prevent the conflict.


[1]: https://gitlab.freedesktop.org/mesa/mesa/-/tree/24.0/include/CL

[2]: https://github.com/KhronosGroup/OpenCL-Headers/tree/v2023.12.14/CL

[3]: 
https://github.com/KhronosGroup/OpenCL-CLHPP/tree/v2023.12.14/include/CL

[4]: 
http://patchwork.ozlabs.org/project/buildroot/patch/20220116175320.453041-1-gilles.talis@gmail.com/

[5]: 
http://patchwork.ozlabs.org/project/buildroot/patch/20211024113654.88720-1-gilles.talis@gmail.com/

>> Regards,
>> Yann E. MORIN.
>
> I will add guards to prevent conflicts in the v5. And add some lines
>
> in the commit log to explain why mesa3d headers can't be used to
>
> build OpenCL-ICD-Loader.
>
>
> Thanks for your feedback !
>
>
> [1]: 
> https://gitlab.freedesktop.org/mesa/mesa/-/blob/23.3/include/meson.build?ref_type=heads#L135
>
>
> Regards,
>
> Antoine Coutant
>
>>> +	help
>>> +	  C language headers for the OpenCL API
>>> +
>>> +	https://github.com/KhronosGroup/OpenCL-Headers
>>> diff --git a/package/opencl-headers/opencl-headers.hash b/package/opencl-headers/opencl-headers.hash
>>> new file mode 100644
>>> index 0000000000..802ed05450
>>> --- /dev/null
>>> +++ b/package/opencl-headers/opencl-headers.hash
>>> @@ -0,0 +1,3 @@
>>> +#Locally generated
>>> +sha256  407d5e109a70ec1b6cd3380ce357c21e3d3651a91caae6d0d8e1719c69a1791d  OpenCL-Headers-2023.12.14.tar.gz
>>> +sha256  cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30  LICENSE
>>> diff --git a/package/opencl-headers/opencl-headers.mk b/package/opencl-headers/opencl-headers.mk
>>> new file mode 100644
>>> index 0000000000..7aa0e0d168
>>> --- /dev/null
>>> +++ b/package/opencl-headers/opencl-headers.mk
>>> @@ -0,0 +1,22 @@
>>> +################################################################################
>>> +#
>>> +# opencl-headers
>>> +#
>>> +################################################################################
>>> +
>>> +OPENCL_HEADERS_VERSION = 2023.12.14
>>> +OPENCL_HEADERS_SOURCE = OpenCL-Headers-$(OPENCL_HEADERS_VERSION).tar.gz
>>> +OPENCL_HEADERS_SITE = $(call github,KhronosGroup,OpenCL-Headers,v$(OPENCL_HEADERS_VERSION))
>>> +OPENCL_HEADERS_LICENSE = Apache-2.0
>>> +OPENCL_HEADERS_LICENSE_FILES = LICENSE
>>> +OPENCL_HEADERS_INSTALL_STAGING = YES
>>> +
>>> +OPENCL_HEADERS_INSTALL_TARGET = NO
>>> +
>>> +define OPENCL_HEADERS_INSTALL_STAGING_CMDS
>>> +	mkdir -p $(STAGING_DIR)/usr/include/CL
>>> +	$(INSTALL) -D -m 0644 $(@D)/CL/* \
>>> +		$(STAGING_DIR)/usr/include/CL
>>> +endef
>>> +
>>> +$(eval $(generic-package))
>>> -- 
>>> 2.25.1
>>>
>>> _______________________________________________
>>> buildroot mailing list
>>> buildroot@buildroot.org
>>> https://lists.buildroot.org/mailman/listinfo/buildroot

[-- Attachment #1.2: Type: text/html, Size: 15941 bytes --]

[-- Attachment #2: Type: text/plain, Size: 150 bytes --]

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2024-02-21 16:55 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-02  9:36 [Buildroot] [PATCH v4 0/7] Adding RustiCL Antoine Coutant
2024-02-02  9:36 ` [Buildroot] [PATCH v4 1/7] package/meson: bump version to 1.3.1 Antoine Coutant
2024-02-07 15:23   ` Yann E. MORIN
2024-02-07 15:30   ` Yann E. MORIN
2024-02-02  9:36 ` [Buildroot] [PATCH v4 2/7] package/pkg-meson.mk: add rust cross-compiler support Antoine Coutant
2024-02-07 15:13   ` Yann E. MORIN
2024-02-08 10:25     ` Antoine Coutant
2024-02-02  9:36 ` [Buildroot] [PATCH v4 3/7] package/spirv-llvm-translator: add target variant to provide LLVMSPIRVLib Antoine Coutant
2024-02-07 15:08   ` Yann E. MORIN
2024-02-07 15:15     ` Arnout Vandecappelle via buildroot
2024-02-02  9:36 ` [Buildroot] [PATCH v4 4/7] package/opencl-headers: new package Antoine Coutant
2024-02-07 15:58   ` Yann E. MORIN
2024-02-12 13:44     ` Antoine Coutant
2024-02-21 13:26       ` Antoine Coutant
2024-02-21 16:55       ` Antoine Coutant
2024-02-02  9:36 ` [Buildroot] [PATCH v4 5/7] package/opencl-icd-loader: " Antoine Coutant
2024-02-07 16:01   ` Yann E. MORIN
2024-02-12 14:19     ` Antoine Coutant
2024-02-02  9:36 ` [Buildroot] [PATCH v4 6/7] package/llvm-project: add opencl-c-base.h on target Antoine Coutant
2024-02-07 19:07   ` Yann E. MORIN
2024-02-12 14:54     ` Antoine Coutant
2024-02-02  9:36 ` [Buildroot] [PATCH v4 7/7] package/mesa3d: add RustiCL support Antoine Coutant

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.