summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChen Qi <Qi.Chen@windriver.com>2023-06-19 12:35:55 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-06-21 18:38:25 +0100
commitd544cbf1d5029b4f52fddba78ae74de8e6bbf88e (patch)
tree0b1315dba106b8068aa72354f0d8e45222130be8
parenta3d3db655f3454b53afb806dd9520352cd24a8ca (diff)
downloadpoky-d544cbf1d5029b4f52fddba78ae74de8e6bbf88e.tar.gz
unzip: fix configure check for cross compilation
The original configure runs a generated binary to determine features. This is not correct for cross compilation. So change the runtime tests into compile-time tests to fix the issue. (From OE-Core rev: b9aca339b59238988c48b90ea5019bfc939ba4b3) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-extended/unzip/unzip/0001-unix-configure-fix-detection-for-cross-compilation.patch103
-rw-r--r--meta/recipes-extended/unzip/unzip_6.0.bb1
2 files changed, 104 insertions, 0 deletions
diff --git a/meta/recipes-extended/unzip/unzip/0001-unix-configure-fix-detection-for-cross-compilation.patch b/meta/recipes-extended/unzip/unzip/0001-unix-configure-fix-detection-for-cross-compilation.patch
new file mode 100644
index 0000000000..2fa7f481b7
--- /dev/null
+++ b/meta/recipes-extended/unzip/unzip/0001-unix-configure-fix-detection-for-cross-compilation.patch
@@ -0,0 +1,103 @@
1From 5cbf901b5c3b6a7d1d0ed91b6df4194bb6d25a40 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Thu, 15 Jun 2023 07:14:17 -0700
4Subject: [PATCH] unix/configure: fix detection for cross compilation
5
6We're doing cross compilation, running a cross-compiled problem
7on host to detemine feature is not correct. So we change runtime
8check into compile-time check to detect the features.
9
10Upstream-Status: Inactive-Upstream
11
12Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
13---
14 unix/configure | 44 +++++++++++++++-----------------------------
15 1 file changed, 15 insertions(+), 29 deletions(-)
16
17diff --git a/unix/configure b/unix/configure
18index 8fd82dd..68dee98 100755
19--- a/unix/configure
20+++ b/unix/configure
21@@ -259,6 +259,10 @@ cat > conftest.c << _EOF_
22 #include <sys/stat.h>
23 #include <unistd.h>
24 #include <stdio.h>
25+
26+_Static_assert(sizeof(off_t) < 8, "sizeof off_t < 8 failed");
27+_Static_assert(sizeof((struct stat){0}.st_size) < 8, "sizeof st_size < 8 failed");
28+
29 int main()
30 {
31 off_t offset;
32@@ -278,21 +282,10 @@ _EOF_
33 # compile it
34 $CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
35 if [ $? -ne 0 ]; then
36- echo -- no Large File Support
37+ echo -- yes we have Large File Support!
38+ CFLAGSR="${CFLAGSR} -DLARGE_FILE_SUPPORT"
39 else
40-# run it
41- ./conftest
42- r=$?
43- if [ $r -eq 1 ]; then
44- echo -- no Large File Support - no 64-bit off_t
45- elif [ $r -eq 2 ]; then
46- echo -- no Large File Support - no 64-bit stat
47- elif [ $r -eq 3 ]; then
48- echo -- yes we have Large File Support!
49- CFLAGSR="${CFLAGSR} -DLARGE_FILE_SUPPORT"
50- else
51- echo -- no Large File Support - conftest returned $r
52- fi
53+ echo -- no Large File Support
54 fi
55
56 # Added 11/24/2005 EG
57@@ -302,6 +295,11 @@ cat > conftest.c << _EOF_
58 #include <stdlib.h>
59 #include <stdio.h>
60 #include <wchar.h>
61+
62+#ifndef __STDC_ISO_10646__
63+#error "__STDC_ISO_10646__ not defined
64+#endif
65+
66 int main()
67 {
68 size_t wsize;
69@@ -327,19 +325,8 @@ if [ $? -ne 0 ]; then
70 echo "-- no Unicode (wchar_t) support"
71 else
72 # have wide char support
73-# run it
74- ./conftest
75- r=$?
76- if [ $r -eq 0 ]; then
77- echo -- no Unicode wchar_t support - wchar_t allocation error
78- elif [ $r -eq 1 ]; then
79- echo -- no Unicode support - wchar_t encoding unspecified
80- elif [ $r -eq 2 ]; then
81- echo -- have wchar_t with known UCS encoding - enabling Unicode support!
82- CFLAGSR="${CFLAGSR} -DUNICODE_SUPPORT -DUNICODE_WCHAR"
83- else
84- echo "-- no Unicode (wchar_t) support - conftest returned $r"
85- fi
86+ echo -- have wchar_t with known UCS encoding - enabling Unicode support!
87+ CFLAGSR="${CFLAGSR} -DUNICODE_SUPPORT -DUNICODE_WCHAR"
88 fi
89
90 echo "Check for setlocale support (needed for UNICODE Native check)"
91@@ -418,8 +405,7 @@ temp_link="link_$$"
92 echo "int main() { lchmod(\"${temp_file}\", 0666); }" \
93 ) > conftest.c
94 ln -s "${temp_link}" "${temp_file}" && \
95- $CC $BFLAG $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null && \
96- ./conftest
97+ $CC -Werror=implicit-function-declaration $BFLAG $LDFLAGS -o conftest conftest.c >/dev/null
98 [ $? -ne 0 ] && CFLAGSR="${CFLAGSR} -DNO_LCHMOD"
99 rm -f "${temp_file}"
100
101--
1022.34.1
103
diff --git a/meta/recipes-extended/unzip/unzip_6.0.bb b/meta/recipes-extended/unzip/unzip_6.0.bb
index a4d10c30aa..391e5cd22a 100644
--- a/meta/recipes-extended/unzip/unzip_6.0.bb
+++ b/meta/recipes-extended/unzip/unzip_6.0.bb
@@ -32,6 +32,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/infozip/UnZip%206.x%20%28latest%29/UnZip%206.0/
32 file://CVE-2022-0529.patch \ 32 file://CVE-2022-0529.patch \
33 file://CVE-2022-0530.patch \ 33 file://CVE-2022-0530.patch \
34 file://0001-configure-Add-correct-system-headers-and-prototypes-.patch \ 34 file://0001-configure-Add-correct-system-headers-and-prototypes-.patch \
35 file://0001-unix-configure-fix-detection-for-cross-compilation.patch \
35" 36"
36UPSTREAM_VERSION_UNKNOWN = "1" 37UPSTREAM_VERSION_UNKNOWN = "1"
37 38