Skip to contentSkip to conversation

package/aubio: fix build on big endian arch

PATCH Applied Thomas Perale via buildroot 2 participants 3 messages Sep 22, 2024 – Oct 19, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/aubio: fix build on big endian arch

Fixes the following error happening on builds with big endian architecture target and libflac enabled.

```
[ 75/243] Linking build/tests/test-pitchshift
/home/autobuild/autobuild/instance-16/output-1/per-package/aubio/host/bin/../lib/gcc/mips64-buildroot-linux-gnu/13.3.0/../../../../mips64-buildroot-linux-gnu/bin/ld: src/libaubio.so: undefined reference to `SWAPS'
collect2: error: ld returned 1 exit status

Waf: Leaving directory `/home/autobuild/autobuild/instance-16/output-1/build/aubio-152d6819b360c2e7b379ee3f373d444ab3df0895/build'
Build failed
```

There is a missing definition of the SWAPS macro in /src/io/sink_flac.c file.
This patch adds an out of tree patch that copy the SWAPS definition from the /src/io/sink_wavwrite.c file in sink_flac.c to fix this issue.

Fixes:
- https://autobuild.buildroot.org/results/b88/b8895a81411dc7622b0aba9f2f0eaa0aef5a1a10/
- https://autobuild.buildroot.org/results/bc7/bc733f5192b354cb960b6a4726efb597be4bb06c/
- https://autobuild.buildroot.org/results/ea5/ea52dbcc14c2bab300277053f0b9599a8e82294a/
- ...

---
 ...1-sink_flac-missing-SWAPS-definition.patch | 45 +++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 package/aubio/0001-sink_flac-missing-SWAPS-definition.patch
package/aubio/0001-sink_flac-missing-SWAPS-definition.patch new file +45 -0
new file mode 100644
index 0000000000..5f321b5363
@@ -0,0 +1,45 @@
+From aebf4fb23df2c4ec8857aef05a468991054a58c1 Mon Sep 17 00:00:00 2001
+From: Thomas Perale <[email protected]>
+Date: Thu, 19 Sep 2024 18:57:16 +0200
+Subject: [PATCH] [sink_flac] missing SWAPS definition
+
+On big endian architecture with libflac enabled the following error
+would happen when cross-compiling aubio with buildroot.
+
+```
+[ 75/243] Linking build/tests/test-pitchshift
+/home/autobuild/autobuild/instance-16/output-1/per-package/aubio/host/bin/../lib/gcc/mips64-buildroot-linux-gnu/13.3.0/../../../../mips64-buildroot-linux-gnu/bin/ld: src/libaubio.so: undefined reference to `SWAPS'
+collect2: error: ld returned 1 exit status
+
+Waf: Leaving directory `/home/autobuild/autobuild/instance-16/output-1/build/aubio-152d6819b360c2e7b379ee3f373d444ab3df0895/build'
+Build failed
+```
+
+Indeed there is a missing definition of the `SWAPS` macro in
+`/src/io/sink_flac.c` file.
+This commit copy the `SWAPS` definition from the
+`/src/io/sink_wavwrite.c` file in `sink_flac.c` to fix this issue.
+
+Signed-off-by: Thomas Perale <[email protected]>
+Upstream: https://github.com/aubio/aubio/pull/407
+---
+ src/io/sink_flac.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/io/sink_flac.c b/src/io/sink_flac.c
+index 04144793..0a1cbc26 100644
+--- a/src/io/sink_flac.c
++++ b/src/io/sink_flac.c
+@@ -36,6 +36,9 @@
+ 
+ #define MAX_WRITE_SIZE 4096
+ 
++// swap endian of a short
++#define SWAPS(x) ((x & 0xff) << 8) | ((x & 0xff00) >> 8)
++
+ // swap host to little endian
+ #if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
+ #define HTOLES(x) SWAPS(x)
+-- 
+2.46.0
+
Signature · 6 lines
2.46.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 23 lines · On Sun, 22 Sep 2024 17:05:54 +0200 Thomas Perale via buildroot…

Fixes the following error happening on builds with big endian architecture target and libflac enabled.

```
[ 75/243] Linking build/tests/test-pitchshift
/home/autobuild/autobuild/instance-16/output-1/per-package/aubio/host/bin/../lib/gcc/mips64-buildroot-linux-gnu/13.3.0/../../../../mips64-buildroot-linux-gnu/bin/ld: src/libaubio.so: undefined reference to `SWAPS'
collect2: error: ld returned 1 exit status

Waf: Leaving directory `/home/autobuild/autobuild/instance-16/output-1/build/aubio-152d6819b360c2e7b379ee3f373d444ab3df0895/build'
Build failed
```

There is a missing definition of the SWAPS macro in /src/io/sink_flac.c file.
This patch adds an out of tree patch that copy the SWAPS definition from the /src/io/sink_wavwrite.c file in sink_flac.c to fix this issue.

Fixes:
- https://autobuild.buildroot.org/results/b88/b8895a81411dc7622b0aba9f2f0eaa0aef5a1a10/
- https://autobuild.buildroot.org/results/bc7/bc733f5192b354cb960b6a4726efb597be4bb06c/
- https://autobuild.buildroot.org/results/ea5/ea52dbcc14c2bab300277053f0b9599a8e82294a/
- ...

Quoted 5 lines
---
 ...1-sink_flac-missing-SWAPS-definition.patch | 45 +++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 package/aubio/0001-sink_flac-missing-SWAPS-definition.patch

Applied to master, thanks.

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
In reply to Thomas Perale via buildroot
Quoted 19 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Perale via buildroot <[email protected]> writes:

Fixes the following error happening on builds with big endian architecture target and libflac enabled.

```
[ 75/243] Linking build/tests/test-pitchshift
/home/autobuild/autobuild/instance-16/output-1/per-package/aubio/host/bin/../lib/gcc/mips64-buildroot-linux-gnu/13.3.0/../../../../mips64-buildroot-linux-gnu/bin/ld: src/libaubio.so: undefined reference to `SWAPS'
collect2: error: ld returned 1 exit status

Waf: Leaving directory `/home/autobuild/autobuild/instance-16/output-1/build/aubio-152d6819b360c2e7b379ee3f373d444ab3df0895/build'
Build failed
```

There is a missing definition of the SWAPS macro in /src/io/sink_flac.c file.
This patch adds an out of tree patch that copy the SWAPS definition from the /src/io/sink_wavwrite.c file in sink_flac.c to fix this issue.

Quoted 7 lines

Fixes:
- https://autobuild.buildroot.org/results/b88/b8895a81411dc7622b0aba9f2f0eaa0aef5a1a10/
- https://autobuild.buildroot.org/results/bc7/bc733f5192b354cb960b6a4726efb597be4bb06c/
- https://autobuild.buildroot.org/results/ea5/ea52dbcc14c2bab300277053f0b9599a8e82294a/
- ...

Committed to 2024.08.x, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot