Skip to contentSkip to conversation

pulseaudio: define -mfloat-abi=softfp for CC on armv5

PATCH Superseded Yu, Mingli 5 participants 10 messages Dec 29, 2020 – Jul 2, 2021 Arm/Amlogic Meson SoC support

lore
Share & tools
lore

Yu, Mingli

author
#0 lore raw

PATCH 1/1 pulseaudio: define -mfloat-abi=softfp for CC on armv5

From: Mingli Yu <[email protected]>

After pulseaudio upgrades from 13.0 to 14.0, it also switches from autotools to meson and there's no option for disabling Neon optimizations with meson. And the build system adds -mfpu=neon at the end of the compiler command line which overrids any earlier -mfpu options and result below build failure:

| /prj/tmp-glibc/work/armv5e-wrs-linux-gnueabi/pulseaudio/14.0-r0/recipe-sysroot-native/usr/lib/arm-wrs-linux-gnueabi/gcc/arm-wrs-linux-gnueabi/10.2.0/include/arm_neon.h:31:2: error: #error "NEON intrinsics not available with the soft-float ABI. Please use -mfloat-abi=softfp or -mfloat-abi=hard"

|  31 | #error "NEON intrinsics not available with the soft-float ABI.  Please use -mfloat-abi=softfp or -mfloat-abi=hard"
      |  ^~~~~
| ../pulseaudio-14.0/src/pulsecore/mix_neon.c: In function 'pa_mix_ch2_s16ne_neon':
| ../pulseaudio-14.0/src/pulsecore/mix_neon.c:38:9: error: unknown type name 'int32x4_t'; did you mean 'int32_t'?
|   38 |         int32x4_t sum0, sum1;

Define -mfloat-abi=softfp for CC on armv5 to fix the above issue.

---
 meta/recipes-multimedia/pulseaudio/pulseaudio.inc | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-multimedia/pulseaudio/pulseaudio.inc +1 -0
index e40b8c1c40..44a6a3055e 100644
@@ -123,6 +123,7 @@ PACKAGECONFIG[ipv6] = "-Dipv6=true,-Dipv6=false,"
 PACKAGECONFIG[manpages] = "-Dman=true,-Dman=false,"
 
 export TARGET_PFPU = "${TARGET_FPU}"
+export CC_append_armv5 = " -mfloat-abi=softfp"
 
 set_cfg_value () {
 	sed -i -e "s/\(; *\)\?$2 =.*/$2 = $3/" "$1"
Signature · 1 line
2.26.2
#1 lore raw
Quoted 8 lines · Mingli

From: Mingli Yu <[email protected]>

After pulseaudio upgrades from 13.0 to 14.0, it also switches from autotools to meson and there's no option for disabling Neon optimizations with meson. And the build system adds -mfpu=neon at the end of the compiler command line which overrids any earlier -mfpu options and result below build failure:

Quoted 8 lines

| /prj/tmp-glibc/work/armv5e-wrs-linux-gnueabi/pulseaudio/14.0-r0/recipe-sysroot-native/usr/lib/arm-wrs-linux-gnueabi/gcc/arm-wrs-linux-gnueabi/10.2.0/include/arm_neon.h:31:2: error: #error "NEON intrinsics not available with the soft-float ABI. Please use -mfloat-abi=softfp or -mfloat-abi=hard"

|  31 | #error "NEON intrinsics not available with the soft-float ABI.  Please use -mfloat-abi=softfp or -mfloat-abi=hard"
      |  ^~~~~
| ../pulseaudio-14.0/src/pulsecore/mix_neon.c: In function 'pa_mix_ch2_s16ne_neon':
| ../pulseaudio-14.0/src/pulsecore/mix_neon.c:38:9: error: unknown type name 'int32x4_t'; did you mean 'int32_t'?
|   38 |         int32x4_t sum0, sum1;

Define -mfloat-abi=softfp for CC on armv5 to fix the above issue.

Doesn't look right. That forces the whole package to be compiled with floating point instructions, which will break targets which need soft float.

Quoted 10 lines
---
 meta/recipes-multimedia/pulseaudio/pulseaudio.inc | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-multimedia/pulseaudio/pulseaudio.inc +0 -0
index e40b8c1c40..44a6a3055e 100644

meta/recipes-multimedia/pulseaudio/pulseaudio.inc PACKAGECONFIG[ipv6] = "-Dipv6=true,-Dipv6=false," · line 126

Quoted 4 lines
meta/recipes-multimedia/pulseaudio/pulseaudio.inc +1 -0
@@ -123,6 +123,7 @@ PACKAGECONFIG[ipv6] = "-Dipv6=true,-Dipv6=false,"
 PACKAGECONFIG[manpages] = "-Dman=true,-Dman=false,"
 
 export TARGET_PFPU = "${TARGET_FPU}"
+export CC_append_armv5 = " -mfloat-abi=softfp"

Aside from the fact that the change itself looks wrong, what is export with a conditional append supposed to do? Export unconditionally (and so have a side effect for targets other than armv5)? Export only if the conditional append took effect? Since most people have no idea, it's better to keep export and the conditional append separate.

Quoted 8 lines
meta/recipes-multimedia/pulseaudio/pulseaudio.inc +0 -1
 set_cfg_value () {
        sed -i -e "s/\(; *\)\?$2 =.*/$2 = $3/" "$1"
--

2.26.2

author
#2 lore raw

Hi Andre,

The override for CC is just for armv5 and it shouldn't affect other BSPS.

Thanks,
________________________________
From: Andre McCurdy <[email protected]>
Sent: Tuesday, December 29, 2020 11:29
To: Yu, Mingli <[email protected]>
Cc: OE Core mailing list <[email protected]>
Subject: Re: [OE-core] [PATCH] pulseaudio: define -mfloat-abi=softfp for CC on armv5

Quoted 8 lines · Mingli

From: Mingli Yu <[email protected]>

After pulseaudio upgrades from 13.0 to 14.0, it also switches from autotools to meson and there's no option for disabling Neon optimizations with meson. And the build system adds -mfpu=neon at the end of the compiler command line which overrids any earlier -mfpu options and result below build failure:

Quoted 8 lines

| /prj/tmp-glibc/work/armv5e-wrs-linux-gnueabi/pulseaudio/14.0-r0/recipe-sysroot-native/usr/lib/arm-wrs-linux-gnueabi/gcc/arm-wrs-linux-gnueabi/10.2.0/include/arm_neon.h:31:2: error: #error "NEON intrinsics not available with the soft-float ABI. Please use -mfloat-abi=softfp or -mfloat-abi=hard"

|  31 | #error "NEON intrinsics not available with the soft-float ABI.  Please use -mfloat-abi=softfp or -mfloat-abi=hard"
      |  ^~~~~
| ../pulseaudio-14.0/src/pulsecore/mix_neon.c: In function 'pa_mix_ch2_s16ne_neon':
| ../pulseaudio-14.0/src/pulsecore/mix_neon.c:38:9: error: unknown type name 'int32x4_t'; did you mean 'int32_t'?
|   38 |         int32x4_t sum0, sum1;

Define -mfloat-abi=softfp for CC on armv5 to fix the above issue.

Doesn't look right. That forces the whole package to be compiled with floating point instructions, which will break targets which need soft float.

Quoted 10 lines
---
 meta/recipes-multimedia/pulseaudio/pulseaudio.inc | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-multimedia/pulseaudio/pulseaudio.inc +0 -0
index e40b8c1c40..44a6a3055e 100644

meta/recipes-multimedia/pulseaudio/pulseaudio.inc PACKAGECONFIG[ipv6] = "-Dipv6=true,-Dipv6=false," · line 126

Quoted 4 lines
meta/recipes-multimedia/pulseaudio/pulseaudio.inc +1 -0
@@ -123,6 +123,7 @@ PACKAGECONFIG[ipv6] = "-Dipv6=true,-Dipv6=false,"
 PACKAGECONFIG[manpages] = "-Dman=true,-Dman=false,"
 
 export TARGET_PFPU = "${TARGET_FPU}"
+export CC_append_armv5 = " -mfloat-abi=softfp"

Aside from the fact that the change itself looks wrong, what is export with a conditional append supposed to do? Export unconditionally (and so have a side effect for targets other than armv5)? Export only if the conditional append took effect? Since most people have no idea, it's better to keep export and the conditional append separate.

Quoted 8 lines
meta/recipes-multimedia/pulseaudio/pulseaudio.inc +0 -1
 set_cfg_value () {
        sed -i -e "s/\(; *\)\?$2 =.*/$2 = $3/" "$1"
--

2.26.2

author
#3 lore raw

PATCH v2 1/1 pulseaudio: define -mfloat-abi=softfp for CC on armv5

In reply to Andre McCurdy

From: Mingli Yu <[email protected]>

After pulseaudio upgrades from 13.0 to 14.0, it also switches from autotools to meson. In autotools, there is --disable-neon-opt option for disabling NEON optimizations, but there is no counterpart in meson.

And the meson build system adds -mfpu=neon at the end of the compiler command line which overrids any earlier -mfpu options and result below build failure on armv5:

| /prj/tmp-glibc/work/armv5e-wrs-linux-gnueabi/pulseaudio/14.0-r0/recipe-sysroot-native/usr/lib/arm-wrs-linux-gnueabi/gcc/arm-wrs-linux-gnueabi/10.2.0/include/arm_neon.h:31:2: error: #error "NEON intrinsics not available with the soft-float ABI. Please use -mfloat-abi=softfp or -mfloat-abi=hard"

|  31 | #error "NEON intrinsics not available with the soft-float ABI.  Please use -mfloat-abi=softfp or -mfloat-abi=hard"
      |  ^~~~~
| ../pulseaudio-14.0/src/pulsecore/mix_neon.c: In function 'pa_mix_ch2_s16ne_neon':
| ../pulseaudio-14.0/src/pulsecore/mix_neon.c:38:9: error: unknown type name 'int32x4_t'; did you mean 'int32_t'?
|   38 |         int32x4_t sum0, sum1;

Define -mfloat-abi=softfp for CC on armv5 to fix the above issue.

---
 meta/recipes-multimedia/pulseaudio/pulseaudio.inc | 5 +++++
 1 file changed, 5 insertions(+)
meta/recipes-multimedia/pulseaudio/pulseaudio.inc +5 -0
index e40b8c1c40..761e4f74dc 100644
@@ -123,6 +123,11 @@ PACKAGECONFIG[ipv6] = "-Dipv6=true,-Dipv6=false,"
 PACKAGECONFIG[manpages] = "-Dman=true,-Dman=false,"
 
 export TARGET_PFPU = "${TARGET_FPU}"
+# workaround build failure on qemuarmv5 as the neon optimizations is
+# enabled by default and no option to disable neon with meson build
+# system
+CC_append_armv5 = " -mfloat-abi=softfp"
+export CC
 
 set_cfg_value () {
 	sed -i -e "s/\(; *\)\?$2 =.*/$2 = $3/" "$1"
Signature · 1 line
2.26.2
#4 lore raw

On Tue, 2021-01-05 at 11:37 +0800, Yu, Mingli wrote:
From: Mingli Yu <[email protected]>

After pulseaudio upgrades from 13.0 to 14.0, it also switches from autotools
to meson. In autotools, there is --disable-neon-opt option for disabling NEON
optimizations, but there is no counterpart in meson.

And the meson build system adds -mfpu=neon at the end of the compiler command
line which overrids any earlier -mfpu options and result below build failure
on armv5:

Quoted 7 lines

/prj/tmp-glibc/work/armv5e-wrs-linux-gnueabi/pulseaudio/14.0- r0/recipe-sysroot-native/usr/lib/arm-wrs-linux-gnueabi/gcc/arm-wrs- linux-gnueabi/10.2.0/include/arm_neon.h:31:2: error: #error "NEON intrinsics not available with the soft-float ABI.  Please use - mfloat-abi=softfp or -mfloat-abi=hard"
 31 | #error "NEON intrinsics not available with the soft-float ABI. Please use -mfloat-abi=softfp or -mfloat-abi=hard"

      |  ^~~~~

Quoted 5 lines

../pulseaudio-14.0/src/pulsecore/mix_neon.c: In function 'pa_mix_ch2_s16ne_neon':
../pulseaudio-14.0/src/pulsecore/mix_neon.c:38:9: error: unknown type name 'int32x4_t'; did you mean 'int32_t'?
  38 |         int32x4_t sum0, sum1;

Define -mfloat-abi=softfp for CC on armv5 to fix the above issue.

---
 meta/recipes-multimedia/pulseaudio/pulseaudio.inc | 5 +++++

 1 file changed, 5 insertions(+)
(quoted diff) +0 -0

b/meta/recipes-multimedia/pulseaudio/pulseaudio.inc index e40b8c1c40..761e4f74dc 100644

meta/recipes-multimedia/pulseaudio/pulseaudio.inc +0 -0
@@ -123,6 +123,11 @@ PACKAGECONFIG[ipv6] = "-Dipv6=true,-Dipv6=false,"

 PACKAGECONFIG[manpages] = "-Dman=true,-Dman=false,"

 export TARGET_PFPU = "${TARGET_FPU}"
+# workaround build failure on qemuarmv5 as the neon optimizations is +# enabled by default and no option to disable neon with meson build +# system
+CC_append_armv5 = " -mfloat-abi=softfp"
+export CC

 set_cfg_value () {
        sed -i -e "s/\(; *\)\?$2 =.*/$2 = $3/" "$1"

I really don't want to add things like this to the recipe, I think it will interfere with other parts of the compilation. In many ways I'd prefer an option added to meson. Do we know what upstream are thinking in relation to this?

Cheers,

Richard

#5 lore raw
Quoted 54 lines · Richard Purdie

On Tue, 2021-01-05 at 11:37 +0800, Yu, Mingli wrote:
From: Mingli Yu <[email protected]>

After pulseaudio upgrades from 13.0 to 14.0, it also switches from autotools
to meson. In autotools, there is --disable-neon-opt option for disabling NEON
optimizations, but there is no counterpart in meson.

And the meson build system adds -mfpu=neon at the end of the compiler command
line which overrids any earlier -mfpu options and result below build failure
on armv5:

Quoted 7 lines

/prj/tmp-glibc/work/armv5e-wrs-linux-gnueabi/pulseaudio/14.0- r0/recipe-sysroot-native/usr/lib/arm-wrs-linux-gnueabi/gcc/arm-wrs- linux-gnueabi/10.2.0/include/arm_neon.h:31:2: error: #error "NEON intrinsics not available with the soft-float ABI. Please use - mfloat-abi=softfp or -mfloat-abi=hard"
31 | #error "NEON intrinsics not available with the soft-float ABI.
Please use -mfloat-abi=softfp or -mfloat-abi=hard"

      |  ^~~~~
Quoted 5 lines

../pulseaudio-14.0/src/pulsecore/mix_neon.c: In function 'pa_mix_ch2_s16ne_neon':
../pulseaudio-14.0/src/pulsecore/mix_neon.c:38:9: error: unknown type name 'int32x4_t'; did you mean 'int32_t'?
38 | int32x4_t sum0, sum1;

Define -mfloat-abi=softfp for CC on armv5 to fix the above issue.

---
 meta/recipes-multimedia/pulseaudio/pulseaudio.inc | 5 +++++
 1 file changed, 5 insertions(+)
meta/recipes-multimedia/pulseaudio/pulseaudio.inc +5 -0
index e40b8c1c40..761e4f74dc 100644
@@ -123,6 +123,11 @@ PACKAGECONFIG[ipv6] = "-Dipv6=true,-Dipv6=false,"
 PACKAGECONFIG[manpages] = "-Dman=true,-Dman=false,"
 
 export TARGET_PFPU = "${TARGET_FPU}"
+# workaround build failure on qemuarmv5 as the neon optimizations is
+# enabled by default and no option to disable neon with meson build
+# system
+CC_append_armv5 = " -mfloat-abi=softfp"
+export CC
 
 set_cfg_value () {
        sed -i -e "s/\(; *\)\?$2 =.*/$2 = $3/" "$1"
Quoted 4 lines

I really don't want to add things like this to the recipe, I think it will interfere with other parts of the compilation. In many ways I'd prefer an option added to meson. Do we know what upstream are thinking in relation to this?

I think Meson should be fixed, but it may be necessary to add a build option to PulseAudio to disable the neon code while waiting for Meson to get fixed.

I now filed a bug for Meson:
https://github.com/mesonbuild/meson/issues/8156

and another for PulseAudio:
https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/1088

so at least the relevant projects know about the issue now. I may work on fixing these myself if nobody else does, but I don't expect that to happen quickly.

Signature · 1 line
Tanu
author
#6 lore raw

Hi RP,

The pulseaudio upstream doesn't support the option to disable neon with meson per the the latest release note https://www.freedesktop.org/wiki/Software/PulseAudio/Notes/14.0/ and also thanks Tanu to report the issue to upstream as https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/1088 .

Will update the solution if there is any update.

Thanks,
<https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/1088>

________________________________
From: Tanu Kaskinen <[email protected]>
Sent: Wednesday, January 6, 2021 03:04
To: Richard Purdie <[email protected]>; Yu, Mingli <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>
Subject: Re: [OE-core] [PATCH v2] pulseaudio: define -mfloat-abi=softfp for CC on armv5

Quoted 54 lines · Richard Purdie

On Tue, 2021-01-05 at 11:37 +0800, Yu, Mingli wrote:
From: Mingli Yu <[email protected]>

After pulseaudio upgrades from 13.0 to 14.0, it also switches from autotools
to meson. In autotools, there is --disable-neon-opt option for disabling NEON
optimizations, but there is no counterpart in meson.

And the meson build system adds -mfpu=neon at the end of the compiler command
line which overrids any earlier -mfpu options and result below build failure
on armv5:

Quoted 7 lines

/prj/tmp-glibc/work/armv5e-wrs-linux-gnueabi/pulseaudio/14.0- r0/recipe-sysroot-native/usr/lib/arm-wrs-linux-gnueabi/gcc/arm-wrs- linux-gnueabi/10.2.0/include/arm_neon.h:31:2: error: #error "NEON intrinsics not available with the soft-float ABI. Please use - mfloat-abi=softfp or -mfloat-abi=hard"
31 | #error "NEON intrinsics not available with the soft-float ABI.
Please use -mfloat-abi=softfp or -mfloat-abi=hard"

      |  ^~~~~
Quoted 5 lines

../pulseaudio-14.0/src/pulsecore/mix_neon.c: In function 'pa_mix_ch2_s16ne_neon':
../pulseaudio-14.0/src/pulsecore/mix_neon.c:38:9: error: unknown type name 'int32x4_t'; did you mean 'int32_t'?
38 | int32x4_t sum0, sum1;

Define -mfloat-abi=softfp for CC on armv5 to fix the above issue.

---
 meta/recipes-multimedia/pulseaudio/pulseaudio.inc | 5 +++++
 1 file changed, 5 insertions(+)
meta/recipes-multimedia/pulseaudio/pulseaudio.inc +5 -0
index e40b8c1c40..761e4f74dc 100644
@@ -123,6 +123,11 @@ PACKAGECONFIG[ipv6] = "-Dipv6=true,-Dipv6=false,"
 PACKAGECONFIG[manpages] = "-Dman=true,-Dman=false,"
 
 export TARGET_PFPU = "${TARGET_FPU}"
+# workaround build failure on qemuarmv5 as the neon optimizations is
+# enabled by default and no option to disable neon with meson build
+# system
+CC_append_armv5 = " -mfloat-abi=softfp"
+export CC
 
 set_cfg_value () {
        sed -i -e "s/\(; *\)\?$2 =.*/$2 = $3/" "$1"
Quoted 4 lines

I really don't want to add things like this to the recipe, I think it will interfere with other parts of the compilation. In many ways I'd prefer an option added to meson. Do we know what upstream are thinking in relation to this?

I think Meson should be fixed, but it may be necessary to add a build option to PulseAudio to disable the neon code while waiting for Meson to get fixed.

I now filed a bug for Meson:
https://github.com/mesonbuild/meson/issues/8156

and another for PulseAudio:
https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/1088

so at least the relevant projects know about the issue now. I may work on fixing these myself if nobody else does, but I don't expect that to happen quickly.

--
Tanu

#7 lore raw
In reply to Tanu Kaskinen
Quoted 15 lines · Tanu Kaskinen
Quoted 6 lines · Richard Purdie

sed -i -e "s/\(; *\)\?$2 =.*/$2 = $3/" "$1"

I really don't want to add things like this to the recipe, I think it will interfere with other parts of the compilation. In many ways I'd prefer an option added to meson. Do we know what upstream are thinking in relation to this?

I think Meson should be fixed, but it may be necessary to add a build option to PulseAudio to disable the neon code while waiting for Meson to get fixed.

I now filed a bug for Meson:
https://github.com/mesonbuild/meson/issues/8156

Quoted 6 lines

and another for PulseAudio:
https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/1088

so at least the relevant projects know about the issue now. I may work on fixing these myself if nobody else does, but I don't expect that to happen quickly.

Thanks for that, it does seem to be getting a little attention so hopefully a solution will emerge!

Cheers,

Richard

author
#8 lore raw

PATCH v3 1/1 pulseaudio: check if NEON code can be compiled on arm

From: Mingli Yu <[email protected]>

Backport a patch to check if NEON code can be compiled on arm to
fix below issue:
| /prj/tmp-glibc/work/armv5e-wrs-linux-gnueabi/pulseaudio/14.0-r0/recipe-sysroot-native/usr/lib/arm-wrs-linux-gnueabi/gcc/arm-wrs-linux-gnueabi/10.2.0/include/arm_neon.h:31:2: error: #error "NEON intrinsics not available with the soft-float ABI. Please use -mfloat-abi=softfp or -mfloat-abi=hard"

 |  31 | #error "NEON intrinsics not available with the soft-float ABI.  Please use -mfloat-abi=softfp or -mfloat-abi=hard"
      |  ^~~~~
 | ../pulseaudio-14.0/src/pulsecore/mix_neon.c: In function 'pa_mix_ch2_s16ne_neon':
 | ../pulseaudio-14.0/src/pulsecore/mix_neon.c:38:9: error: unknown type name 'int32x4_t'; did you mean 'int32_t'?
 |   38 |         int32x4_t sum0, sum1;
---
 ...check-if-NEON-code-can-be-compiled-o.patch | 71 +++++++++++++++++++
 .../pulseaudio/pulseaudio_14.2.bb             |  1 +
 2 files changed, 72 insertions(+)
 create mode 100644 meta/recipes-multimedia/pulseaudio/pulseaudio/0001-build-sys-meson-check-if-NEON-code-can-be-compiled-o.patch
meta/recipes-multimedia/pulseaudio/pulseaudio/0001-build-sys-meson-check-if-NEON-code-can-be-compiled-o.patch new file +71 -0
new file mode 100644
index 0000000000..5d9370fb16
@@ -0,0 +1,71 @@
+From 09f846fbdeb19193e778ce51baa77bd03c38372e Mon Sep 17 00:00:00 2001
+From: garrison <[email protected]>
+Date: Fri, 4 Jun 2021 22:13:02 +0000
+Subject: [PATCH] build-sys: meson: check if NEON code can be compiled on arm
+
+When Meson SIMD module returns HAVE_NEON=1 on arm host, do extra compile check
+to verify compiler can actually handle NEON code.
+
+Related Meson issue #6361 https://github.com/mesonbuild/meson/issues/6361
+
+Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/574>
+
+Upstream-Status: Backport[https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/6d2a49a6a1eacc2096d0d9473a074421c181ab56]
+
+Signed-off-by: Mingli Yu <[email protected]>
+---
+ src/pulsecore/meson.build | 41 +++++++++++++++++++++++++++++----------
+ 1 file changed, 31 insertions(+), 10 deletions(-)
+
+diff --git a/src/pulsecore/meson.build b/src/pulsecore/meson.build
+index 99a702e..d0b7990 100644
+--- a/src/pulsecore/meson.build
++++ b/src/pulsecore/meson.build
+@@ -172,16 +172,37 @@ endif
+ 
+ # FIXME: SIMD support (ORC)
+ simd = import('unstable-simd')
+-libpulsecore_simd = simd.check('libpulsecore_simd',
+-  mmx : ['remap_mmx.c', 'svolume_mmx.c'],
+-  sse : ['remap_sse.c', 'sconv_sse.c', 'svolume_sse.c'],
+-  neon : ['remap_neon.c', 'sconv_neon.c', 'mix_neon.c'],
+-  c_args : [pa_c_args],
+-  include_directories : [configinc, topinc],
+-  implicit_include_directories : false,
+-  compiler : cc)
+-libpulsecore_simd_lib = libpulsecore_simd[0]
+-cdata.merge_from(libpulsecore_simd[1])
++simd_variants = [
++  { 'mmx' : ['remap_mmx.c', 'svolume_mmx.c'] },
++  { 'sse' : ['remap_sse.c', 'sconv_sse.c', 'svolume_sse.c'] },
++  { 'neon' : ['remap_neon.c', 'sconv_neon.c', 'mix_neon.c'] },
++]
++
++libpulsecore_simd_lib = []
++
++foreach simd_kwargs : simd_variants
++
++  if host_machine.cpu_family() == 'arm' and 'neon' in simd_kwargs
++    if not cc.compiles('''
++        #include <arm_neon.h>
++        int main() {
++            return sizeof(uint8x8_t) + sizeof(int32x4_t) + sizeof(float32x4_t);
++        }
++        ''', name : 'neon code')
++      continue
++    endif
++  endif
++
++  libpulsecore_simd = simd.check('libpulsecore_simd',
++    kwargs : simd_kwargs,
++    c_args : [pa_c_args],
++    include_directories : [configinc, topinc],
++    implicit_include_directories : false,
++    compiler : cc)
++
++  libpulsecore_simd_lib += libpulsecore_simd[0]
++  cdata.merge_from(libpulsecore_simd[1])
++endforeach
+ 
+ # FIXME: Implement Windows support
+ #'mutex-win32.c',
meta/recipes-multimedia/pulseaudio/pulseaudio_14.2.bb +1 -0
index 9b8338a665..a7ea8caccb 100644
@@ -7,6 +7,7 @@ SRC_URI = "http://freedesktop.org/software/pulseaudio/releases/${BP}.tar.xz \
            file://0001-meson-Check-for-__get_cpuid.patch \
            file://volatiles.04_pulse \
            file://0001-doxygen-meson.build-remove-dependency-on-doxygen-bin.patch \
+           file://0001-build-sys-meson-check-if-NEON-code-can-be-compiled-o.patch \
            "
 SRC_URI[md5sum] = "1efc916251910f1e9d4df7810e3e69f8"
 SRC_URI[sha256sum] = "75d3f7742c1ae449049a4c88900e454b8b350ecaa8c544f3488a2562a9ff66f1"
Signature · 1 line
2.29.2
Tested-by on v3 1/1
#9 lore raw

Re: [OE-core] [PATCH v3] pulseaudio: check if NEON code can be compiled on arm

Quoted 109 lines · Mingli

From: Mingli Yu <[email protected]>

Backport a patch to check if NEON code can be compiled on arm to
fix below issue:
| /prj/tmp-glibc/work/armv5e-wrs-linux-gnueabi/pulseaudio/14.0-r0/recipe-sysroot-native/usr/lib/arm-wrs-linux-gnueabi/gcc/arm-wrs-linux-gnueabi/10.2.0/include/arm_neon.h:31:2: error: #error "NEON intrinsics not available with the soft-float ABI. Please use -mfloat-abi=softfp or -mfloat-abi=hard"

 |  31 | #error "NEON intrinsics not available with the soft-float ABI.  Please use -mfloat-abi=softfp or -mfloat-abi=hard"
      |  ^~~~~
 | ../pulseaudio-14.0/src/pulsecore/mix_neon.c: In function 'pa_mix_ch2_s16ne_neon':
 | ../pulseaudio-14.0/src/pulsecore/mix_neon.c:38:9: error: unknown type name 'int32x4_t'; did you mean 'int32_t'?
 |   38 |         int32x4_t sum0, sum1;
---
 ...check-if-NEON-code-can-be-compiled-o.patch | 71 +++++++++++++++++++
 .../pulseaudio/pulseaudio_14.2.bb             |  1 +
 2 files changed, 72 insertions(+)
 create mode 100644 meta/recipes-multimedia/pulseaudio/pulseaudio/0001-build-sys-meson-check-if-NEON-code-can-be-compiled-o.patch
meta/recipes-multimedia/pulseaudio/pulseaudio/0001-build-sys-meson-check-if-NEON-code-can-be-compiled-o.patch new file +71 -0
new file mode 100644
index 0000000000..5d9370fb16
@@ -0,0 +1,71 @@
+From 09f846fbdeb19193e778ce51baa77bd03c38372e Mon Sep 17 00:00:00 2001
+From: garrison <[email protected]>
+Date: Fri, 4 Jun 2021 22:13:02 +0000
+Subject: [PATCH] build-sys: meson: check if NEON code can be compiled on arm
+
+When Meson SIMD module returns HAVE_NEON=1 on arm host, do extra compile check
+to verify compiler can actually handle NEON code.
+
+Related Meson issue #6361 https://github.com/mesonbuild/meson/issues/6361
+
+Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/574>
+
+Upstream-Status: Backport[https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/6d2a49a6a1eacc2096d0d9473a074421c181ab56]
+
+Signed-off-by: Mingli Yu <[email protected]>
+---
+ src/pulsecore/meson.build | 41 +++++++++++++++++++++++++++++----------
+ 1 file changed, 31 insertions(+), 10 deletions(-)
+
+diff --git a/src/pulsecore/meson.build b/src/pulsecore/meson.build
+index 99a702e..d0b7990 100644
+--- a/src/pulsecore/meson.build
++++ b/src/pulsecore/meson.build
+@@ -172,16 +172,37 @@ endif
+
+ # FIXME: SIMD support (ORC)
+ simd = import('unstable-simd')
+-libpulsecore_simd = simd.check('libpulsecore_simd',
+-  mmx : ['remap_mmx.c', 'svolume_mmx.c'],
+-  sse : ['remap_sse.c', 'sconv_sse.c', 'svolume_sse.c'],
+-  neon : ['remap_neon.c', 'sconv_neon.c', 'mix_neon.c'],
+-  c_args : [pa_c_args],
+-  include_directories : [configinc, topinc],
+-  implicit_include_directories : false,
+-  compiler : cc)
+-libpulsecore_simd_lib = libpulsecore_simd[0]
+-cdata.merge_from(libpulsecore_simd[1])
++simd_variants = [
++  { 'mmx' : ['remap_mmx.c', 'svolume_mmx.c'] },
++  { 'sse' : ['remap_sse.c', 'sconv_sse.c', 'svolume_sse.c'] },
++  { 'neon' : ['remap_neon.c', 'sconv_neon.c', 'mix_neon.c'] },
++]
++
++libpulsecore_simd_lib = []
++
++foreach simd_kwargs : simd_variants
++
++  if host_machine.cpu_family() == 'arm' and 'neon' in simd_kwargs
++    if not cc.compiles('''
++        #include <arm_neon.h>
++        int main() {
++            return sizeof(uint8x8_t) + sizeof(int32x4_t) + sizeof(float32x4_t);
++        }
++        ''', name : 'neon code')
++      continue
++    endif
++  endif
++
++  libpulsecore_simd = simd.check('libpulsecore_simd',
++    kwargs : simd_kwargs,
++    c_args : [pa_c_args],
++    include_directories : [configinc, topinc],
++    implicit_include_directories : false,
++    compiler : cc)
++
++  libpulsecore_simd_lib += libpulsecore_simd[0]
++  cdata.merge_from(libpulsecore_simd[1])
++endforeach
+
+ # FIXME: Implement Windows support
+ #'mutex-win32.c',
meta/recipes-multimedia/pulseaudio/pulseaudio_14.2.bb +1 -1
index 9b8338a665..a7ea8caccb 100644
@@ -7,6 +7,7 @@ SRC_URI = "http://freedesktop.org/software/pulseaudio/releases/${BP}.tar.xz \
            file://0001-meson-Check-for-__get_cpuid.patch \
            file://volatiles.04_pulse \
            file://0001-doxygen-meson.build-remove-dependency-on-doxygen-bin.patch \
+           file://0001-build-sys-meson-check-if-NEON-code-can-be-compiled-o.patch \
            "
 SRC_URI[md5sum] = "1efc916251910f1e9d4df7810e3e69f8"
 SRC_URI[sha256sum] = "75d3f7742c1ae449049a4c88900e454b8b350ecaa8c544f3488a2562a9ff66f1"
--
Quoted 5 lines

2.29.2

Successfully built pulseaudio for armv4 / collie. Thanks.