Skip to content

Configure blows up because of implicit declaration of exit() #45

Description

@Artoria2e5

Current git HEAD gives:

configure:9081: checking compiler and flags for sanity
configure:9095: gcc -o conftest -g -O2 -fPIC -Wall -Wpointer-arith -Wuninitialized -fstack-protector-all -fno-common  -I/usr/local/opt/icu4c/include -I/usr/local/opt/ruby/include -I/usr/local/opt/sqlite/include -I/usr/local/opt/gettext/include -I/usr/local/opt/qt/include  -L/usr/local/opt/icu4c/lib -L/usr/local/opt/ruby/lib -L/usr/local/opt/sqlite/lib -L/usr/local/opt/gettext/lib -L/usr/local/opt/qt/lib -fstack-protector-all conftest.c  >&5
conftest.c:134:12: error: call to undeclared library function 'exit' with type 'void (int) __attribute__((noreturn))'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
int main(){exit(0);}
           ^
conftest.c:134:12: note: include the header <stdlib.h> or explicitly provide a declaration for 'exit'
1 error generated.
configure:9095: $? = 1
configure: program exited with status 1
configure: failed program was:
| /* confdefs.h, irrelevant */
| /* end confdefs.h.  */
| 
| #include <stdio.h>
| int main(){exit(0);}
| 
configure:9100: result: no
configure:9102: error: *** compiler cannot create working executables, check config.log ***

gcc --version gives:

Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: x86_64-apple-darwin22.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Running autoreconf does not help, because this test is written directly in configure.ac. Changing the CFLAGS to add -Wno-error=all at the CFLAGS="$CFLAGS -fPIC -Wall -Wpointer-arith -Wuninitialized" bit helps, but the right way to do it is probably fixing the invocation. Because well, the compiler does not seem to be in the wrong here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions