Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#61663 closed defect (fixed)

procmail @3.22: error: implicit declaration of function 'killchildren' is invalid in C99

Reported by: pwosel Owned by: blair (Blair Zajac)
Priority: Normal Milestone:
Component: ports Version: 2.6.4
Keywords: bigsur catalina Cc:
Port: procmail

Description (last modified by pwosel)

% sudo port install procmail
--->  Fetching archive for procmail
--->  Attempting to fetch procmail-3.22_8.darwin_20.x86_64.tbz2 from https://packages.macports.org/procmail
--->  Attempting to fetch procmail-3.22_8.darwin_20.x86_64.tbz2 from https://nue.de.packages.macports.org/procmail
--->  Attempting to fetch procmail-3.22_8.darwin_20.x86_64.tbz2 from https://lil.fr.packages.macports.org/procmail
--->  Fetching distfiles for procmail
--->  Verifying checksums for procmail
--->  Extracting procmail
--->  Applying patches to procmail
--->  Configuring procmail
--->  Building procmail
Error: Failed to build procmail: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_mail_procmail/procmail/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets to report a bug.
Error: Processing of port procmail failed


:info:build make[1]: Entering directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_mail_procmail/procmail/work/procm
ail-3.22/src'
:info:build /bin/sh ./autoconf /bin/sh "/bin/rm -f" "mv -f" /dev/null \
:info:build  "grep -F" "/Library/Developer/CommandLineTools/usr/bin/make" o "/tmp" \
:info:build  "/opt/local/bin" ../autoconf.h
:info:build Using the following directories for the LOCKINGTESTs:
:info:build   /tmp
:info:build Initiating fcntl()/kernel-locking-support tests
:info:build Whoeaaa!  There's something fishy going on here.
:info:build You have a look and see if you detect anything uncanny:
:info:build *******************************************************
:info:build make[2]: Entering directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_mail_procmail/procmail/work/procm
ail-3.22/src'
:info:build /usr/bin/clang -arch x86_64 -c -O   _autotst.c
:info:build In file included from _autotst.c:2:
:info:build ./../config.h:3:43: warning: '/*' within block comment [-Wcomment]
:info:build /*#define sMAILBOX_SEPARATOR    "\1\1\1\1\n"    /* sTART- and eNDing separ.  */
:info:build                                                 ^
:info:build ./../config.h:4:43: warning: '/*' within block comment [-Wcomment]
:info:build /*#define eMAILBOX_SEPARATOR    "\1\1\1\1\n"    /* uncomment (one or both)
:info:build                                                 ^
:info:build ./../config.h:49:28: warning: '/*' within block comment [-Wcomment]
:info:build /*#define GROUP_PER_USER                        /* uncomment this if each
:info:build                                                 ^
:info:build ./../config.h:55:20: warning: '/*' within block comment [-Wcomment]
:info:build /*#define LMTP                                  /* uncomment this if you
:info:build                                                 ^
:info:build ./../config.h:80:26: warning: '/*' within block comment [-Wcomment]
:info:build /*#define NO_fcntl_LOCK         /* uncomment any of these three if you       */
:info:build                                 ^
:info:build ./../config.h:81:26: warning: '/*' within block comment [-Wcomment]
:info:build /*#define NO_lockf_LOCK         /* definitely do not want procmail to make   */
:info:build                                 ^
:info:build ./../config.h:82:26: warning: '/*' within block comment [-Wcomment]
:info:build /*#define NO_flock_LOCK         /* use of those kernel-locking methods       */
:info:build                                 ^
:info:build ./../config.h:88:29: warning: '/*' within block comment [-Wcomment]
:info:build /*#define RESTRICT_EXEC 100     /* uncomment to prevent users with uids equal
:info:build                                 ^
:info:build ./../config.h:94:29: warning: '/*' within block comment [-Wcomment]
:info:build /*#define NO_NFS_ATIME_HACK     /* uncomment if you're definitely not using
:info:build                                 ^
:info:build ./../config.h:101:44: warning: '/*' within block comment [-Wcomment]
:info:build /*#define DEFsendmail   "/usr/sbin/sendmail"    /* uncomment and/or change if
:info:build                                                 ^
:info:build ./../config.h:129:34: warning: '/*' within block comment [-Wcomment]
:info:build /*#define console       "/dev/console"  /* uncomment if you want procmail to
:info:build                                         ^
:info:build _autotst.c:62:30: error: implicit declaration of function 'killchildren' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
:info:build { timeout=1;close(fdcollect);killchildren();
:info:build                              ^
:info:build _autotst.c:66:14: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
:info:build { stimeout();exit(1);
:info:build              ^
:info:build _autotst.c:66:14: note: include the header <stdlib.h> or explicitly provide a declaration for 'exit'
:info:build _autotst.c:126:8: error: implicit declaration of function 'fdlock' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
:info:build               fdlock(goodlock);
:info:build               ^
:info:build _autotst.c:126:8: note: did you mean 'flock'?
:info:build /Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk/usr/include/sys/fcntl.h:568:9: note: 'flock' declared here
:info:build int     flock(int, int);
:info:build         ^
:info:build _autotst.c:145:11: error: implicit declaration of function 'sfdlock' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
:info:build               if(sfdlock(fd))
:info:build                  ^
:info:build _autotst.c:145:11: note: did you mean 'flock'?
:info:build /Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk/usr/include/sys/fcntl.h:568:9: note: 'flock' declared here
:info:build int     flock(int, int);
:info:build         ^
:info:build _autotst.c:152:11: error: implicit declaration of function 'fdunlock' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
:info:build               if(fdunlock()||close(fd))
:info:build                  ^
:info:build _autotst.c:167:13: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
:info:build               if(fp=fopen("_locktst.pid","w"))
:info:build                  ~~^~~~~~~~~~~~~~~~~~~~~~~~~~
:info:build _autotst.c:167:13: note: place parentheses around the assignment to silence this warning
:info:build               if(fp=fopen("_locktst.pid","w"))
:info:build                    ^
:info:build                  (                           )
:info:build _autotst.c:167:13: note: use '==' to turn this assignment into an equality comparison
:info:build               if(fp=fopen("_locktst.pid","w"))
:info:build                    ^
:info:build                    ==
:info:build _autotst.c:184:31: error: implicit declaration of function 'killchildren' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
:info:build            alarm(0);close(fdcollect);killchildren();
:info:build                                      ^
:info:build _autotst.c:233:10: error: implicit declaration of function 'fdlock' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
:info:build   return fdlock(fd);
:info:build          ^
:info:build _autotst.c:236:8: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
:info:build static oldfdlock;
:info:build ~~~~~~ ^
:info:build 13 warnings and 7 errors generated.
:info:build make[2]: *** [_autotst.o] Error 1
:info:build make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_mail_procmail/procmail/work/procma


Change History (10)

comment:1 Changed 4 years ago by pwosel

Description: modified (diff)

comment:2 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: bigsur catalina added; procmail big sur C99 removed
Port: procmail added
Summary: port install procmail fails with invalid implicit declaration on Big Surprocmail @3.22: error: implicit declaration of function 'killchildren' is invalid in C99

The well-known Xcode 12 issue.

comment:3 Changed 4 years ago by blair (Blair Zajac)

Owner: set to blair
Resolution: fixed
Status: newclosed

In 8ea53c8587b4dcbb67a8ed47d9832363e64552a0/macports-ports (master):

procmail: fix build on Big Sur.

Fixes: #61663

comment:4 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

That's not the right fix and could result in a crashing program on Apple Silicon. (Apple turned this warning into an error for a reason.) It should be fixed correctly e.g. by including the requisite headers.

comment:5 Changed 4 years ago by blair (Blair Zajac)

Resolution: fixed
Status: closedreopened

comment:6 Changed 4 years ago by blair (Blair Zajac)

Status: reopenedassigned

comment:7 Changed 4 years ago by blair (Blair Zajac)

Resolution: fixed
Status: assignedclosed

In 0362d00ac3e88432979d704a42d32e9a912c4aa0/macports-ports (master):

procmail: properly fix build on Big Sur

Don't use -Wno-error=implicit-function-declaration everywhere since
that can result on crashing programs on Apple Silicon. However, use
the flag only on a test program that OS capabilities since this
program is only run at build time.

Fixes: #61663

comment:8 Changed 4 years ago by jmroot (Joshua Root)

Crashing is the best case scenario actually. Another possibility is subtle incorrect behaviour due to stack corruption. You might get away with it iff either no functions that take varargs are used, or those that do are always called only with their fixed arguments.

comment:9 Changed 4 years ago by blair (Blair Zajac)

Thanks for that background. Is there a good link to read more?

For procmail, my initial attempt to get this working was to update src/autoconf and put in the necessary includes and definitions. However, this got to be a bit much and after some struggling, I went the -Wno-error=implicit-function-declaration way.

One reason to do this was that src/autoconf wants to see which functions the OS provides and it does this by compiling the .o file even if the system doesn't have the function and then check the link step for a missing symbol by grepping the stdout/stderrr for the function name. I found it odd to add a symbol declaration when the OS doesn't have the function.

Worse, some of the time the src/autoconf doesn't run the resulting binary and sometimes it does, so one could use -Wno-error=implicit-function-declaration sometimes and other times want it to avoid runtime issues.

This really is the worst configuration system :(

comment:10 in reply to:  9 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to blair:

Thanks for that background. Is there a good link to read more?

I wish I could find a clear standalone document from Apple on this, but the best I could find is:

https://developer.apple.com/documentation/apple_silicon/addressing_architectural_differences_in_your_macos_code#3616882

"The x86_64 and arm64 architectures have different calling conventions for variadic functions—functions with a variable number of parameters. On x86_64, the compiler treats fixed and variadic parameters the same, placing parameters in registers first and only using the stack when no more registers are available. On arm64, the compiler always places variadic parameters on the stack, regardless of whether registers are available. If you implement a function with fixed parameters, but redeclare it with variadic parameters, the mismatch causes unexpected behavior at runtime."

This really is the worst configuration system :(

It sounds terrible!

Note: See TracTickets for help on using tickets.