[tex-k] bibtex build issue under macOS: error: implicit declaration of function

Karl Berry karl at freefriends.org
Sun Jul 5 22:48:06 CEST 2020

Hi Marius,

    :info:build bibtex.c:6956:36: error: implicit declaration of function 'open_input_with_dirname' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    :info:build       auxfile [auxptr ], -1 ) && ! aopeninwithdirname ( auxfile [auxptr ], 

As far as Akira and I can tell, open_input_with_dirname is declared
before this call. Specifically, it's declared in web2c/lib/lib.h, which
is #included by cpascal.h, which is #included at the very top of bibtex.c.
Maybe there is a different cpascal.h or lib/lib.h on your system that's
getting wrongly #included? (The -I options should prevent that, but
maybe they are getting misinterpreted, or, who knows what.)

Also, if I compile with -Wimplicit-function-declaration using the gcc on
centos7, there is no warning.

It's true that the identifier open_input_with_dirname occurs in the
#define before the declaration, but that must not matter, because there is
no expansion of the macro.

If I run the compiler invocation with -E -dD instead of -c, to get the
preprocessor output, I see (line numbers at left):

9390 #define aopeninwithdirname(f,p,s) open_input_with_dirname (&(f), p, s)
9557 extern boolean open_input_with_dirname (FILE **, int, const char *);
16405 && ! open_input_with_dirname (&(auxfile [auxptr ]), -1, zbibmakecstring((strnumber) (toplevstr)))

So it is declared before it's used, unless I'm going blind. I'm stuck as
to why your compiler is complaining ... --best, karl.

More information about the tex-k mailing list.