marlam / mpop

POP3 client
https://marlam.de/mpop
GNU General Public License v3.0
13 stars 1 forks source link

1.4.15 build fails on macOS #9

Closed alebcay closed 2 years ago

alebcay commented 2 years ago

Hello, while attempting to package mpop 1.4.15 on macOS for the Homebrew package manager, we encountered this error:

mpopd.c:277:41: error: no member named 'st_mtim' in 'struct stat'
            mail.mtime.tv_sec = statbuf.st_mtim.tv_sec;
                                ~~~~~~~ ^
mpopd.c:278:42: error: no member named 'st_mtim' in 'struct stat'
            mail.mtime.tv_nsec = statbuf.st_mtim.tv_nsec;
                                 ~~~~~~~ ^
2 errors generated.

It looks like macOS is not fully POSIX compliant in this regard. There have been similar issues in the past involving other open-source software (that have since been resolved): zstd, optipng. Thanks!

marlam commented 2 years ago

Does this patch help?

diff --git a/src/mpopd.c b/src/mpopd.c
index 62c7cbad..acea4da9 100644
--- a/src/mpopd.c
+++ b/src/mpopd.c
@@ -42,6 +42,9 @@
 #include <sys/wait.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#ifdef __APPLE__
+#define st_mtim st_mtimespec
+#endif
 #include <time.h>
 #include <syslog.h>
 #include <getopt.h>
alebcay commented 2 years ago

Yes, that patch gets past the error I linked above. Now it fails at:

  CC       mpopd.o
  CCLD     mpop
  CCLD     mpopd
Undefined symbols for architecture x86_64:
  "_libintl_gettext", referenced from:
      _password_get in password.o
      _password_eval in password.o
ld: symbol(s) not found for architecture x86_64

I don't believe this is related to the previous error, as I'm seeing the same error in trying to build/ship msmtp 1.8.17 (gettext/libintl is available in the environment but looks like it's not getting picked up).

marlam commented 2 years ago

This problem should be fixed now for both mpop and msmtp, see this patch (mpopd was not linked against $(LIBINTL)). It might take up to 24 hours before the fix shows up in the Github mirror.

alebcay commented 2 years ago

For mpop 1.4.15 we picked up 68693b7da5d037ac31954db00c210daa28f2ea74 and 64f8dc2b39d9e967e09b234993e096f4441ae87a. For msmtp 1.8.17 we picked up 7f03f3767ee6b7311621386c77cb5575fcaa13d0. Both are building fine now. Thanks for your quick response!