Project

General

Profile

Actions

Bug #3127

closed

src/algo_xxhash.h: build failure with toolchain using uClibc

Added by aeolio over 2 years ago. Updated over 2 years ago.

Status:
Fixed
Priority:
Normal
Category:
build_cmake
Target version:
ASK QUESTIONS IN Forums:
No

Description

In file included from ../src/algo_xxhash.c:48:
../src/algo_xxhash.h: In function ‘XXH32_canonicalFromHash’:
../src/algo_xxhash.h:1566:54: warning: implicit declaration of function ‘static_assert’ [-Wimplicit-function-declaration]
 1566 | #    define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); } while(0)
      |                                                      ^~~~~~~~~~~~~
../src/algo_xxhash.h:1572:32: note: in expansion of macro ‘XXH_STATIC_ASSERT_WITH_MESSAGE’
 1572 | #  define XXH_STATIC_ASSERT(c) XXH_STATIC_ASSERT_WITH_MESSAGE((c),#c)
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/algo_xxhash.h:2282:5: note: in expansion of macro ‘XXH_STATIC_ASSERT’
 2282 |     XXH_STATIC_ASSERT(sizeof(XXH32_canonical_t) == sizeof(XXH32_hash_t));
      |     ^~~~~~~~~~~~~~~~~

... and later:
../src/algo_xxhash.h:2282: undefined reference to `static_assert'

uClibc does not have this macro definition. Adding a definition in case it is undefined would fix this buiid failure:
--- lighttpd-1.4.63/src/algo_xxhash.h    2021-12-04 15:40:24.000000000 +0100
+++ lighttpd-1.4.64/src/algo_xxhash.h    2021-12-15 10:50:17.801155007 +0100
@@ -1563,6 +1563,10 @@
 #ifndef XXH_STATIC_ASSERT
 #  if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)    /* C11 */
 #    include <assert.h>
+/* uClibc does not define static_assert */
+#    ifndef static_assert
+#      define static_assert _Static_assert
+#    endif
 #    define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); } while(0)
 #  elif defined(__cplusplus) && (__cplusplus >= 201103L)            /* C++11 */
 #    define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); } while(0)
Actions #1

Updated by gstrauss over 2 years ago

  • Description updated (diff)
  • Status changed from New to Patch Pending

Thanks. I'll include this in the next lighttpd release.

Have you suggested this patch upstream to xxhash? https://github.com/Cyan4973/xxHash

Actions #2

Updated by aeolio over 2 years ago

Thank you for the hint, issue with the patch above was created.

Actions #3

Updated by gstrauss over 2 years ago

  • Status changed from Patch Pending to Fixed
Actions

Also available in: Atom