Skip to content

Commit

Permalink
libegt: Fix for cross-compile time detection of allocarray
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
kraj committed Dec 13, 2019
1 parent fe665eb commit f078675
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
From 6f0aafeccb99b6c92a48ee1c775afdc0f16a1ce6 Mon Sep 17 00:00:00 2001
From: Khem Raj <[email protected]>
Date: Fri, 13 Dec 2019 08:46:39 -0800
Subject: [PATCH] check for reallocarray before using it

in kplot there is a runtime check for reallocarray which actually wont
work in cross compile mode, luckily it does check for HAVE_REALLOCARRAY
before usng the results of runtime check. So here add a configure time
check for presense of reallocarray

Fixes

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
extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
^
../external/kplot/compat.h:24:7: note: previous declaration is here
void *reallocarray(void *optr, size_t nmemb, size_t size);
^

Upstream-Status: Submitted [https://github.com/linux4sam/egt/pull/2]
Signed-off-by: Khem Raj <[email protected]>
---
configure.ac | 2 +-
src/chart.cpp | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 81410c78..65873d8b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -210,7 +210,7 @@ AC_TYPE_UINT8_T

# Checks for library functions.
AC_FUNC_MMAP
-AC_CHECK_FUNCS([floor memmove memset munmap select setlocale sqrt strerror])
+AC_CHECK_FUNCS([floor memmove memset munmap reallocarray select setlocale sqrt strerror])

AX_PTHREAD([LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"], AC_MSG_ERROR(Can not find pthreads. This is required.))
diff --git a/src/chart.cpp b/src/chart.cpp
index 7578ea29..0faf65e8 100644
--- a/src/chart.cpp
+++ b/src/chart.cpp
@@ -3,6 +3,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
+#include "config.h"
#include "compat.h"
#include "egt/chart.h"
#include "egt/detail/meta.h"
--
2.24.1

1 change: 1 addition & 0 deletions recipes-graphics/libegt/libegt_0.8.bb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ DEPENDS_append_at91sam9 = " tslib"

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

SRCREV = "be50eef497a0900cf90b60a2da4aad30ba0e3663"
Expand Down

0 comments on commit f078675

Please sign in to comment.