Opened 6 months ago

Last modified 6 months ago

#72822 new defect

daemontools @0.76: error: call to undeclared function 'lockf'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

Reported by: jf (Jeffrey 'jf' Lim) Owned by:
Priority: Normal Milestone:
Component: ports Version:
Keywords: sequoia haspatch Cc: cooljeanius (Eric Gallager)
Port: daemontools

Description

$ sudo port install daemontools
Password:
--->  Fetching archive for daemontools
--->  Attempting to fetch daemontools-0.76_3.darwin_24.arm64.tbz2 from https://packages.macports.org/daemontools
--->  Attempting to fetch daemontools-0.76_3.darwin_24.arm64.tbz2 from http://jog.id.packages.macports.org/macports/packages/daemontools
--->  Attempting to fetch daemontools-0.76_3.darwin_24.arm64.tbz2 from http://aarnet.au.packages.macports.org/pub/macports/packages/daemontools
--->  Fetching distfiles for daemontools
--->  Verifying checksums for daemontools
--->  Extracting daemontools
--->  Applying patches to daemontools
--->  Configuring daemontools
--->  Building daemontools
Error: Failed to build daemontools: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_sysutils_daemontools/daemontools/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug.
Error: Processing of port daemontools failed
$

Last few lines of main.log showing the error (the complete main.log is attached, just fyi):

:info:build ./compile lock_ex.c
:info:build lock_ex.c:12:30: error: call to undeclared function 'lockf'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
:info:build    12 | int lock_ex(int fd) { return lockf(fd,1,0); }
:info:build       |                              ^
:info:build 1 error generated.
:info:build make: *** [lock_ex.o] Error 1
:info:build Command failed:  cd "/opt/local/var/macports/build/daemontools-9f9e0159/work/admin/daemontools-0.76" && package/compile
:info:build Exit code: 2
:error:build Failed to build daemontools: command execution failed
:debug:build Error code: CHILDSTATUS 53466 2
:debug:build Backtrace: command execution failed
:debug:build     while executing
:debug:build "system {*}$notty {*}$callback {*}$nice $fullcmdstring"
:debug:build     invoked from within
:debug:build "command_exec -callback portprogress::target_progress_callback build"
:debug:build     (procedure "portbuild::build_main" line 10)
:debug:build     invoked from within
:debug:build "$procedure $targetname"
:error:build See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_sysutils_daemontools/daemontools/main.log for details.

The fix (with help from Homebrew's formula, and tested on my system) is to patch some more (hm). Specifically:

--- src/lock_ex.c.orig	2001-07-13 00:49:49
+++ src/lock_ex.c	2025-08-13 14:07:33
@@ -1,5 +1,6 @@
 /* Public domain. */
 
+#include <unistd.h>
 #include <sys/types.h>
 #include <sys/file.h>
 #include <fcntl.h>
--- src/lock_exnb.c.orig	2001-07-13 00:49:49
+++ src/lock_exnb.c	2025-08-13 14:07:33
@@ -1,5 +1,6 @@
 /* Public domain. */
 
+#include <unistd.h>
 #include <sys/types.h>
 #include <sys/file.h>
 #include <fcntl.h>
--- src/multilog.c.orig	2025-08-13 13:42:49
+++ src/multilog.c	2025-08-13 14:07:39
@@ -2,6 +2,7 @@
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <stdio.h>
 #include "direntry.h"
 #include "alloc.h"
 #include "buffer.h"
--- src/supervise.c.orig	2025-08-13 13:42:49
+++ src/supervise.c	2025-08-13 14:07:45
@@ -3,6 +3,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <signal.h>
+#include <stdio.h>
 #include "sig.h"
 #include "strerr.h"
 #include "error.h"

(This patch file is also attached)

Attachments (2)

main.log (22.5 KB) - added by jf (Jeffrey 'jf' Lim) 6 months ago.
our.patch (921 bytes) - added by jf (Jeffrey 'jf' Lim) 6 months ago.

Download all attachments as: .zip

Change History (5)

Changed 6 months ago by jf (Jeffrey 'jf' Lim)

Attachment: main.log added

Changed 6 months ago by jf (Jeffrey 'jf' Lim)

Attachment: our.patch added

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

Keywords: sequoia haspatch added
Summary: daemontools fails to builddaemontools @0.76: error: call to undeclared function 'lockf'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

Thanks. Did you report the problem to the developer? If not, please do.

comment:2 Changed 6 months ago by jmroot (Joshua Root)

Like ucspi-tcp, this hasn't been updated upstream in decades, and Debian has patches: https://udd.debian.org/patches.cgi?src=daemontools&version=1%3A0.76-14

comment:3 Changed 6 months ago by cooljeanius (Eric Gallager)

Cc: cooljeanius added
Note: See TracTickets for help on using tickets.