diff options
author | Khem Raj <raj.khem@gmail.com> | 2017-07-13 22:40:02 -0700 |
---|---|---|
committer | Martin Jansa <Martin.Jansa@gmail.com> | 2017-07-24 18:57:34 +0200 |
commit | 68b6fbf28a368ec34c51c8e6a7003fb5c1083554 (patch) | |
tree | 10f11ce742cf4a37e91b42ecec1f906065e184c4 /meta-oe | |
parent | 4ff2e26dedff9caa14ffef57a7002b0fd021c17d (diff) | |
download | meta-openembedded-68b6fbf28a368ec34c51c8e6a7003fb5c1083554.tar.gz |
lmbench: Fix build with musl
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-oe')
3 files changed, 112 insertions, 1 deletions
diff --git a/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/0001-Check-for-musl-define-guard-before-redefining-sockle.patch b/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/0001-Check-for-musl-define-guard-before-redefining-sockle.patch new file mode 100644 index 000000000..20791bf23 --- /dev/null +++ b/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/0001-Check-for-musl-define-guard-before-redefining-sockle.patch | |||
@@ -0,0 +1,29 @@ | |||
1 | From 31d58ed7e6552781f415501e96d7cc74f83b910d Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Wed, 12 Jul 2017 18:08:51 -0700 | ||
4 | Subject: [PATCH 1/2] Check for musl define guard before redefining socklen_t | ||
5 | |||
6 | musl uses __DEFINED_socklen_t so check for that as well | ||
7 | along with HAVE_socklen_t | ||
8 | |||
9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
10 | --- | ||
11 | src/bench.h | 2 +- | ||
12 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
13 | |||
14 | diff --git a/src/bench.h b/src/bench.h | ||
15 | index 597d068..2ebdf5a 100644 | ||
16 | --- a/src/bench.h | ||
17 | +++ b/src/bench.h | ||
18 | @@ -77,7 +77,7 @@ typedef long long int64; | ||
19 | #endif /* HAVE_int64_t */ | ||
20 | #endif /* HAVE_int64 */ | ||
21 | |||
22 | -#ifndef HAVE_socklen_t | ||
23 | +#if !defined(HAVE_socklen_t) && !defined(__DEFINED_socklen_t) | ||
24 | typedef int socklen_t; | ||
25 | #endif | ||
26 | |||
27 | -- | ||
28 | 2.13.2 | ||
29 | |||
diff --git a/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/0002-build-Adjust-CFLAGS-LDFLAGS-to-append-values-passed-.patch b/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/0002-build-Adjust-CFLAGS-LDFLAGS-to-append-values-passed-.patch new file mode 100644 index 000000000..d5c8f5f2f --- /dev/null +++ b/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/0002-build-Adjust-CFLAGS-LDFLAGS-to-append-values-passed-.patch | |||
@@ -0,0 +1,76 @@ | |||
1 | From 76f3a9abc2ff96155425ef97d8c5520cfbc8fe6a Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Wed, 12 Jul 2017 18:09:46 -0700 | ||
4 | Subject: [PATCH 2/2] build: Adjust CFLAGS/LDFLAGS to append values passed from | ||
5 | env | ||
6 | |||
7 | For musl we have to pass additional arguments via cflags and ldflags | ||
8 | to link in librirpc, make room for those changes to take effect | ||
9 | |||
10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
11 | --- | ||
12 | scripts/build | 2 +- | ||
13 | src/Makefile | 14 +++++++------- | ||
14 | 2 files changed, 8 insertions(+), 8 deletions(-) | ||
15 | |||
16 | diff --git a/scripts/build b/scripts/build | ||
17 | index 34a1371..3786741 100755 | ||
18 | --- a/scripts/build | ||
19 | +++ b/scripts/build | ||
20 | @@ -18,7 +18,7 @@ done | ||
21 | |||
22 | trap 'rm -f ${BASE}$$.s ${BASE}$$.c ${BASE}$$.o ${BASE}$$; exit 1' 1 2 15 | ||
23 | |||
24 | -LDLIBS=-lm | ||
25 | +LDLIBS+=-lm | ||
26 | |||
27 | # check for HP-UX's ANSI compiler | ||
28 | echo "main(int ac, char *av[]) { int i; }" > ${BASE}$$.c | ||
29 | diff --git a/src/Makefile b/src/Makefile | ||
30 | index d9efd54..96467d7 100644 | ||
31 | --- a/src/Makefile | ||
32 | +++ b/src/Makefile | ||
33 | @@ -112,8 +112,8 @@ LIBOBJS= $O/lib_tcp.o $O/lib_udp.o $O/lib_unix.o $O/lib_timing.o \ | ||
34 | $O/lib_sched.o | ||
35 | |||
36 | lmbench: $(UTILS) | ||
37 | - @env CFLAGS=-O MAKE="$(MAKE)" MAKEFLAGS="$(MAKEFLAGS)" CC="$(CC)" OS="$(OS)" ../scripts/build all | ||
38 | - -@env CFLAGS=-O MAKE="$(MAKE)" MAKEFLAGS="k$(MAKEFLAGS)" CC="$(CC)" OS="$(OS)" ../scripts/build opt | ||
39 | + @env CFLAGS+=-O MAKE="$(MAKE)" MAKEFLAGS="$(MAKEFLAGS)" CC="$(CC)" OS="$(OS)" ../scripts/build all | ||
40 | + -@env CFLAGS+=-O MAKE="$(MAKE)" MAKEFLAGS="k$(MAKEFLAGS)" CC="$(CC)" OS="$(OS)" ../scripts/build opt | ||
41 | |||
42 | results: lmbench | ||
43 | @env OS="${OS}" ../scripts/config-run | ||
44 | @@ -137,7 +137,7 @@ os: lmbench | ||
45 | @env OS="${OS}" BENCHMARK_HARDWARE=NO BENCHMARK_OS=YES ../scripts/results | ||
46 | |||
47 | install: lmbench | ||
48 | - @env CFLAGS=-O MAKE="$(MAKE)" MAKEFLAGS="$(MAKEFLAGS)" CC="${CC}" OS="${OS}" ../scripts/build install-target | ||
49 | + @env CFLAGS+=-O MAKE="$(MAKE)" MAKEFLAGS="$(MAKEFLAGS)" CC="${CC}" OS="${OS}" ../scripts/build install-target | ||
50 | |||
51 | install-target: | ||
52 | if [ ! -d $(BASE) ]; then mkdir $(BASE); fi | ||
53 | @@ -155,16 +155,16 @@ all: $(EXES) $O/lmbench | ||
54 | opt: $(OPT_EXES) | ||
55 | asm: $(ASMS) | ||
56 | $(ASMS): | ||
57 | - $(CC) -S $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ `basename $@ .s`.c | ||
58 | + $(CC) -S $(CFLAGS) $(CPPFLAGS) -o $@ `basename $@ .s`.c $(LDFLAGS) | ||
59 | |||
60 | Wall: | ||
61 | - @env CFLAGS="-g -O -Wall" MAKE="$(MAKE)" MAKEFLAGS="$(MAKEFLAGS)" CC="${CC}" OS="${OS}" ../scripts/build all opt | ||
62 | + @env CFLAGS+="-g -O -Wall" MAKE="$(MAKE)" MAKEFLAGS="$(MAKEFLAGS)" CC="${CC}" OS="${OS}" ../scripts/build all opt | ||
63 | |||
64 | debug: | ||
65 | - @env CFLAGS="-g -O -DDEBUG" MAKE="$(MAKE)" MAKEFLAGS="$(MAKEFLAGS)" CC="${CC}" OS="${OS}" ../scripts/build all opt | ||
66 | + @env CFLAGS+="-g -O -DDEBUG" MAKE="$(MAKE)" MAKEFLAGS="$(MAKEFLAGS)" CC="${CC}" OS="${OS}" ../scripts/build all opt | ||
67 | |||
68 | assembler: | ||
69 | - @env CFLAGS=-O MAKE="$(MAKE)" MAKEFLAGS="$(MAKEFLAGS)" CC="${CC}" OS="${OS}" ../scripts/build asm | ||
70 | + @env CFLAGS+=-O MAKE="$(MAKE)" MAKEFLAGS="$(MAKEFLAGS)" CC="${CC}" OS="${OS}" ../scripts/build asm | ||
71 | |||
72 | |||
73 | tag: | ||
74 | -- | ||
75 | 2.13.2 | ||
76 | |||
diff --git a/meta-oe/recipes-benchmark/lmbench/lmbench_3.0-a9.bb b/meta-oe/recipes-benchmark/lmbench/lmbench_3.0-a9.bb index 43ac1d038..03b3721ca 100644 --- a/meta-oe/recipes-benchmark/lmbench/lmbench_3.0-a9.bb +++ b/meta-oe/recipes-benchmark/lmbench/lmbench_3.0-a9.bb | |||
@@ -7,6 +7,10 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=8ca43cbc842c2336e835926c2166c28b \ | |||
7 | 7 | ||
8 | inherit autotools-brokensep | 8 | inherit autotools-brokensep |
9 | 9 | ||
10 | DEPENDS_append_libc-musl = " libtirpc" | ||
11 | CFLAGS_append_libc-musl = " -I${STAGING_INCDIR}/tirpc" | ||
12 | LDLIBS_append_libc-musl = " -ltirpc " | ||
13 | |||
10 | PR = "r2" | 14 | PR = "r2" |
11 | 15 | ||
12 | SRC_URI = "${SOURCEFORGE_MIRROR}/lmbench/lmbench-${PV}.tgz \ | 16 | SRC_URI = "${SOURCEFORGE_MIRROR}/lmbench/lmbench-${PV}.tgz \ |
@@ -20,12 +24,14 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/lmbench/lmbench-${PV}.tgz \ | |||
20 | file://fix-lmbench-memory-check-failure.patch \ | 24 | file://fix-lmbench-memory-check-failure.patch \ |
21 | file://0001-avoid-gcc-optimize-away-the-loops.patch \ | 25 | file://0001-avoid-gcc-optimize-away-the-loops.patch \ |
22 | file://0001-lat_http.c-Add-printf-format.patch \ | 26 | file://0001-lat_http.c-Add-printf-format.patch \ |
27 | file://0001-Check-for-musl-define-guard-before-redefining-sockle.patch \ | ||
28 | file://0002-build-Adjust-CFLAGS-LDFLAGS-to-append-values-passed-.patch \ | ||
23 | " | 29 | " |
24 | SRC_URI[md5sum] = "b3351a3294db66a72e2864a199d37cbf" | 30 | SRC_URI[md5sum] = "b3351a3294db66a72e2864a199d37cbf" |
25 | SRC_URI[sha256sum] = "cbd5777d15f44eab7666dcac418054c3c09df99826961a397d9acf43d8a2a551" | 31 | SRC_URI[sha256sum] = "cbd5777d15f44eab7666dcac418054c3c09df99826961a397d9acf43d8a2a551" |
26 | 32 | ||
27 | EXTRA_OEMAKE = 'CC="${CC}" AR="${AR}" RANLIB="${RANLIB}" CFLAGS="${CFLAGS}" \ | 33 | EXTRA_OEMAKE = 'CC="${CC}" AR="${AR}" RANLIB="${RANLIB}" CFLAGS="${CFLAGS}" \ |
28 | LDFLAGS="${LDFLAGS}" LD="${LD}" OS="${TARGET_SYS}" \ | 34 | LDFLAGS="${LDFLAGS}" LDLIBS="${LDLIBS}" LD="${LD}" OS="${TARGET_SYS}" \ |
29 | TARGET="${TARGET_OS}" BASE="${prefix}" MANDIR="${mandir}"' | 35 | TARGET="${TARGET_OS}" BASE="${prefix}" MANDIR="${mandir}"' |
30 | 36 | ||
31 | do_configure() { | 37 | do_configure() { |