Re: Debian Stretch: strndup.c build failure
Hi Bruno, On 07.01.20 19:00, Bruno Haible wrote: >> with the latest gnulib (a7903da07d3d18c23314aa0815adbb4058fd7cec) on >> Debian Stretch: >> >> In file included from /usr/include/string.h:630:0, >> from ./string.h:41, >> from strndup.c:21: >> strndup.c:26:1: error: expected identifier or '(' before '__extension__' >> strndup (char const *s, size_t n) >> ^ >> >> config.log is at >> https://gitlab.com/gnuwget/wget2/-/jobs/395706872/artifacts/file/config.log. > > An invocation of AC_CHECK_FUNC is malfunctioning because of -Werror: > > For this reason, -Werror is not supported at configuration-time in gnulib [1]. > > [1] https://lists.gnu.org/archive/html/bug-gnulib/2019-07/msg00081.html Thanks for clarification :-) Regards, Tim signature.asc Description: OpenPGP digital signature
Re: Debian Stretch: strndup.c build failure
Hi Tim, > with the latest gnulib (a7903da07d3d18c23314aa0815adbb4058fd7cec) on > Debian Stretch: > > In file included from /usr/include/string.h:630:0, > from ./string.h:41, > from strndup.c:21: > strndup.c:26:1: error: expected identifier or '(' before '__extension__' > strndup (char const *s, size_t n) > ^ > > config.log is at > https://gitlab.com/gnuwget/wget2/-/jobs/395706872/artifacts/file/config.log. An invocation of AC_CHECK_FUNC is malfunctioning because of -Werror: configure:8814: checking for strndup configure:8814: ccache gcc -o conftest -O1 -g -ggdb3 -Werror conftest.c >&5 conftest.c:150:6: error: conflicting types for built-in function 'strndup' [-Werror] char strndup (); ^~~ cc1: all warnings being treated as errors configure:8814: $? = 1 configure: failed program was: | /* confdefs.h */ | ... | /* end confdefs.h. */ | /* Define strndup to an innocuous variant, in case declares strndup. |For example, HP-UX 11i declares gettimeofday. */ | #define strndup innocuous_strndup | | /* System header to define __stub macros and hopefully few prototypes, | which can conflict with char strndup (); below. | Prefer to if __STDC__ is defined, since | exists even on freestanding compilers. */ | | #ifdef __STDC__ | # include | #else | # include | #endif | | #undef strndup | | /* Override any GCC internal prototype to avoid an error. |Use char because int might match the return type of a GCC |builtin and then its argument prototype would still apply. */ | #ifdef __cplusplus | extern "C" | #endif | char strndup (); | /* The GNU C library defines this for functions which it implements | to always fail with ENOSYS. Some functions are actually named | something starting with __ and the normal name is an alias. */ | #if defined __stub_strndup || defined __stub___strndup | choke me | #endif | | int | main () | { | return strndup (); | ; | return 0; | } configure:8814: result: no For this reason, -Werror is not supported at configuration-time in gnulib [1]. Bruno [1] https://lists.gnu.org/archive/html/bug-gnulib/2019-07/msg00081.html
Re: Debian Stretch: strndup.c build failure
On 1/7/20 3:24 PM, Tim Rühsen wrote: > Hi, > > with the latest gnulib (a7903da07d3d18c23314aa0815adbb4058fd7cec) on > Debian Stretch: > > In file included from /usr/include/string.h:630:0, > from ./string.h:41, > from strndup.c:21: > strndup.c:26:1: error: expected identifier or '(' before '__extension__' > strndup (char const *s, size_t n) > ^ > > config.log is at > https://gitlab.com/gnuwget/wget2/-/jobs/395706872/artifacts/file/config.log. The issue is that the ./configure step is run with CFLAGS="-Werror" (here with CC=clang): $ grep strndup config.log configure:8814: checking for strndup conftest.c:152:6: error: incompatible redeclaration of library function 'strndup' [-Werror,-Wincompatible-library-redeclaration] char strndup (); conftest.c:152:6: note: 'strndup' is a builtin with type 'char *(const char *, unsigned long)' | /* Define strndup to an innocuous variant, in case declares strndup. | #define strndup innocuous_strndup | which can conflict with char strndup (); below. | #undef strndup | char strndup (); | #if defined __stub_strndup || defined __stub___strndup | return strndup (); configure:20326: checking whether strndup is declared ac_cv_func_strndup=no ac_cv_have_decl_strndup=yes Though it always worked (for my projects), I can imagine that ./configure tests may stumble when -Werror is set. So, is it good practice not to use -Werror with ./configure ? Without -Werror: $ grep strndup config.log configure:8814: checking for strndup conftest.c:154:6: warning: conflicting types for built-in function 'strndup' char strndup (); configure:20326: checking whether strndup is declared configure:38601: checking for working strndup ac_cv_func_strndup=yes ac_cv_have_decl_strndup=yes gl_cv_func_strndup_works=yes Regards, Tim signature.asc Description: OpenPGP digital signature
Debian Stretch: strndup.c build failure
Hi, with the latest gnulib (a7903da07d3d18c23314aa0815adbb4058fd7cec) on Debian Stretch: In file included from /usr/include/string.h:630:0, from ./string.h:41, from strndup.c:21: strndup.c:26:1: error: expected identifier or '(' before '__extension__' strndup (char const *s, size_t n) ^ config.log is at https://gitlab.com/gnuwget/wget2/-/jobs/395706872/artifacts/file/config.log. Regards, Tim signature.asc Description: OpenPGP digital signature