Skip to content

Commit f078675

Browse files
committed
libegt: Fix for cross-compile time detection of allocarray
kplot otherwise has runtime check for this, which fails when building for say x86, since build host is also x86 it is able to run the runtime testcode on build machine, but thats wrong, it should be either run using qemu or not run at all, here we use configure time check to detect reallocarray() Signed-off-by: Khem Raj <[email protected]>
1 parent fe665eb commit f078675

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
From 6f0aafeccb99b6c92a48ee1c775afdc0f16a1ce6 Mon Sep 17 00:00:00 2001
2+
From: Khem Raj <[email protected]>
3+
Date: Fri, 13 Dec 2019 08:46:39 -0800
4+
Subject: [PATCH] check for reallocarray before using it
5+
6+
in kplot there is a runtime check for reallocarray which actually wont
7+
work in cross compile mode, luckily it does check for HAVE_REALLOCARRAY
8+
before usng the results of runtime check. So here add a configure time
9+
check for presense of reallocarray
10+
11+
Fixes
12+
13+
TOPDIR/build/tmp/work/core2-32-yoe-linux/libegt/0.8-r0/recipe-sysroot/usr/include/stdlib.h:559:14: error: exception specification in declaration does not match previous declaration
14+
extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
15+
^
16+
../external/kplot/compat.h:24:7: note: previous declaration is here
17+
void *reallocarray(void *optr, size_t nmemb, size_t size);
18+
^
19+
20+
Upstream-Status: Submitted [https://github.com/linux4sam/egt/pull/2]
21+
Signed-off-by: Khem Raj <[email protected]>
22+
---
23+
configure.ac | 2 +-
24+
src/chart.cpp | 1 +
25+
2 files changed, 2 insertions(+), 1 deletion(-)
26+
27+
diff --git a/configure.ac b/configure.ac
28+
index 81410c78..65873d8b 100644
29+
--- a/configure.ac
30+
+++ b/configure.ac
31+
@@ -210,7 +210,7 @@ AC_TYPE_UINT8_T
32+
33+
# Checks for library functions.
34+
AC_FUNC_MMAP
35+
-AC_CHECK_FUNCS([floor memmove memset munmap select setlocale sqrt strerror])
36+
+AC_CHECK_FUNCS([floor memmove memset munmap reallocarray select setlocale sqrt strerror])
37+
38+
AX_PTHREAD([LIBS="$PTHREAD_LIBS $LIBS"
39+
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"], AC_MSG_ERROR(Can not find pthreads. This is required.))
40+
diff --git a/src/chart.cpp b/src/chart.cpp
41+
index 7578ea29..0faf65e8 100644
42+
--- a/src/chart.cpp
43+
+++ b/src/chart.cpp
44+
@@ -3,6 +3,7 @@
45+
*
46+
* SPDX-License-Identifier: Apache-2.0
47+
*/
48+
+#include "config.h"
49+
#include "compat.h"
50+
#include "egt/chart.h"
51+
#include "egt/detail/meta.h"
52+
--
53+
2.24.1
54+

recipes-graphics/libegt/libegt_0.8.bb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ DEPENDS_append_at91sam9 = " tslib"
2929

3030
SRC_URI = "gitsm://github.com/linux4sam/egt.git;protocol=https \
3131
file://0001-link-libudev-for-udev_unref-and-udev_new.patch \
32+
file://0001-check-for-reallocarray-before-using-it.patch \
3233
"
3334

3435
SRCREV = "be50eef497a0900cf90b60a2da4aad30ba0e3663"

0 commit comments

Comments
 (0)