Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Many configure tests broken with clang 12



Hello,

Building zsh 5.8 with clang 12 (which is the system compiler on recent macOS versions) leads to a completely broken zsh. This is because many configure tests actually fail, when they should succeed, because of undeclared functions. Take for example TGETENT_ACCEPTS_NULL in configure.ac:

[AC_RUN_IFELSE([AC_LANG_SOURCE([[
main()
{
    char buf[4096];
    int r1 = tgetent(buf, "vt100");
    int r2 = tgetent((char*)0,"vt100");
    if (r1 >= 0 && r1 == r2) {
        char tbuf[1024], *u;
        u = tbuf;
        tgetstr("cl", &u);
        creat("conftest.tgetent", 0640);
    }
    exit((r1 != r2) || r2 == -1);
}
]])]

This will fail for two reasons:

conftest.c:233:6: error: implicit declaration of function 'tgetstr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
conftest.c:236:5: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]

tgetstr() should require the <term.h> header to be included in the test. And exit() needs <stdlib.h>

This occurs in a lot of places throughout the configure script. I have found the list below (see at end of message). clang 12 has made -Wimplicit-function-declaration into an error by default, which explains why these tests are now starting to fail. See our original report on Homebrew: https://github.com/Homebrew/homebrew-core/issues/64921

Best regards,
FX






fx@rmeur zsh-5.8 % grep 'implicitly declaring' config.log
conftest.c:236:5: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
conftest.c:236:5: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
conftest.c:255:24: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
conftest.c:255:40: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
conftest.c:293:2: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
conftest.c:291:2: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
conftest.c:287:5: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
conftest.c:302:9: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
conftest.c:286:5: error: implicitly declaring library function 'sprintf' with type 'int (char *, const char *, ...)' [-Werror,-Wimplicit-function-declaration]
conftest.c:288:14: error: implicitly declaring library function 'strcpy' with type 'char *(char *, const char *)' [-Werror,-Wimplicit-function-declaration]
conftest.c:291:5: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
conftest.c:291:31: error: implicitly declaring library function 'strcmp' with type 'int (const char *, const char *)' [-Werror,-Wimplicit-function-declaration]
conftest.c:320:13: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
fx@rmeur zsh-5.8 % grep 'C99' config.log        
conftest.c:228:14: error: implicit declaration of function 'tgetent' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
conftest.c:233:6: error: implicit declaration of function 'tgetstr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
conftest.c:234:2: error: implicit declaration of function 'creat' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
conftest.c:228:14: error: implicit declaration of function 'tgetent' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
conftest.c:233:6: error: implicit declaration of function 'tgetstr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
conftest.c:234:2: error: implicit declaration of function 'creat' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
conftest.c:287:5: error: implicit declaration of function 'unlink' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
conftest.c:289:8: error: implicit declaration of function 'mkfifo' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
conftest.c:294:11: error: implicit declaration of function 'fork' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
conftest.c:299:17: error: implicit declaration of function 'read' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
conftest.c:302:22: error: implicit declaration of function 'write' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
conftest.c:286:27: error: implicit declaration of function 'getpid' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
conftest.c:286:37: error: implicit declaration of function 'rand' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
conftest.c:298:5: error: implicit declaration of function 'read' is invalid in C99 [-Werror,-Wimplicit-function-declaration]





Messages sorted by: Reverse Date, Date, Thread, Author