Skip to contentSkip to conversation

package/llvm: add llvm RTTI option

PATCH New Romain Naour 4 participants 12 messages Oct 5, 2019 – Oct 26, 2019 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/4 package/llvm: add llvm RTTI option

Allow to build LLVM with run-time type information when this feature is needed (for example) by mesa3d's Gallium Nouveau driver or the Clover OpenCL state tracker when llvm support is enabled in mesa3d.

---
v2: rebase the patch on master

 package/llvm/Config.in | 12 ++++++++++++
 package/llvm/llvm.mk   |  8 ++++++++
 2 files changed, 20 insertions(+)
package/llvm/Config.in +12 -0
index 83e94660eb..4eaca3df58 100644
@@ -35,6 +35,18 @@ config BR2_PACKAGE_LLVM_AMDGPU
 	  Build AMDGPU target. Select this option if you are going
 	  to install mesa3d with llvm and use Gallium Radeon driver.
 
+config BR2_PACKAGE_LLVM_RTTI
+	bool "enable rtti"
+	help
+	  Build LLVM with run-time type information. LLVM can be
+	  built without rtti, but turning it off rtti changes the
+	  ABI of C++ programs.
+	  This features is needed to build the Gallium Nouveau
+	  driver or the Clover OpenCL state tracker when llvm
+	  support is enabled.
+
+	  https://llvm.org/docs/HowToSetUpLLVMStyleRTTI.html
+
 endif
 
 comment "llvm needs a toolchain w/ wchar, threads, C++, gcc >= 4.8, host gcc >= 4.8, dynamic library"
package/llvm/llvm.mk +8 -0
index f14b537d94..27a9f41860 100644
@@ -216,6 +216,14 @@ LLVM_CONF_OPTS += \
 	-DLLVM_INCLUDE_TOOLS=ON \
 	-DLLVM_BUILD_TOOLS=OFF
 
+ifeq ($(BR2_PACKAGE_LLVM_RTTI),y)
+HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_RTTI=ON
+LLVM_CONF_OPTS += -DLLVM_ENABLE_RTTI=ON
+else
+HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_RTTI=OFF
+LLVM_CONF_OPTS += -DLLVM_ENABLE_RTTI=OFF
+endif
+
 # Compiler-rt not in the source tree.
 # llvm runtime libraries are not in the source tree.
 # Polly is not in the source tree.
Signature · 1 line
2.23.0
#1 lore raw

PATCH v2 2/4 package/mesa3d: enable llvm RTTI when needed

LLVM must be built with rtti (runtime type information) support to build the Gallium Nouveau driver or the Clover OpenCL state tracker when llvm support is enabled in mesa3d.

Fixes the build when BR2_PACKAGE_MESA3D_OPENCL is set:
"The Clover OpenCL state tracker requires rtti, you need to turn off clover or use an LLVM built with LLVM_ENABLE_RTTI."

This check was added by mesa3d 19.1:
https://cgit.freedesktop.org/mesa/mesa/commit/?id=29912f2ea486fb8ffbc98db347679cf542422efe

Fixes the build when BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_NOUVEAU and BR2_PACKAGE_MESA3D_LLVM are set "The Nouveau driver requires rtti. You either need to turn off nouveau or use an LLVM built with LLVM_ENABLE_RTTI."

This check was added by mesa3d 19.0:
https://cgit.freedesktop.org/mesa/mesa/commit/?id=a2596450ac7330c8965c819491038fb1ad454333

---
 package/mesa3d/Config.in | 2 ++
 1 file changed, 2 insertions(+)
package/mesa3d/Config.in +2 -0
index d9a705f991..5bec4405b7 100644
@@ -49,6 +49,7 @@ config BR2_PACKAGE_MESA3D_OPENCL
 	depends on BR2_PACKAGE_MESA3D_LLVM
 	depends on BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_R600 || \
 		BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_RADEONSI
+	select BR2_PACKAGE_LLVM_RTTI
 	select BR2_PACKAGE_CLANG
 	select BR2_PACKAGE_LIBCLC
 	select BR2_PACKAGE_HAS_LIBOPENCL
@@ -122,6 +123,7 @@ config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_NOUVEAU
 	select BR2_PACKAGE_MESA3D_GALLIUM_DRIVER
 	select BR2_PACKAGE_LIBDRM_NOUVEAU
 	select BR2_PACKAGE_MESA3D_NEEDS_XA
+	select BR2_PACKAGE_LLVM_RTTI if BR2_PACKAGE_MESA3D_LLVM
 	help
 	  Supports all Nvidia GPUs.
 
Signature · 1 line
2.23.0
#2 lore raw

PATCH v2 2/4 package/mesa3d: enable llvm RTTI when needed

Am Sat, 05 Oct 2019 11:48:16 +0200 schrieb Romain Naour:

Quoted 2 lines

Signed-off-by: Romain Naour
<[email protected]>

[build-tested using this defconfig:
BR2_KERNEL_HEADERS_4_4=y
BR2_TOOLCHAIN_BUILDROOT_LOCALE=y
BR2_BINUTILS_VERSION_2_30_X=y
BR2_GCC_VERSION_5_X=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_INIT_NONE=y
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
# BR2_PACKAGE_BUSYBOX is not set
BR2_PACKAGE_MESA3D=y
BR2_PACKAGE_MESA3D_LLVM=y
BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_NOUVEAU=y
BR2_PACKAGE_MESA3D_XVMC=y
BR2_PACKAGE_MESA3D_OPENGL_GLX=y
BR2_PACKAGE_MESA3D_OPENGL_EGL=y
BR2_PACKAGE_MESA3D_OPENGL_ES=y
BR2_PACKAGE_XORG7=y]

#3 lore raw

PATCH v2 3/4 package/mesa3d: add xlib_libXv dependency to mesa3d xvmc

In reply to Romain Naour

From [1]
"Prior to xvmc 1.0.12 libxvmc incorrectly required libxv, but that was fixed. This results in compilation failures for the gallium xvmc tracker and tools. This patch fixes that by explicitly linking to libxv."

Add xlib_libXv dependency to mesa3d when BR2_PACKAGE_MESA3D_XVMC is set.

[1] https://cgit.freedesktop.org/mesa/mesa/commit/?id=e456a053c3d6ec4f3d4581edcad05c72dfdaa407

---
 .../0004-meson-Link-xvmc-with-libxv.patch     | 78 +++++++++++++++++++
 package/mesa3d/Config.in                      |  1 +
 package/mesa3d/mesa3d.mk                      |  2 +-
 3 files changed, 80 insertions(+), 1 deletion(-)
 create mode 100644 package/mesa3d/0004-meson-Link-xvmc-with-libxv.patch
package/mesa3d/0004-meson-Link-xvmc-with-libxv.patch new file +78 -0
new file mode 100644
index 0000000000..821d282932
@@ -0,0 +1,78 @@
+From 1fbb69a58c3dc9d604f5c7851bd3c144af687539 Mon Sep 17 00:00:00 2001
+From: Dylan Baker <[email protected]>
+Date: Thu, 26 Sep 2019 15:42:59 -0700
+Subject: [PATCH] meson: Link xvmc with libxv
+
+Prior to xvmc 1.0.12 libxvmc incorrectly required libxv, but that was
+fixed. This results in compilation failures for the gallium xvmc tracker
+and tools. This patch fixes that by explicitly linking to libxv.
+
+Fixes: 22a817af8a89eb3c762fc3e07b443a3ce37d7416
+       ("meson: build gallium xvmc state tracker")
+Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1844
+Reviewed-by: Adam Jackson <[email protected]>
+
+[Romain: backported to 19.2]
+(cherry picked from commit e456a053c3d6ec4f3d4581edcad05c72dfdaa407)
+Signed-off-by: Romain Naour <[email protected]>
+---
+ meson.build                                 |  4 +++-
+ src/gallium/state_trackers/xvmc/meson.build | 10 +++++++---
+ 2 files changed, 10 insertions(+), 4 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index 4afd8ca663b..d536ef5a76d 100644
+--- a/meson.build
++++ b/meson.build
+@@ -502,10 +502,12 @@ elif not (with_gallium_r600 or with_gallium_nouveau)
+   endif
+ endif
+ dep_xvmc = null_dep
++dep_xv = null_dep
+ with_gallium_xvmc = false
+ if _xvmc != 'false'
+   dep_xvmc = dependency('xvmc', version : '>= 1.0.6', required : _xvmc == 'true')
+-  with_gallium_xvmc = dep_xvmc.found()
++  dep_xv = dependency('xv', required : _xvmc == 'true')
++  with_gallium_xvmc = dep_xvmc.found() and dep_xv.found()
+ endif
+ 
+ xvmc_drivers_path = get_option('xvmc-libs-path')
+diff --git a/src/gallium/state_trackers/xvmc/meson.build b/src/gallium/state_trackers/xvmc/meson.build
+index d120d533eef..4b7aad51125 100644
+--- a/src/gallium/state_trackers/xvmc/meson.build
++++ b/src/gallium/state_trackers/xvmc/meson.build
+@@ -23,7 +23,9 @@ libxvmc_st = static_library(
+   files('attributes.c', 'block.c', 'context.c', 'surface.c', 'subpicture.c'),
+   c_args : [c_vis_args],
+   include_directories : [inc_common],
+-  dependencies : [dep_xvmc, dep_x11_xcb, dep_xcb, dep_xcb_dri2, dep_xcb_dri3],
++  dependencies : [
++    dep_xvmc, dep_x11_xcb, dep_xcb, dep_xcb_dri2, dep_xcb_dri3, dep_xv,
++  ],
+ )
+ 
+ # These tests will not work without a working xvmc configuration. 
+@@ -36,7 +38,8 @@ if with_tools.contains('xvmc')
+       _name,
+       files('tests/test_ at [email protected]'.format(x), 'tests/testlib.c'),
+       dependencies : [
+-        dep_real_xvmc, dep_x11_xcb, dep_xcb, dep_xcb_dri2, dep_xcb_dri3, dep_xvmcw,
++        dep_real_xvmc, dep_x11_xcb, dep_xcb, dep_xcb_dri2, dep_xcb_dri3,
++        dep_xvmcw, dep_xv,
+       ],
+       install: true,
+     )
+@@ -46,7 +49,8 @@ if with_tools.contains('xvmc')
+     'xvmc_bench',
+     files('tests/xvmc_bench.c', 'tests/testlib.c'),
+     dependencies : [
+-      dep_real_xvmc, dep_x11_xcb, dep_xcb, dep_xcb_dri2, dep_xcb_dri3, dep_xvmcw,
++      dep_real_xvmc, dep_x11_xcb, dep_xcb, dep_xcb_dri2, dep_xcb_dri3,
++      dep_xvmcw, dep_xv,
+     ],
+     install: true,
+   )
+-- 
+2.23.0
+
package/mesa3d/Config.in +1 -0
index 5bec4405b7..f4c5c02e3b 100644
@@ -230,6 +230,7 @@ config BR2_PACKAGE_MESA3D_XVMC
 	depends on BR2_PACKAGE_XORG7
 	depends on BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_NOUVEAU \
 		|| BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_R600
+	select BR2_PACKAGE_XLIB_LIBXV
 	select BR2_PACKAGE_XLIB_LIBXVMC
 	help
 	  XvMC state tracker (needs r600 or nouveau gallium drivers).
package/mesa3d/mesa3d.mk +1 -1
index 35fe2bdbe5..0afa84e761 100644
@@ -217,7 +217,7 @@ MESA3D_CONF_OPTS += -Dgles1=false -Dgles2=false
 endif
 
 ifeq ($(BR2_PACKAGE_MESA3D_XVMC),y)
-MESA3D_DEPENDENCIES += xlib_libXvMC
+MESA3D_DEPENDENCIES += xlib_libXv xlib_libXvMC
 MESA3D_CONF_OPTS += -Dgallium-xvmc=true
 else
 MESA3D_CONF_OPTS += -Dgallium-xvmc=false
Signature · 1 line
2.23.0
#4 lore raw

PATCH v2 3/4 package/mesa3d: add xlib_libXv dependency to mesa3d xvmc

Am Sat, 05 Oct 2019 11:48:17 +0200 schrieb Romain Naour:

Quoted 3 lines

Signed-off-by: Romain Naour
<[email protected]>
Cc: Bernd Kuhls <[email protected]>

[build-tested using this defconfig:
BR2_KERNEL_HEADERS_4_4=y
BR2_TOOLCHAIN_BUILDROOT_LOCALE=y
BR2_BINUTILS_VERSION_2_30_X=y
BR2_GCC_VERSION_5_X=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_INIT_NONE=y
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
# BR2_PACKAGE_BUSYBOX is not set
BR2_PACKAGE_MESA3D=y
BR2_PACKAGE_MESA3D_LLVM=y
BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_NOUVEAU=y
BR2_PACKAGE_MESA3D_XVMC=y
BR2_PACKAGE_MESA3D_OPENGL_GLX=y
BR2_PACKAGE_MESA3D_OPENGL_EGL=y
BR2_PACKAGE_MESA3D_OPENGL_ES=y
BR2_PACKAGE_XORG7=y]

#6 lore raw

PATCH v2 4/4 package/x11r7/xlib_libXvMC: remove xlib_libXv dependency

In reply to Romain Naour

Since libXvMC 1.0.12, xv was removed from xvmc.pc [1].

[1] https://lists.x.org/archives/xorg-announce/2019-September/003023.html

---
This may introduce some build issue like for mesa3d :
https://cgit.freedesktop.org/mesa/mesa/commit/?id=e456a053c3d6ec4f3d4581edcad05c72dfdaa407

---
 package/x11r7/xlib_libXvMC/Config.in       | 1 -
 package/x11r7/xlib_libXvMC/xlib_libXvMC.mk | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
package/x11r7/xlib_libXvMC/Config.in +0 -1
index 5cc6ec766a..4be6e01774 100644
@@ -2,7 +2,6 @@ config BR2_PACKAGE_XLIB_LIBXVMC
 	bool "libXvMC"
 	select BR2_PACKAGE_XLIB_LIBX11
 	select BR2_PACKAGE_XLIB_LIBXEXT
-	select BR2_PACKAGE_XLIB_LIBXV
 	select BR2_PACKAGE_XORGPROTO
 	help
 	  X.Org XvMC library
package/x11r7/xlib_libXvMC/xlib_libXvMC.mk +1 -1
index 02959c2305..442c410b57 100644
@@ -10,7 +10,7 @@ XLIB_LIBXVMC_SITE = http://xorg.freedesktop.org/releases/individual/lib
 XLIB_LIBXVMC_LICENSE = MIT
 XLIB_LIBXVMC_LICENSE_FILES = COPYING
 XLIB_LIBXVMC_INSTALL_STAGING = YES
-XLIB_LIBXVMC_DEPENDENCIES = xlib_libX11 xlib_libXext xlib_libXv xorgproto
+XLIB_LIBXVMC_DEPENDENCIES = xlib_libX11 xlib_libXext xorgproto
 XLIB_LIBXVMC_CONF_OPTS = --disable-malloc0returnsnull
 
 $(eval $(autotools-package))
Signature · 1 line
2.23.0
#7 lore raw

PATCH v2 4/4 package/x11r7/xlib_libXvMC: remove xlib_libXv dependency

Am Sat, 05 Oct 2019 11:48:18 +0200 schrieb Romain Naour:

Quoted 3 lines

Signed-off-by: Romain Naour
<[email protected]>
Cc: Bernd Kuhls <[email protected]>

[build-tested using this defconfig:
BR2_KERNEL_HEADERS_4_4=y
BR2_TOOLCHAIN_BUILDROOT_LOCALE=y
BR2_BINUTILS_VERSION_2_30_X=y
BR2_GCC_VERSION_5_X=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_INIT_NONE=y
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
# BR2_PACKAGE_BUSYBOX is not set
BR2_PACKAGE_MESA3D=y
BR2_PACKAGE_MESA3D_LLVM=y
BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_NOUVEAU=y
BR2_PACKAGE_MESA3D_XVMC=y
BR2_PACKAGE_MESA3D_OPENGL_GLX=y
BR2_PACKAGE_MESA3D_OPENGL_EGL=y
BR2_PACKAGE_MESA3D_OPENGL_ES=y
BR2_PACKAGE_XORG7=y]

#8 lore raw

PATCH v2 4/4 package/x11r7/xlib_libXvMC: remove xlib_libXv dependency

In reply to Romain Naour
Quoted 3 lines · On Sat, 5 Oct 2019 11:48:18 +0200 Romain Naour <[email protected]> wrote:

Since libXvMC 1.0.12, xv was removed from xvmc.pc [1].

[1] https://lists.x.org/archives/xorg-announce/2019-September/003023.html

Seems like it disagrees:

http://autobuild.buildroot.net/results/305/3051f4fbc1ab725de542a550e4f9eeb3cae385b8/build-end.log

checking for XVMC... no
configure: error: Package requirements (x11 >= 1.6 xext xv xextproto videoproto) were not met:

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#9 lore raw

PATCH v2 4/4 package/x11r7/xlib_libXvMC: remove xlib_libXv dependency

Hi Thomas, All,

Le 26/10/2019 ? 22:55, Thomas Petazzoni a ?crit?:

Quoted 5 lines
Quoted 2 lines · On Sat, 5 Oct 2019 11:48:18 +0200 Romain Naour <[email protected]> wrote:

Since libXvMC 1.0.12, xv was removed from xvmc.pc [1].

Quoted 8 lines
Quoted 1 line

[1] https://lists.x.org/archives/xorg-announce/2019-September/003023.html

Seems like it disagrees:

http://autobuild.buildroot.net/results/305/3051f4fbc1ab725de542a550e4f9eeb3cae385b8/build-end.log

checking for XVMC... no
configure: error: Package requirements (x11 >= 1.6 xext xv xextproto videoproto) were not met:

It seems configure.ac still list xv in PKG_CHECK_MODULES:

https://gitlab.freedesktop.org/xorg/lib/libxvmc/blob/master/configure.ac#L43

From the commit message removing xv from .pc "This library does not itself require libXv for anything."

I'll check.

Best regards,
Romain

Quoted 3 lines

Thomas

#10 lore raw

PATCH v2 1/4 package/llvm: add llvm RTTI option

In reply to Romain Naour

Am Sat, 05 Oct 2019 11:48:15 +0200 schrieb Romain Naour:

Quoted 6 lines

Allow to build LLVM with run-time type information when this feature is needed (for example) by mesa3d's Gallium Nouveau driver or the Clover OpenCL state tracker when llvm support is enabled in mesa3d.

Signed-off-by: Romain Naour
<[email protected]>

[build-tested using this defconfig:
BR2_KERNEL_HEADERS_4_4=y
BR2_TOOLCHAIN_BUILDROOT_LOCALE=y
BR2_BINUTILS_VERSION_2_30_X=y
BR2_GCC_VERSION_5_X=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_INIT_NONE=y
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
# BR2_PACKAGE_BUSYBOX is not set
BR2_PACKAGE_MESA3D=y
BR2_PACKAGE_MESA3D_LLVM=y
BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_NOUVEAU=y
BR2_PACKAGE_MESA3D_XVMC=y
BR2_PACKAGE_MESA3D_OPENGL_GLX=y
BR2_PACKAGE_MESA3D_OPENGL_EGL=y
BR2_PACKAGE_MESA3D_OPENGL_ES=y
BR2_PACKAGE_XORG7=y]

#11 lore raw

PATCH v2 1/4 package/llvm: add llvm RTTI option

In reply to Romain Naour
Quoted 8 lines · On Sat, 5 Oct 2019 11:48:15 +0200 Romain Naour <[email protected]> wrote:

Allow to build LLVM with run-time type information when this feature is needed (for example) by mesa3d's Gallium Nouveau driver or the Clover OpenCL state tracker when llvm support is enabled in mesa3d.

---
v2: rebase the patch on master

Series applied, thanks! On this particular patch, I extended a bit the commit log to explain why we're doing it on both the host and target LLVM variants.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com