diff options
author | Khem Raj <raj.khem@gmail.com> | 2024-07-02 21:53:28 -0700 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2024-07-02 22:21:18 -0700 |
commit | 0ae8adcd63c27a6a4dbe46b6950d1607b2ef8abe (patch) | |
tree | 9bdfffb3daa5bfac9c6e01b257478e37d14ce9a7 /meta-multimedia | |
parent | 8c5860f22dbe860d1ff830b012d1341d1e135c0c (diff) | |
download | meta-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.patch | 79 | ||||
-rw-r--r-- | meta-multimedia/recipes-multimedia/flite/flite_2.2.bb | 3 |
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 @@ | |||
1 | From c71d844f5639ea447b9f795a4db5b5d43f0de814 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Tue, 2 Jul 2024 21:41:24 -0700 | ||
4 | Subject: [PATCH] Remove defining 'const' as nothing | ||
5 | |||
6 | This is a hack to override constness of struct members | ||
7 | however, with modern compiler like clang with fortified | ||
8 | glibc ( 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 | |||
28 | Therefore take this out, instead cast away the 'const' qualifier where needed ( equilly dangerous ) | ||
29 | however limited to just this file instead of apply to all headers including system headers | ||
30 | |||
31 | Upstream-Status: Submitted [https://github.com/festvox/flite/pull/112] | ||
32 | Signed-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 | |||
37 | diff --git a/tools/find_sts_main.c b/tools/find_sts_main.c | ||
38 | index 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 | |||
9 | DEPENDS += "alsa-lib chrpath-replacement-native" | 9 | DEPENDS += "alsa-lib chrpath-replacement-native" |
10 | 10 | ||
11 | SRC_URI = "git://github.com/festvox/flite.git;protocol=https;branch=master" | 11 | SRC_URI = "git://github.com/festvox/flite.git;protocol=https;branch=master" |
12 | SRC_URI += "file://0001-Remove-defining-const-as-nothing.patch" | ||
12 | 13 | ||
13 | SRCREV = "e9e2e37c329dbe98bfeb27a1828ef9a71fa84f88" | 14 | SRCREV = "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. |
27 | PARALLEL_MAKE = "" | 28 | PARALLEL_MAKE = "" |
29 | |||
30 | CLEANBROKEN = "1" | ||