Opened 7 months ago

Closed 3 weeks ago

#61590 closed defect (fixed)

alpine @2.23: error: implicit declaration of function 'time' is invalid in C99

Reported by: fcorrao1 (Frank Corrao) Owned by: jcvernaleo (John C. Vernaleo)
Priority: Normal Milestone:
Component: ports Version: 2.6.4
Keywords: bigsur catalina Cc: jerryyhom@…, steven-michaud (Steven Michaud)
Port: alpine

Description

"sudo port install alpine" failed to build due to missing header includes

:info:build `cat CCTYPE` -c `cat CFLAGS` dummy.c
:info:build dummy.c:615:28: error: implicit declaration of function 'time' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
:info:build     stream->uid_validity = time (0);
:info:build                            ^
:info:build dummy.c:615:28: note: did you mean 'utime'?
:info:build /Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk/usr/include/utime.h:72:5: note: 'utime' declared here
:info:build int utime(const char *, const struct utimbuf *);
:info:build     ^
:info:build dummy.c:640:7: error: implicit declaration of function 'time' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
:info:build   if (time (0) >=               /* time to do another test? */
:info:build       ^
:info:build dummy.c:726:23: warning: unsequenced modification and access to 'ts' [-Wunsequenced]
:info:build     if (!ts && !(*(ts = default_proto (NIL))->dtb->create) (ts,"INBOX"))
:info:build                       ^                                     ~~
:info:build 1 warning and 2 errors generated.
:info:build make[4]: *** [dummy.o] Error 1

Change History (17)

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

Keywords: catalina added
Summary: alpine @2.23: fails to build on Big Suralpine @2.23: error: implicit declaration of function 'time' is invalid in C99

comment:2 Changed 7 months ago by jcvernaleo (John C. Vernaleo)

Does anyone currently have access to bigsur to test/fix this? I don't currently have any systems running it yet (and nothing I can upgrade at this moment).

comment:3 Changed 7 months ago by snowflake (Dave Evans)

@jcvernaleo

I have Big Sur 11.1 and CLT 12.2. If you create a repository at Github containing just your Portfile and your patches following Macports conventions I will be happy to build it on Big Sur and submit the logs back to you as a pull request.

comment:4 Changed 6 months ago by jcvernaleo (John C. Vernaleo)

Hmmm, so I took a look and it looks like alpine in homebrew builds on big sur (at least they claim to support it). Main thing is that they are using 2.24 (vs our 2.23). We should probably update first rather then spend time trying to get this one to compile.

comment:5 Changed 6 months ago by mf2k (Frank Schima)

Cc: john@… removed
Owner: set to jcvernaleo
Status: newassigned

comment:6 Changed 5 months ago by jerryyhom

Upstream is aware of the compile error and next release should have fix. If next release is unreasonably long, then we could make a patch. But I think waiting for next release is more prudent.

comment:7 Changed 5 months ago by jcvernaleo (John C. Vernaleo)

100% agree. Unless timing is unreasonable, sticking with mostly unpatched upstream is the best way to go.

comment:8 Changed 3 months ago by steven-michaud (Steven Michaud)

Cc: steven-michaud added

comment:9 Changed 3 months ago by bifyu

Most recent alpine in macports is still 2.23. Will this be upgraded to 2.24?

comment:10 Changed 3 months ago by steven-michaud (Steven Michaud)

This bug isn't fixed in alpine 2.24.

I tested with the latest source tarball from the Alpine home page (http://alpine.x10host.com/). I tried building it on macOS 11.2.3 with XCode 12.4 (and its commandline tools).

Last edited 3 months ago by steven-michaud (Steven Michaud) (previous) (diff)

comment:11 Changed 3 months ago by bifyu

Eduardo Chappa, who is currently maintaining alpine has said:

...the solution is to edit the file imap/src/osdep/unix/os_osx.h and add the line

#include <time.h>

which some people have successfully added after the line

#include <sys/file.h>

The reason why I have not committed this fix yet is because I do not know if this fix is compatible with existing compilers supported by Apply in older systems. In other words, I do not know if this fix must be "ifdef"ined or if it can be added this way and older and newer systems will work.

I do not own an apple system, so I do not know.

If this can be confirmed for Eduardo, we could get this fix committed for a future release.

comment:12 Changed 3 months ago by steven-michaud (Steven Michaud)

I have virtual machines for the latest (minor) release of each major version of macOS/OS X going back to OS X 10.9.5. I hope and assume that this is sufficient. Over the next few days I'll try building Alpine 2.24 with this patch on each of them.

comment:13 Changed 3 months ago by steven-michaud (Steven Michaud)

I used Edwardo Chappa's suggestion to create the following patch:

diff --git a/imap/src/osdep/unix/os_osx.h b/imap/src/osdep/unix/os_osx.h
index 6fcb014..ce156d0 100644
--- a/imap/src/osdep/unix/os_osx.h
+++ b/imap/src/osdep/unix/os_osx.h
@@ -32,6 +32,7 @@
 #include <utime.h>
 #include <syslog.h>
 #include <sys/file.h>
+#include <time.h>
 
 
 /* Mac OS X gets this wrong as of Leopard */

Then I applied it to the Alpine 2.24 source distro and successfully built it on all (major) versions of macOS/OS X going back to OS X 10.9.5.

Here are the versions of XCode I used on each version of macOS:

macOS 11.2.3             XCode 12.4
macOS 10.15.7            XCode 11.1
macOS 10.14.6            XCode 10.3
macOS 10.13.6            XCode  9.1
macOS 10.12.6            XCode  8.3.3
OS X  10.11.6            XCode  7.3.1
OS X  10.10.5            XCode  6.1.1
OS X  10.9.5             XCode  6.1.1

All the systems I built on had MacPorts installed, and at least the openssl and curl-ca-bundle ports. On all of them I called configure with the following parameters:

--prefix=/opt/local --with-ssl-dir=/opt/local --with-ssl-certs-dir=/opt/local/etc/openssl

comment:14 Changed 2 months ago by bifyu

Mahalo, Steven!

Eduardo Chappa reports that thanks to your efforts,

I have updated the git repository and added the fix. The fix will be part of the next release of Alpine.

Thank you so much for your help!

comment:15 Changed 3 weeks ago by markmentovai (Mark Mentovai)

Although this was committed upstream as b3c7debd83ba (2021-03-30), there hasn’t been a follow-up Alpine release that contains it. As this is quite broken on macOS 11, I have a pull request pending to both update Alpine to 2.24 and fix this build error.

comment:16 Changed 3 weeks ago by jerryyhom

Thanks Steven and Mark for your efforts.

An alternative to the patch is updating to v2.24.1. Any comments?

comment:17 Changed 3 weeks ago by markmentovai (Mark Mentovai)

Resolution: fixed
Status: assignedclosed

In 124ea1e8ab868e87e90e56eab2c64e6013ca25af/macports-ports (master):

alpine: update to 2.24 (2020-10-10)

This also backports an upstream fix, b3c7debd83ba (2021-03-30), to allow
building on macOS 11. That fix has not yet made it into any upstream
release.

The existing MacPorts patch files are removed, as they have not been
used since 4868537e25c5 (2015-02-23).

Fixes: #61590

Note: See TracTickets for help on using tickets.