bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* Debian Stretch: strndup.c build failure
@ 2020-01-07 14:24 Tim Rühsen
  2020-01-07 15:41 ` Tim Rühsen
  2020-01-07 18:00 ` Bruno Haible
  0 siblings, 2 replies; 4+ messages in thread
From: Tim Rühsen @ 2020-01-07 14:24 UTC (permalink / raw)
  To: bug-gnulib


[-- Attachment #1.1: Type: text/plain, Size: 453 bytes --]

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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Debian Stretch: strndup.c build failure
  2020-01-07 14:24 Debian Stretch: strndup.c build failure Tim Rühsen
@ 2020-01-07 15:41 ` Tim Rühsen
  2020-01-07 18:00 ` Bruno Haible
  1 sibling, 0 replies; 4+ messages in thread
From: Tim Rühsen @ 2020-01-07 15:41 UTC (permalink / raw)
  To: bug-gnulib


[-- Attachment #1.1: Type: text/plain, Size: 1881 bytes --]

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 <limits.h> 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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Debian Stretch: strndup.c build failure
  2020-01-07 14:24 Debian Stretch: strndup.c build failure Tim Rühsen
  2020-01-07 15:41 ` Tim Rühsen
@ 2020-01-07 18:00 ` Bruno Haible
  2020-01-07 19:32   ` Tim Rühsen
  1 sibling, 1 reply; 4+ messages in thread
From: Bruno Haible @ 2020-01-07 18:00 UTC (permalink / raw)
  To: bug-gnulib; +Cc: Tim Rühsen

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 <limits.h> declares strndup.
|    For example, HP-UX 11i <limits.h> declares gettimeofday.  */
| #define strndup innocuous_strndup
| 
| /* System header to define __stub macros and hopefully few prototypes,
|     which can conflict with char strndup (); below.
|     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|     <limits.h> exists even on freestanding compilers.  */
| 
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #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



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Debian Stretch: strndup.c build failure
  2020-01-07 18:00 ` Bruno Haible
@ 2020-01-07 19:32   ` Tim Rühsen
  0 siblings, 0 replies; 4+ messages in thread
From: Tim Rühsen @ 2020-01-07 19:32 UTC (permalink / raw)
  To: Bruno Haible, bug-gnulib


[-- Attachment #1.1: Type: text/plain, Size: 806 bytes --]

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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-01-07 19:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-07 14:24 Debian Stretch: strndup.c build failure Tim Rühsen
2020-01-07 15:41 ` Tim Rühsen
2020-01-07 18:00 ` Bruno Haible
2020-01-07 19:32   ` Tim Rühsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).