civetweb: Fix paths to librt and libm, use -l linker option

Fixes build where it pokes for libraries on host system

Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Khem Raj
2018-06-24 00:10:11 -07:00
parent dddf4bdd3b
commit badb14da16
3 changed files with 45 additions and 47 deletions
@@ -1,42 +0,0 @@
From cd93e2c538cecb3192fd24c0fbd6e834d0c47eec Mon Sep 17 00:00:00 2001
From: Krzysztof Kozlowski <krzk@kernel.org>
Date: Wed, 18 Apr 2018 14:11:52 +0200
Subject: [PATCH] Unittest: Fix missing librt and libm during native compilation
civetweb looks for librt and libm in weird places and for native build
this fails:
| ../third_party/lib/libcheck.a(check.c.o): In function `tcase_create':
| build/tmp/work/x86_64-linux/civetweb-native/1.10-r0/build/third_party/src/check-unit-test-framework/src/check.c:145: undefined reference to `floor'
| build/tmp/work/x86_64-linux/civetweb-native/1.10-r0/build/third_party/src/check-unit-test-framework/src/check.c:148: undefined reference to `floor'
These are needed dependencies so try regular system linkage in such
case.
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
unittest/CMakeLists.txt | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/unittest/CMakeLists.txt b/unittest/CMakeLists.txt
index f34b2e0e4ce4..05d25702178c 100644
--- a/unittest/CMakeLists.txt
+++ b/unittest/CMakeLists.txt
@@ -60,10 +60,14 @@ endif()
find_package(LibM)
if (LIBM_FOUND)
set(CHECK_LIBRARIES "${CHECK_LIBRARIES};LIBM::LIBM")
+else()
+ set(CHECK_LIBRARIES "${CHECK_LIBRARIES};-lm")
endif()
find_package(LibRt)
if (LIBRT_FOUND)
set(CHECK_LIBRARIES "${CHECK_LIBRARIES};LIBRT::LIBRT")
+else()
+ set(CHECK_LIBRARIES "${CHECK_LIBRARIES};-lrt")
endif()
# Build the C unit tests
--
2.7.4
@@ -0,0 +1,40 @@
From 21e9a4bb214648ffd43c66b535fbf096bfcc9f4f Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sun, 24 Jun 2018 00:04:37 -0700
Subject: [PATCH] Unittest: Link librt and libm using -l option
cmake'ry forces full path to .so files when found using
find_package and since we have proper sysrooted toolchain
-lm and -lrt is all we need
Upstream-Status: Inappropriate [Cross compile specific]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
unittest/CMakeLists.txt | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/unittest/CMakeLists.txt b/unittest/CMakeLists.txt
index c4cdf229..e1b63caf 100644
--- a/unittest/CMakeLists.txt
+++ b/unittest/CMakeLists.txt
@@ -57,14 +57,8 @@ elseif (WIN32)
else()
set(CHECK_LIBRARIES "${CHECK_INSTALL_DIR}/lib/libcheck.a")
endif()
-find_package(LibM)
-if (LIBM_FOUND)
- set(CHECK_LIBRARIES "${CHECK_LIBRARIES};LIBM::LIBM")
-endif()
-find_package(LibRt)
-if (LIBRT_FOUND)
- set(CHECK_LIBRARIES "${CHECK_LIBRARIES};LIBRT::LIBRT")
-endif()
+set(CHECK_LIBRARIES "${CHECK_LIBRARIES};-lm")
+set(CHECK_LIBRARIES "${CHECK_LIBRARIES};-lrt")
# Build the C unit tests
add_library(shared-c-unit-tests STATIC shared.c)
--
2.18.0
@@ -4,12 +4,12 @@ HOMEPAGE = "https://github.com/civetweb/civetweb"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE.md;md5=6f28fdcba0dda735eed62bac6a397562"
SRCREV = "b8148afe8fa44c64f75e69655c4fdc9095565568"
SRCREV = "19f31ba8dd8443e86c7028a4b4c37f4b299aa68c"
PV = "1.10+git${SRCPV}"
SRC_URI = "git://github.com/civetweb/civetweb.git"
SRC_URI_append_class-native = " \
file://0001-Test-Fix-missing-librt-and-libm-during-native-compil.patch \
"
SRC_URI = "git://github.com/civetweb/civetweb.git \
file://0001-Unittest-Link-librt-and-libm-using-l-option.patch \
"
S = "${WORKDIR}/git"
# civetweb supports building with make or cmake (although cmake lacks few features)