Skip to contentSkip to conversation

pixmap: Enable openmp support with clang compiler

PATCH In review Khem Raj 3 participants 5 messages May 30, 2025 – Jun 2, 2025

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH v5 1/1 pixmap: Enable openmp support with clang compiler

pixman's meson detects openmp support and if it finds it in runtime then enables it, this happens for gcc via gcc-runtime, however for clang, it does not. In some cases e.g. mips it enables it during configure only to find that clang can not find the libomp during linking. Therefore, add the dependency on openmp when using clang compiler. This ensures consistent behaviour across architectures.

Disable internal assembler on mips since it can not handle the inline assembly

Turn openmp into a packageconfig

openmp is not yet ported to all architectures e.g. RISCV32/PPC32 does not have it

---
v5: Remove openmp on rv32 and ppc32

 meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb +12 -1
index c1c71fd4202..925a7d7b29b 100644
@@ -23,6 +23,17 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=14096c769ae0cbb5fcb94ec468be11b3 \
 
 inherit meson pkgconfig
 
+OPENMP ?= ""
+OPENMP:toolchain-clang = "openmp"
+# openmp is not yet ported to rv32/ppc
+OPENMP:remove:riscv32 = "openmp"
+OPENMP:remove:powerpc = "openmp"
+
+PACKAGECONFIG ??= "openmp"
+PACKAGECONFIG:class-native ?= ""
+
+PACKAGECONFIG[openmp] = ",-Dopenmp=disabled,${OPENMP}"
+
 # These are for the tests and demos, which we don't install
 EXTRA_OEMESON = "-Dgtk=disabled -Dlibpng=disabled"
 # ld: pixman/libpixman-mmx.a(pixman-mmx.c.o):
@@ -36,7 +47,7 @@ EXTRA_OEMESON:append:class-target:powerpc64le = " ${@bb.utils.contains("TUNE_FEA
 EXTRA_OEMESON:append:armv7a = "${@bb.utils.contains("TUNE_FEATURES","neon",""," -Dneon=disabled",d)}"
 EXTRA_OEMESON:append:armv7ve = "${@bb.utils.contains("TUNE_FEATURES","neon",""," -Dneon=disabled",d)}"
 
-EXTRA_OEMESON:append:class-native = " -Dopenmp=disabled"
+CFLAGS:append:toolchain-clang:mipsarch = " -fno-integrated-as"
 
 BBCLASSEXTEND = "native nativesdk"
 
#1 lore raw
Quoted 1 line · Khem Raj via lists.openembedded.org

+PACKAGECONFIG[openmp] = ",-Dopenmp=disabled,${OPENMP}"

There should be an explicit enablement too, otherwise we rely on upstream default for it, which can silently change.

Alex

#2 lore raw
In reply to Khem Raj
Quoted 49 lines · Khem Raj via lists.openembedded.org

pixman's meson detects openmp support and if it finds it in runtime then enables it, this happens for gcc via gcc-runtime, however for clang, it does not. In some cases e.g. mips it enables it during configure only to find that clang can not find the libomp during linking. Therefore, add the dependency on openmp when using clang compiler. This ensures consistent behaviour across architectures.

Disable internal assembler on mips since it can not handle the inline assembly

Turn openmp into a packageconfig

openmp is not yet ported to all architectures e.g. RISCV32/PPC32 does not have it

---
v5: Remove openmp on rv32 and ppc32

 meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb | 13 ++++++++++++-

 1 file changed, 12 insertions(+), 1 deletion(-)
meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb +0 -0
index c1c71fd4202..925a7d7b29b 100644
@@ -23,6 +23,17 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=14096c769ae0cbb5fcb94ec468be11b3 \


 inherit meson pkgconfig

meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb +11 -0
+OPENMP ?= ""
+OPENMP:toolchain-clang = "openmp"
+# openmp is not yet ported to rv32/ppc
+OPENMP:remove:riscv32 = "openmp"
+OPENMP:remove:powerpc = "openmp"
+
+PACKAGECONFIG ??= "openmp"
+PACKAGECONFIG:class-native ?= ""
+
+PACKAGECONFIG[openmp] = ",-Dopenmp=disabled,${OPENMP}"
+

 # These are for the tests and demos, which we don't install EXTRA_OEMESON = "-Dgtk=disabled -Dlibpng=disabled" # ld: pixman/libpixman-mmx.a(pixman-mmx.c.o):

meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb +0 -0
@@ -36,7 +47,7 @@ EXTRA_OEMESON:append:class-target:powerpc64le = " ${@bb.utils.contains("TUNE_FEA

 EXTRA_OEMESON:append:armv7a = "${@bb.utils.contains("TUNE_FEATURES","neon",""," -Dneon=disabled",d)}" EXTRA_OEMESON:append:armv7ve = "${@bb.utils.contains("TUNE_FEATURES","neon",""," -Dneon=disabled",d)}"

meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb +1 -1
-EXTRA_OEMESON:append:class-native = " -Dopenmp=disabled"
+CFLAGS:append:toolchain-clang:mipsarch = " -fno-integrated-as"
Quoted 2 lines


 BBCLASSEXTEND = "native nativesdk"

I think this needs more discussion or potentially a better fix.

Potentially the test for openmp in pixman is wrong and it shouldn't build if it can find the header but not the library.

Alternatively, if the openmp library can't be built, why are we shipping the header? Should we delete it in that case?

Something doesn't see right here and I think we need to fix the root cause.

Cheers,

Richard

author
#3 lore raw
Quoted 59 lines · Richard Purdie
Quoted 5 lines · Khem Raj via lists.openembedded.org

pixman's meson detects openmp support and if it finds it in runtime then enables it, this happens for gcc via gcc-runtime, however for clang, it does not. In some cases e.g. mips it enables it during configure only to find that clang can not find the libomp during linking. Therefore, add the dependency on openmp when using clang compiler. This ensures

consistent

Quoted 3 lines

behaviour across architectures.

Disable internal assembler on mips since it can not handle the inline

assembly

Quoted 6 lines

Turn openmp into a packageconfig

openmp is not yet ported to all architectures e.g. RISCV32/PPC32 does not have it

Review

Quoted 8 lines

---
v5: Remove openmp on rv32 and ppc32

 meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb

meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb LIC_FILES_CHKSUM =

Quoted 4 lines

index c1c71fd4202..925a7d7b29b 100644

meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb +0 -0
@@ -23,6 +23,17 @@ LIC_FILES_CHKSUM =

"file://COPYING;md5=14096c769ae0cbb5fcb94ec468be11b3 \

meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb EXTRA_OEMESON:append:class-target:powerpc64le = "

Quoted 18 lines
meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb +11 -0
 inherit meson pkgconfig
 
+OPENMP ?= ""
+OPENMP:toolchain-clang = "openmp"
+# openmp is not yet ported to rv32/ppc
+OPENMP:remove:riscv32 = "openmp"
+OPENMP:remove:powerpc = "openmp"
+
+PACKAGECONFIG ??= "openmp"
+PACKAGECONFIG:class-native ?= ""
+
+PACKAGECONFIG[openmp] = ",-Dopenmp=disabled,${OPENMP}"
+
 # These are for the tests and demos, which we don't install
 EXTRA_OEMESON = "-Dgtk=disabled -Dlibpng=disabled"
 # ld: pixman/libpixman-mmx.a(pixman-mmx.c.o):
@@ -36,7 +47,7 @@ EXTRA_OEMESON:append:class-target:powerpc64le = "

${@bb.utils.contains("TUNE_FEA

meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb EXTRA_OEMESON:append:class-target:powerpc64le = " · line 47

Quoted 1 line
meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb +0 -0
 EXTRA_OEMESON:append:armv7a =

"${@bb.utils.contains("TUNE_FEATURES","neon",""," -Dneon=disabled",d)}"

meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb EXTRA_OEMESON:append:class-target:powerpc64le = " · line 48

Quoted 1 line
meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb +0 -0
 EXTRA_OEMESON:append:armv7ve =

"${@bb.utils.contains("TUNE_FEATURES","neon",""," -Dneon=disabled",d)}"

Quoted 4 lines
meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb +1 -1
-EXTRA_OEMESON:append:class-native = " -Dopenmp=disabled"
+CFLAGS:append:toolchain-clang:mipsarch = " -fno-integrated-as"
 
Quoted 7 lines

meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb EXTRA_OEMESON:append:class-target:powerpc64le = " ${@bb.utils.contains("TUNE_FEA · line 52

Quoted 1 line
meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb +0 -0
 BBCLASSEXTEND = "native nativesdk"

I think this needs more discussion or potentially a better fix.

Potentially the test for openmp in pixman is wrong and it shouldn't build if it can find the header but not the library.

This is worth exploring more and if we can make the test robust it will benefit overall

Quoted 3 lines

Alternatively, if the openmp library can't be built, why are we shipping the header? Should we delete it in that case?

Header is installed by gcc-runtime package

Quoted 13 lines

Something doesn't see right here and I think we need to fix the root cause

Cheers,

Richard

#4 lore raw
Quoted 72 lines · Khem Raj
Quoted 70 lines · Richard Purdie
Quoted 63 lines · Khem Raj via lists.openembedded.org

pixman's meson detects openmp support and if it finds it in runtime then
enables it, this happens for gcc via gcc-runtime, however for clang, it
does not. In some cases e.g. mips it enables it during configure only to
find that clang can not find the libomp during linking. Therefore, add
the dependency on openmp when using clang compiler. This ensures consistent
behaviour across architectures.

Disable internal assembler on mips since it can not handle the inline assembly

Turn openmp into a packageconfig

openmp is not yet ported to all architectures e.g. RISCV32/PPC32 does not have it

---
v5: Remove openmp on rv32 and ppc32

 meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb | 13
++++++++++++-

 1 file changed, 12 insertions(+), 1 deletion(-)
meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb +0 -0
index c1c71fd4202..925a7d7b29b 100644
@@ -23,6 +23,17 @@ LIC_FILES_CHKSUM =
 "file://COPYING;md5=14096c769ae0cbb5fcb94ec468be11b3 \


 inherit meson pkgconfig

meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb +11 -0
+OPENMP ?= ""
+OPENMP:toolchain-clang = "openmp"
+# openmp is not yet ported to rv32/ppc
+OPENMP:remove:riscv32 = "openmp"
+OPENMP:remove:powerpc = "openmp"
+
+PACKAGECONFIG ??= "openmp"
+PACKAGECONFIG:class-native ?= ""
+
+PACKAGECONFIG[openmp] = ",-Dopenmp=disabled,${OPENMP}"
+

 # These are for the tests and demos, which we don't install EXTRA_OEMESON = "-Dgtk=disabled -Dlibpng=disabled" # ld: pixman/libpixman-mmx.a(pixman-mmx.c.o):

meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb +0 -0
@@ -36,7 +47,7 @@ EXTRA_OEMESON:append:class-target:powerpc64le =

" ${@bb.utils.contains("TUNE_FEA EXTRA_OEMESON:append:armv7a = "${@bb.utils.contains("TUNE_FEATURES","neon",""," - Dneon=disabled",d)}" EXTRA_OEMESON:append:armv7ve = "${@bb.utils.contains("TUNE_FEATURES","neon",""," - Dneon=disabled",d)}"

meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb +1 -1
-EXTRA_OEMESON:append:class-native = " -Dopenmp=disabled"
+CFLAGS:append:toolchain-clang:mipsarch = " -fno-integrated-as"
Quoted 2 lines


 BBCLASSEXTEND = "native nativesdk"

I think this needs more discussion or potentially a better fix.

Quoted 6 lines
Quoted 3 lines

Potentially the test for openmp in pixman is wrong and it shouldn't build if it can find the header but not the library.

This is worth exploring more and if we can make the test robust it will benefit overall

Agreed.

Quoted 6 lines
Quoted 3 lines

Alternatively, if the openmp library can't be built, why are we shipping the header? Should we delete it in that case?

Header is installed by gcc-runtime package

We could delete it if the library isn't present...

You have to wonder why the code is installing it if the lib doesn't exist. Is that standard upstream behaviour?

Cheers,

Richard