Hi Chris,

Chris Packham <judge.pack...@gmail.com> writes:

> I'm the current maintainer of crosstool-ng. We had a bug report form a
> user[1] with a configuration that involved building GNU make from
> source.
>
> I haven't been able to reproduce the error yet (the users on macOS,
> I've tried a few different debian containers) but eye-balling the
> latest source the problem still seems to be there[2] if I can trigger
> the need to back-fill from gnulib.

GNU Make avoids importing Gnulib modules, since it will make
bootstrapping harder.

> It looks like others have hit a similar error[3] but that fix hasn't
> been picked up (and I don't think it will address the one that the
> ct-ng user reported).
>
> I'll see if I can find a way of reproducing the issue and if I can,
> the fix should be relatively straightforward.

Based on the error messages you linked, copied here for reference:

[ERROR]    
/Volumes/workspace_casesensitive/crosstool-ng/.build/aarch64-rpi4-linux-gnu/src/make/lib/fnmatch.c:124:14:
 error: conflicting types for 'getenv'; have 'char *(void)'
[ALL  ]      124 | extern char *getenv ();
[ALL  ]          |              ^~~~~~
[ALL  ]    In file included from 
/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/stdlib.h:58,
[ALL  ]                     from ./stdlib.h:36,
[ALL  ]                     from 
/Volumes/workspace_casesensitive/crosstool-ng/.build/aarch64-rpi4-linux-gnu/src/make/lib/fnmatch.c:40:
[ALL  ]    
/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/_stdlib.h:162:25:
 note: previous declaration of 'getenv' with type 'char *(const char *)'
[ALL  ]      162 | char *_LIBC_CSTR        getenv(const char *);

I am 99% sure this is because you are using a very new C compiler (GCC
15, or whatever the Clang equivalent version is). In these new versions
C23 is the default.

In C23 the following declarations are equivalent:

    extern char *getenv ();
    extern char *getenv (void);

In previous versions of the C standard a declaration with an empty
parameter list just declares a function with an unspecified number of
arguments.

See the following example:

    $ cat main.c 
    extern char *getenv ();
    int
    main (void)
    {
      getenv (0, 1, 2, 3);
      return 0;
    }
    $ gcc -std=gnu23 main.c 
    main.c: In function ‘main’:
    main.c:5:3: error: too many arguments to function ‘getenv’; expected 0, 
have 4
        5 |   getenv (0, 1, 2, 3);
          |   ^~~~~~  ~
    main.c:1:14: note: declared here
        1 | extern char *getenv ();
          |              ^~~~~~
    $ gcc -std=gnu99 main.c
    $ echo $?
    0

So, you should be able to compile with -std=gnu99.

Collin

Reply via email to