diff mbox series

[v3,07/13] pixman: Fix build with mips/clang

Message ID 20250522-clang-toolchain-v3-7-16cfc6d9891b@gmail.com
State New
Headers show
Series clang: Add clang C/C++ toolchain | expand

Commit Message

Khem Raj May 23, 2025, 3:52 a.m. UTC
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb | 3 +++
 1 file changed, 3 insertions(+)

Comments

Richard Purdie May 29, 2025, 9:23 a.m. UTC | #1
On Thu, 2025-05-22 at 20:52 -0700, Khem Raj via lists.openembedded.org wrote:
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb b/meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb
> index c1c71fd42023fbd8c82d49ff623a981139f5ac7e..0c779ac3b4e6d035d9105c98aea0560a71d57ba3 100644
> --- a/meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb
> +++ b/meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb
> @@ -6,6 +6,7 @@ including trapezoids, triangles, and rectangles."
>  HOMEPAGE = "http://www.pixman.org"
>  SECTION = "x11/libs"
>  DEPENDS = "zlib"
> +DEPENDS:append:toolchain-clang:mipsarch = " openmp"
>  
>  SRC_URI = "https://www.cairographics.org/releases/${BP}.tar.gz"
>  SRC_URI[sha256sum] = "02d9ff7b8458ef61731c3d355f854bbf461fd0a4d3563c51f1c1c7b00638050d"
> @@ -38,6 +39,8 @@ EXTRA_OEMESON:append:armv7ve = "${@bb.utils.contains("TUNE_FEATURES","neon","","
>  
>  EXTRA_OEMESON:append:class-native = " -Dopenmp=disabled"
>  
> +CFLAGS:append:toolchain-clang:mipsarch = " -fno-integrated-as"
> +
>  BBCLASSEXTEND = "native nativesdk"

See the comment on libjpeg-turbo. Should there be a -f here or not?

Cheers,

Richard
Ross Burton May 29, 2025, 9:24 a.m. UTC | #2
On 23 May 2025, at 04:52, Khem Raj via lists.openembedded.org <raj.khem=gmail.com@lists.openembedded.org> wrote:
> 
> +DEPENDS:append:toolchain-clang:mipsarch = " openmp”

Can you elaborate on why openmp is only needed for mips with clang, and no other targets?

Ross
Khem Raj May 29, 2025, 8:05 p.m. UTC | #3
On Thu, May 29, 2025 at 2:23 AM Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
>
> On Thu, 2025-05-22 at 20:52 -0700, Khem Raj via lists.openembedded.org wrote:
> > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > ---
> >  meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb b/meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb
> > index c1c71fd42023fbd8c82d49ff623a981139f5ac7e..0c779ac3b4e6d035d9105c98aea0560a71d57ba3 100644
> > --- a/meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb
> > +++ b/meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb
> > @@ -6,6 +6,7 @@ including trapezoids, triangles, and rectangles."
> >  HOMEPAGE = "http://www.pixman.org"
> >  SECTION = "x11/libs"
> >  DEPENDS = "zlib"
> > +DEPENDS:append:toolchain-clang:mipsarch = " openmp"
> >
> >  SRC_URI = "https://www.cairographics.org/releases/${BP}.tar.gz"
> >  SRC_URI[sha256sum] = "02d9ff7b8458ef61731c3d355f854bbf461fd0a4d3563c51f1c1c7b00638050d"
> > @@ -38,6 +39,8 @@ EXTRA_OEMESON:append:armv7ve = "${@bb.utils.contains("TUNE_FEATURES","neon","","
> >
> >  EXTRA_OEMESON:append:class-native = " -Dopenmp=disabled"
> >
> > +CFLAGS:append:toolchain-clang:mipsarch = " -fno-integrated-as"
> > +
> >  BBCLASSEXTEND = "native nativesdk"
>
> See the comment on libjpeg-turbo. Should there be a -f here or not?
>

right, we will fix libjpeg-turbo to match what we have here.

> Cheers,
>
> Richard
>
>
Khem Raj May 29, 2025, 8:43 p.m. UTC | #4
On Thu, May 29, 2025 at 2:25 AM Ross Burton <Ross.Burton@arm.com> wrote:
>
> On 23 May 2025, at 04:52, Khem Raj via lists.openembedded.org <raj.khem=gmail.com@lists.openembedded.org> wrote:
> >
> > +DEPENDS:append:toolchain-clang:mipsarch = " openmp”
>
> Can you elaborate on why openmp is only needed for mips with clang, and no other targets?
>

seems pixman's detection logic for openMP support checks for including
omp.h. I see for qemumips, it ends up detecting openmp even when its
not in dependencies because omp.h is
installed by libgomp from gcc-runtime.


Run-time dependency OpenMP found: YES 5.1


where the same test on qemuarm64 fails with

mnt/b/yoe/master/sources/poky/build/tmp/work/cortexa57-poky-linux-musl/pixman/0.46.0/build/meson-private/tmpyl863djw/testfile.c:4:12:
error: "Header 'omp_lib.h' could not be found"
    4 |           #error "Header 'omp_lib.h' could not be found"
      |            ^
1 error generated.
-----------
WARNING: OpenMP found but omp.h missing.
Run-time dependency OpenMP found: NO (tried system)

It culminates to a problem in header include paths that mips and
aarch64 clang is using

mips
#include <...> search starts here:
 /mnt/b/yoe/master/sources/poky/build/tmp/work/mips32r2-poky-linux-musl/pixman/0.46.0/recipe-sysroot/usr/lib/mips-poky-linux-musl/15.1.0/include
 /mnt/b/yoe/master/sources/poky/build/tmp/work/mips32r2-poky-linux-musl/pixman/0.46.0/recipe-sysroot/usr/include
 /mnt/b/yoe/master/sources/poky/build/tmp/work/mips32r2-poky-linux-musl/pixman/0.46.0/recipe-sysroot-native/usr/lib/clang/20/include
End of search list.

aarch64
#include <...> search starts here:
 /mnt/b/yoe/master/sources/poky/build/tmp/work/cortexa57-poky-linux-musl/pixman/0.46.0/recipe-sysroot/usr/include
 /mnt/b/yoe/master/sources/poky/build/tmp/work/cortexa57-poky-linux-musl/pixman/0.46.0/recipe-sysroot-native/usr/lib/clang/20/include
End of search list.

that's why it finds omp.h since the path is on searchdir on mips but
not on aarch64, I think mips behavior is unwanted.

I think the linking to openmp should be unconditional on clang, since
it will be using it with gcc but then disables it for clang since the
test fails. I will send another version

> Ross
>
diff mbox series

Patch

diff --git a/meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb b/meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb
index c1c71fd42023fbd8c82d49ff623a981139f5ac7e..0c779ac3b4e6d035d9105c98aea0560a71d57ba3 100644
--- a/meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb
+++ b/meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb
@@ -6,6 +6,7 @@  including trapezoids, triangles, and rectangles."
 HOMEPAGE = "http://www.pixman.org"
 SECTION = "x11/libs"
 DEPENDS = "zlib"
+DEPENDS:append:toolchain-clang:mipsarch = " openmp"
 
 SRC_URI = "https://www.cairographics.org/releases/${BP}.tar.gz"
 SRC_URI[sha256sum] = "02d9ff7b8458ef61731c3d355f854bbf461fd0a4d3563c51f1c1c7b00638050d"
@@ -38,6 +39,8 @@  EXTRA_OEMESON:append:armv7ve = "${@bb.utils.contains("TUNE_FEATURES","neon","","
 
 EXTRA_OEMESON:append:class-native = " -Dopenmp=disabled"
 
+CFLAGS:append:toolchain-clang:mipsarch = " -fno-integrated-as"
+
 BBCLASSEXTEND = "native nativesdk"
 
 CVE_STATUS[CVE-2023-37769] = "not-applicable-config: stress-test is an uninstalled test"