summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools
diff options
context:
space:
mode:
authorAndré Draszik <adraszik@tycoint.com>2016-06-24 11:54:29 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-07-01 16:22:44 +0100
commitd81b9185a19eab6b9627f460c1576cd445d63e93 (patch)
tree0582819d15be57e1135d5131e3108f86067a8218 /meta/recipes-devtools
parent15c3c3e54c9c0203565343a5b9a8ef46ae0f6ed2 (diff)
downloadpoky-d81b9185a19eab6b9627f460c1576cd445d63e93.tar.gz
json-c: backport patch to fix uClibc link issues
We need to link against libm as we get linker errors otherwise: <sysroot>/usr/lib/libjson-c.so.2: undefined reference to `__isnan' <sysroot>/usr/lib/libjson-c.so.2: undefined reference to `__isinf' collect2: error: ld returned 1 exit status Backport the upstream patch. (From OE-Core rev: 964456b0a2b9404ea54d6905a418ecf52b522bca) Signed-off-by: André Draszik <adraszik@tycoint.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r--meta/recipes-devtools/json-c/json-c/0001-Link-against-libm-when-needed.patch53
-rw-r--r--meta/recipes-devtools/json-c/json-c_0.12.bb1
2 files changed, 54 insertions, 0 deletions
diff --git a/meta/recipes-devtools/json-c/json-c/0001-Link-against-libm-when-needed.patch b/meta/recipes-devtools/json-c/json-c/0001-Link-against-libm-when-needed.patch
new file mode 100644
index 0000000000..bfe9d72313
--- /dev/null
+++ b/meta/recipes-devtools/json-c/json-c/0001-Link-against-libm-when-needed.patch
@@ -0,0 +1,53 @@
1From 93582ad85ef48c18ac12f00a9a9e124989b1fcab Mon Sep 17 00:00:00 2001
2From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3Date: Fri, 1 May 2015 12:52:18 +0200
4Subject: [PATCH] Link against libm when needed
5
6In certain C libraries (e.g uClibc), isnan() and related functions are
7implemented in libm, so json-c needs to link against it. This commit
8therefore adds an AC_TRY_LINK() test to check whether a program
9calling isnan() can be properly linked with no special flags. If not,
10we assume linking against libm is needed.
11
12The json-c.pc.in file is also adjusted so that in the case of static
13linking against json-c, -lm is also used.
14
15Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
16---
17Upstream-Status: Backport
18
19 configure.ac | 4 ++++
20 json-c.pc.in | 3 ++-
21 2 files changed, 6 insertions(+), 1 deletion(-)
22
23diff --git a/configure.ac b/configure.ac
24index c50f81b..30e7174 100644
25--- a/configure.ac
26+++ b/configure.ac
27@@ -50,6 +50,10 @@ AC_CHECK_DECLS([isinf], [], [], [[#include <math.h>]])
28 AC_CHECK_DECLS([_isnan], [], [], [[#include <float.h>]])
29 AC_CHECK_DECLS([_finite], [], [], [[#include <float.h>]])
30
31+if test "$ac_cv_have_decl_isnan" = "yes" ; then
32+ AC_TRY_LINK([#include <math.h>], [float f = 0.0; return isnan(f)], [], [LIBS="$LIBS -lm"])
33+fi
34+
35 #check if .section.gnu.warning accepts long strings (for __warn_references)
36 AC_LANG_PUSH([C])
37
38diff --git a/json-c.pc.in b/json-c.pc.in
39index 037739d..05bfbc8 100644
40--- a/json-c.pc.in
41+++ b/json-c.pc.in
42@@ -6,6 +6,7 @@ includedir=@includedir@
43 Name: json-c
44 Description: JSON implementation in C
45 Version: @VERSION@
46-Requires:
47+Requires:
48+Libs.private: @LIBS@
49 Libs: -L${libdir} -ljson-c
50 Cflags: -I${includedir}/json-c
51--
522.8.1
53
diff --git a/meta/recipes-devtools/json-c/json-c_0.12.bb b/meta/recipes-devtools/json-c/json-c_0.12.bb
index 1a5c3948e1..d8c76dbf18 100644
--- a/meta/recipes-devtools/json-c/json-c_0.12.bb
+++ b/meta/recipes-devtools/json-c/json-c_0.12.bb
@@ -6,6 +6,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=de54b60fbbc35123ba193fea8ee216f2"
6 6
7SRC_URI = "https://s3.amazonaws.com/json-c_releases/releases/${BP}.tar.gz \ 7SRC_URI = "https://s3.amazonaws.com/json-c_releases/releases/${BP}.tar.gz \
8 file://0001-json_tokener-requires-INF-and-NAN.patch \ 8 file://0001-json_tokener-requires-INF-and-NAN.patch \
9 file://0001-Link-against-libm-when-needed.patch \
9 " 10 "
10 11
11SRC_URI[md5sum] = "3ca4bbb881dfc4017e8021b5e0a8c491" 12SRC_URI[md5sum] = "3ca4bbb881dfc4017e8021b5e0a8c491"