* [Buildroot] [PATCH] lz4: fix host build with glibc older than 2.17
@ 2018-04-20 4:17 Baruch Siach
2018-04-20 6:40 ` Thomas Petazzoni
0 siblings, 1 reply; 2+ messages in thread
From: Baruch Siach @ 2018-04-20 4:17 UTC (permalink / raw)
To: buildroot
glibc before 2.17 require the -lrt linker option for clock_gettime(). We
do not support pre 2.17 glibc for the target anymore, but there are
still host platforms with these versions. Add upstream patch to skip use
of clock_gettime() with older glibc versions.
Should fix:
http://autobuild.buildroot.net/results/bc5/bc5d6447ab16a61d9dcf56723106f0b107826ef4/
http://autobuild.buildroot.net/results/7dd/7dd47bef902845a0f7803f1a6c702ec154855858/
http://autobuild.buildroot.net/results/952/9523dbc767dc325befabeb9240c4009e78779c7d/
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
...rictive-conditions-for-clock_gettime.patch | 58 +++++++++++++++++++
1 file changed, 58 insertions(+)
create mode 100644 package/lz4/0001-use-more-restrictive-conditions-for-clock_gettime.patch
diff --git a/package/lz4/0001-use-more-restrictive-conditions-for-clock_gettime.patch b/package/lz4/0001-use-more-restrictive-conditions-for-clock_gettime.patch
new file mode 100644
index 000000000000..678f16abb776
--- /dev/null
+++ b/package/lz4/0001-use-more-restrictive-conditions-for-clock_gettime.patch
@@ -0,0 +1,58 @@
+From 7dba09af47dd3daa1562a6332a643a1a59dba4a8 Mon Sep 17 00:00:00 2001
+From: Yann Collet <cyan@fb.com>
+Date: Tue, 16 Jan 2018 10:21:37 -0800
+Subject: [PATCH] use more restrictive conditions for clock_gettime()
+
+Signed-off-by: Baruch Siach <baruch@tkos.co.il>
+---
+Upstream status: commit 7dba09af47dd3
+
+ programs/util.h | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/programs/util.h b/programs/util.h
+index fc7f63e8140e..a3576d7e3a57 100644
+--- a/programs/util.h
++++ b/programs/util.h
+@@ -141,6 +141,7 @@ extern "C" {
+ * Time functions
+ ******************************************/
+ #if defined(_WIN32) /* Windows */
++
+ typedef LARGE_INTEGER UTIL_time_t;
+ UTIL_STATIC UTIL_time_t UTIL_getTime(void) { UTIL_time_t x; QueryPerformanceCounter(&x); return x; }
+ UTIL_STATIC U64 UTIL_getSpanTimeMicro(UTIL_time_t clockStart, UTIL_time_t clockEnd)
+@@ -165,7 +166,9 @@ extern "C" {
+ }
+ return 1000000000ULL*(clockEnd.QuadPart - clockStart.QuadPart)/ticksPerSecond.QuadPart;
+ }
++
+ #elif defined(__APPLE__) && defined(__MACH__)
++
+ #include <mach/mach_time.h>
+ typedef U64 UTIL_time_t;
+ UTIL_STATIC UTIL_time_t UTIL_getTime(void) { return mach_absolute_time(); }
+@@ -189,7 +192,9 @@ extern "C" {
+ }
+ return ((clockEnd - clockStart) * (U64)rate.numer) / ((U64)rate.denom);
+ }
+-#elif (PLATFORM_POSIX_VERSION >= 200112L)
++
++#elif (PLATFORM_POSIX_VERSION >= 200112L) && (defined __UCLIBC__ || ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 17) || __GLIBC__ > 2))
++
+ #include <time.h>
+ typedef struct timespec UTIL_time_t;
+ UTIL_STATIC UTIL_time_t UTIL_getTime(void)
+@@ -227,7 +232,9 @@ extern "C" {
+ nano += diff.tv_nsec;
+ return nano;
+ }
++
+ #else /* relies on standard C (note : clock_t measurements can be wrong when using multi-threading) */
++
+ typedef clock_t UTIL_time_t;
+ UTIL_STATIC UTIL_time_t UTIL_getTime(void) { return clock(); }
+ UTIL_STATIC U64 UTIL_getSpanTimeMicro(UTIL_time_t clockStart, UTIL_time_t clockEnd) { return 1000000ULL * (clockEnd - clockStart) / CLOCKS_PER_SEC; }
+--
+2.17.0
+
--
2.17.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Buildroot] [PATCH] lz4: fix host build with glibc older than 2.17
2018-04-20 4:17 [Buildroot] [PATCH] lz4: fix host build with glibc older than 2.17 Baruch Siach
@ 2018-04-20 6:40 ` Thomas Petazzoni
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni @ 2018-04-20 6:40 UTC (permalink / raw)
To: buildroot
Hello,
On Fri, 20 Apr 2018 07:17:20 +0300, Baruch Siach wrote:
> glibc before 2.17 require the -lrt linker option for clock_gettime(). We
> do not support pre 2.17 glibc for the target anymore, but there are
> still host platforms with these versions. Add upstream patch to skip use
> of clock_gettime() with older glibc versions.
>
> Should fix:
> http://autobuild.buildroot.net/results/bc5/bc5d6447ab16a61d9dcf56723106f0b107826ef4/
> http://autobuild.buildroot.net/results/7dd/7dd47bef902845a0f7803f1a6c702ec154855858/
> http://autobuild.buildroot.net/results/952/9523dbc767dc325befabeb9240c4009e78779c7d/
>
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> ---
> ...rictive-conditions-for-clock_gettime.patch | 58 +++++++++++++++++++
> 1 file changed, 58 insertions(+)
> create mode 100644 package/lz4/0001-use-more-restrictive-conditions-for-clock_gettime.patch
Applied to master, thanks.
Thomas
--
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-04-20 6:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-20 4:17 [Buildroot] [PATCH] lz4: fix host build with glibc older than 2.17 Baruch Siach
2018-04-20 6:40 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox