Opened 3 months ago

Last modified 3 months ago

#61564 new defect

libelf @0.8.13.2: implicit declaration of function

Reported by: ugr Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.6.4
Keywords: bigsur catalina Cc:
Port: libelf

Description

This bug also breaks depended ports like avrdude.

:info:configure Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libelf/libelf/work/libelf-0.8.13" && ./configure$
:debug:configure system:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libelf/libelf/work/libelf-0.8.13" && ./configure -$
:info:configure creating cache ./config.cache
:info:configure checking whether make sets ${MAKE}... yes
:info:configure checking for gcc... /usr/bin/clang
:info:configure checking whether the C compiler (/usr/bin/clang -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk -arch x86_64 -L/opt/local/lib -Wl,-headerpad_max_install_nam$
:info:configure checking whether the C compiler (/usr/bin/clang -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk -arch x86_64 -L/opt/local/lib -Wl,-headerpad_max_install_nam$
:info:configure checking whether we are using GNU C... yes
:info:configure checking whether /usr/bin/clang accepts -g... yes
:info:configure checking how to run the C preprocessor... /usr/bin/clang -E
:info:configure checking for a BSD compatible install... /usr/bin/install -c
:info:configure checking for ranlib... ranlib
:info:configure checking whether ln -s works... yes
:info:configure checking for ANSI C header files... no
:info:configure checking for unistd.h... yes
:info:configure checking for stdint.h... yes
:info:configure checking for fcntl.h... yes
:info:configure checking for elf.h... no
:info:configure checking for sys/elf.h... no
:info:configure checking for link.h... no
:info:configure checking for sys/link.h... no
:info:configure checking if /usr/bin/clang can compile elf.h... no
:info:configure checking for ar.h... yes
:info:configure checking for libelf.h... no
:info:configure checking for nlist.h... yes
:info:configure checking for gelf.h... no
:info:configure checking whether to install <libelf.h>, <nlist.h> and <gelf.h>... no
:info:configure checking for working const... yes
:info:configure checking for off_t... yes
:info:configure checking for size_t... yes
:info:configure checking size of short... 0
:info:configure checking size of int... 0
:info:configure checking size of long... 0
:info:configure checking size of long long... 0
:info:configure checking size of __int64... 0
:info:configure checking for 64-bit integer... no
:info:configure checking for 32-bit integer... no
:info:configure configure: error: neither int nor long is 32-bit
:info:configure Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libelf/libelf/work/libelf-0.8.13" && ./conf$

Error reasons from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libelf/libelf/work/libelf-0.8.13/config.log:

configure:1060: /usr/bin/clang -E -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk conftest.c >/dev/null 2>conftest.out
configure:1127: /usr/bin/clang -o conftest -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk -arch x86_64 -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SD$
configure:1122:67: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
                                                                  ^
configure:1122:67: note: include the header <stdlib.h> or explicitly provide a declaration for 'exit'
1 error generated.
1 error generated.
configure: failed program was:
#line 1116 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
int main () { int i; for (i = 0; i < 256; i++)
if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
configure:1410: checking for off_t
configure:1443: checking for size_t
configure:1477: checking size of short
configure:1496: /usr/bin/clang -o conftest -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk -arch x86_64 -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SD$
configure:1487:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
main()
^
configure:1490:11: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
  if (!f) exit(1);
          ^
configure:1490:11: note: include the header <stdlib.h> or explicitly provide a declaration for 'exit'
configure:1491:22: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat]
  fprintf(f, "%d\n", sizeof(short));
              ~~     ^~~~~~~~~~~~~
              %lu
2 warnings and 1 error generated.
configure: failed program was:
#line 1485 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
{
  FILE *f=fopen("conftestval", "w");
  if (!f) exit(1);
  fprintf(f, "%d\n", sizeof(short));
  exit(0);
}

It seems that the default include files in BigSur changed so that functions from stdlib.h are not automatically included by stdio.h anymore. I think the configure tests can be fixed by simply adding #include <stdlib.h> (but i don't know how to change/patch a port...).

Change History (1)

comment:1 Changed 3 months ago by ryandesign (Ryan Schmidt)

Keywords: bigsur catalina added
Summary: libelf @0.8.13.2 fails to configure on BigSur 11.0.1libelf @0.8.13.2: implicit declaration of function

In Xcode 12 Apple changed implicit declaration of function from a warning to an error. It does indeed need to be fixed as you suggest, including the headers that declare the functions that are being used. This problem affects many, many ports.

Note: See TracTickets for help on using tickets.