summaryrefslogtreecommitdiffstats
path: root/meta-multimedia
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2024-07-02 21:53:28 -0700
committerKhem Raj <raj.khem@gmail.com>2024-07-02 22:21:18 -0700
commit0ae8adcd63c27a6a4dbe46b6950d1607b2ef8abe (patch)
tree9bdfffb3daa5bfac9c6e01b257478e37d14ce9a7 /meta-multimedia
parent8c5860f22dbe860d1ff830b012d1341d1e135c0c (diff)
downloadmeta-openembedded-0ae8adcd63c27a6a4dbe46b6950d1607b2ef8abe.tar.gz
flite: Fix buld with clang fortify enabled distros
This issue shows up with upcoming glibc-2.40+ where clang fortify support has been enhanced significantly. Set CLEANBROKEN since it does not recover from a dirty tree Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-multimedia')
-rw-r--r--meta-multimedia/recipes-multimedia/flite/flite/0001-Remove-defining-const-as-nothing.patch79
-rw-r--r--meta-multimedia/recipes-multimedia/flite/flite_2.2.bb3
2 files changed, 82 insertions, 0 deletions
diff --git a/meta-multimedia/recipes-multimedia/flite/flite/0001-Remove-defining-const-as-nothing.patch b/meta-multimedia/recipes-multimedia/flite/flite/0001-Remove-defining-const-as-nothing.patch
new file mode 100644
index 000000000..899ef2663
--- /dev/null
+++ b/meta-multimedia/recipes-multimedia/flite/flite/0001-Remove-defining-const-as-nothing.patch
@@ -0,0 +1,79 @@
1From c71d844f5639ea447b9f795a4db5b5d43f0de814 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 2 Jul 2024 21:41:24 -0700
4Subject: [PATCH] Remove defining 'const' as nothing
5
6This is a hack to override constness of struct members
7however, with modern compiler like clang with fortified
8glibc ( 2.40+ ) headers this runs into compiler errors
9
10| /mnt/b/yoe/master/build/tmp/work/riscv64-yoe-linux/flite/2.2/recipe-sysroot/usr/include/bits/stdlib.h:38:54: error: pass_object_size attribute only applies to constant pointer arguments
11| 38 | __fortify_clang_overload_arg (char *, __restrict, __resolved)))
12| | ^
13| /mnt/b/yoe/master/build/tmp/work/riscv64-yoe-linux/flite/2.2/recipe-sysroot/usr/include/bits/stdlib.h:73:43: error: pass_object_size attribute only applies to constant pointer arguments
14| 73 | __fortify_clang_overload_arg (char *, ,__buf),
15| | ^
16| /mnt/b/yoe/master/build/tmp/work/riscv64-yoe-linux/flite/2.2/recipe-sysroot/usr/include/bits/stdlib.h:91:55: error: pass_object_size attribute only applies to constant pointer arguments
17| 91 | __NTH (wctomb (__fortify_clang_overload_arg (char *, ,__s), wchar_t __wchar))
18| | ^
19| /mnt/b/yoe/master/build/tmp/work/riscv64-yoe-linux/flite/2.2/recipe-sysroot/usr/include/bits/stdlib.h:129:71: error: pass_object_size attribute only applies to constant pointer arguments
20| 129 | __NTH (mbstowcs (__fortify_clang_overload_arg (wchar_t *, __restrict, __dst),
21| | ^
22| /mnt/b/yoe/master/build/tmp/work/riscv64-yoe-linux/flite/2.2/recipe-sysroot/usr/include/bits/stdlib.h:159:68: error: pass_object_size attribute only applies to constant pointer arguments
23| 159 | __NTH (wcstombs (__fortify_clang_overload_arg (char *, __restrict, __dst),
24| | ^
25| 5 errors generated.
26|
27
28Therefore take this out, instead cast away the 'const' qualifier where needed ( equilly dangerous )
29however limited to just this file instead of apply to all headers including system headers
30
31Upstream-Status: Submitted [https://github.com/festvox/flite/pull/112]
32Signed-off-by: Khem Raj <raj.khem@gmail.com>
33---
34 tools/find_sts_main.c | 11 ++++-------
35 1 file changed, 4 insertions(+), 7 deletions(-)
36
37diff --git a/tools/find_sts_main.c b/tools/find_sts_main.c
38index 3c94449..a5bf8ef 100644
39--- a/tools/find_sts_main.c
40+++ b/tools/find_sts_main.c
41@@ -41,9 +41,6 @@
42 #include <math.h>
43 #include <string.h>
44
45-/* To allow some normally const fields to manipulated during building */
46-#define const
47-
48 #include "cst_args.h"
49 #include "cst_wave.h"
50 #include "cst_track.h"
51@@ -132,16 +129,16 @@ cst_sts *find_sts(cst_wave *sig, cst_track *lpc)
52 lpc->frames[i],lpc->num_channels,
53 resd,
54 size);
55- sts[i].size = size;
56+ *(int *)(&sts[i].size) = size;
57 sts[i].frame = cst_alloc(unsigned short,lpc->num_channels-1);
58 for (j=1; j < lpc->num_channels; j++)
59- sts[i].frame[j-1] = (unsigned short)
60+ *(unsigned short *)(&sts[i].frame[j-1]) = (unsigned short)
61 (((lpc->frames[i][j]-lpc_min)/lpc_range)*65535);
62 if (cst_streq(residual_codec,"ulaw"))
63 {
64 sts[i].residual = cst_alloc(unsigned char,size);
65 for (j=0; j < size; j++)
66- sts[i].residual[j] = cst_short_to_ulaw((short)resd[j]);
67+ *(unsigned char *)(&sts[i].residual[j]) = cst_short_to_ulaw((short)resd[j]);
68 }
69 else if (cst_streq(residual_codec,"g721"))
70 {
71@@ -189,7 +186,7 @@ cst_sts *find_sts(cst_wave *sig, cst_track *lpc)
72 {
73 sts[i].residual = cst_alloc(unsigned char,size);
74 for (j=0; j < size; j++)
75- sts[i].residual[j] = cst_short_to_ulaw((short)resd[j]);
76+ *(unsigned char *)(&sts[i].residual[j]) = cst_short_to_ulaw((short)resd[j]);
77 }
78 else /* Unvoiced frame */
79 {
diff --git a/meta-multimedia/recipes-multimedia/flite/flite_2.2.bb b/meta-multimedia/recipes-multimedia/flite/flite_2.2.bb
index 0a7680a8c..bb9edfd5b 100644
--- a/meta-multimedia/recipes-multimedia/flite/flite_2.2.bb
+++ b/meta-multimedia/recipes-multimedia/flite/flite_2.2.bb
@@ -9,6 +9,7 @@ inherit autotools-brokensep
9DEPENDS += "alsa-lib chrpath-replacement-native" 9DEPENDS += "alsa-lib chrpath-replacement-native"
10 10
11SRC_URI = "git://github.com/festvox/flite.git;protocol=https;branch=master" 11SRC_URI = "git://github.com/festvox/flite.git;protocol=https;branch=master"
12SRC_URI += "file://0001-Remove-defining-const-as-nothing.patch"
12 13
13SRCREV = "e9e2e37c329dbe98bfeb27a1828ef9a71fa84f88" 14SRCREV = "e9e2e37c329dbe98bfeb27a1828ef9a71fa84f88"
14 15
@@ -25,3 +26,5 @@ do_install:append() {
25} 26}
26# | make[1]: *** No rule to make target 'flite_voice_list.c', needed by 'all'. Stop. 27# | make[1]: *** No rule to make target 'flite_voice_list.c', needed by 'all'. Stop.
27PARALLEL_MAKE = "" 28PARALLEL_MAKE = ""
29
30CLEANBROKEN = "1"