dovecot-2.0.alpha2 doesn't compile on Mac OS X

View: New views
7 Messages — Rating Filter:   Alert me  

dovecot-2.0.alpha2 doesn't compile on Mac OS X

by Mike Abbott-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Howdy, dovecot-2.0.alpha2 doesn't compile on Mac OS X.

First, trivially, there's a typo in array.h:
--- a/src/lib/array.h   2009-10-08 10:04:35.000000000 -0500
+++ b/src/lib/array.h 2009-10-27 10:35:58.000000000 -0500
@@ -72,7 +72,7 @@
              (elem)++)
  #  define array_foreach_modifiable(array, elem) \
         for (elem = ARRAY_TYPE_CAST_MODIFIABLE(array) \
-                       buffer_get_modifiable_data((array)-
 >arr.buffer, NULL)) + \
+ buffer_get_modifiable_data((array)->arr.buffer, NULL) + \
                         (array)->arr.buffer->used; \
             elem != CONST_PTR_OFFSET(*(array)->v, (array)->arr.buffer-
 >used); \
             (elem)++)


Second, Mac OS X can't link loadable modules against other loadable  
modules (http://www.finkproject.org/doc/porting/porting.en.html#shared.lib-and-mod 
):
--- a/src/plugins/fts-squat/Makefile.am 2009-10-18 16:28:45.000000000  
-0500
+++ b/src/plugins/fts-squat/Makefile.am 2009-10-27 10:35:58.000000000  
-0500
@@ -10,8 +10,9 @@
  module_LTLIBRARIES = \
  lib21_fts_squat_plugin.la

-lib21_fts_squat_plugin_la_LIBADD = \
- ../fts/lib20_fts_plugin.la
+# Apple can't link loadable modules against other loadable modules
+#lib21_fts_squat_plugin_la_LIBADD = \
+# ../fts/lib20_fts_plugin.la

  lib21_fts_squat_plugin_la_SOURCES = \
  fts-squat-plugin.c \

--- a/src/plugins/imap-acl/Makefile.am 2009-10-09 13:02:15.000000000  
-0500
+++ b/src/plugins/imap-acl/Makefile.am 2009-10-27 10:35:58.000000000  
-0500
@@ -14,8 +14,9 @@
  imap_module_LTLIBRARIES = \
  lib02_imap_acl_plugin.la

-lib02_imap_acl_plugin_la_LIBADD = \
- ../acl/lib01_acl_plugin.la
+# Apple can't link loadable modules against other loadable modules
+#lib02_imap_acl_plugin_la_LIBADD = \
+# ../acl/lib01_acl_plugin.la

  lib02_imap_acl_plugin_la_SOURCES = \
  imap-acl-plugin.c

--- a/src/plugins/imap-quota/Makefile.am 2009-10-09 13:02:15.000000000  
-0500
+++ b/src/plugins/imap-quota/Makefile.am 2009-10-27 10:35:58.000000000  
-0500
@@ -13,8 +13,9 @@
  imap_module_LTLIBRARIES = \
  lib11_imap_quota_plugin.la

-lib11_imap_quota_plugin_la_LIBADD = \
- ../quota/lib10_quota_plugin.la
+# Apple can't link loadable modules against other loadable modules
+#lib11_imap_quota_plugin_la_LIBADD = \
+# ../quota/lib10_quota_plugin.la

  lib11_imap_quota_plugin_la_SOURCES = \
  imap-quota-plugin.c

--- a/src/plugins/mail-log/Makefile.am 2009-10-09 13:02:15.000000000  
-0500
+++ b/src/plugins/mail-log/Makefile.am 2009-10-27 10:35:58.000000000  
-0500
@@ -13,8 +13,9 @@
  module_LTLIBRARIES = \
  lib20_mail_log_plugin.la

-lib20_mail_log_plugin_la_LIBADD = \
- ../notify/lib15_notify_plugin.la
+# Apple can't link loadable modules against other loadable modules
+#lib20_mail_log_plugin_la_LIBADD = \
+# ../notify/lib15_notify_plugin.la

  lib20_mail_log_plugin_la_SOURCES = \
  mail-log-plugin.c

--- a/src/plugins/trash/Makefile.am 2009-10-09 13:02:15.000000000 -0500
+++ b/src/plugins/trash/Makefile.am 2009-10-27 10:35:58.000000000 -0500
@@ -10,8 +10,9 @@
  module_LTLIBRARIES = \
  lib11_trash_plugin.la

-lib11_trash_plugin_la_LIBADD = \
- ../quota/lib10_quota_plugin.la
+# Apple can't link loadable modules against other loadable modules
+#lib11_trash_plugin_la_LIBADD = \
+# ../quota/lib10_quota_plugin.la

  lib11_trash_plugin_la_SOURCES = \
  trash-plugin.c


Third, for cross-compiling the value of WORDS_BIGENDIAN needs to be  
tested, not its presence:
--- a/src/lib-index/mail-transaction-log-file.c 2009-10-15  
21:26:13.000000000 -0500
+++ b/src/lib-index/mail-transaction-log-file.c 2009-10-27  
10:35:58.000000000 -0500
@@ -189,7 +189,7 @@
  hdr->hdr_size = sizeof(struct mail_transaction_log_header);
  hdr->indexid = log->index->indexid;
  hdr->create_stamp = ioloop_time;
-#ifndef WORDS_BIGENDIAN
+#if !WORDS_BIGENDIAN
  hdr->compat_flags |= MAIL_INDEX_COMPAT_LITTLE_ENDIAN;
  #endif

@@ -404,7 +404,7 @@
  /* we have compatibility flags */
  enum mail_index_header_compat_flags compat_flags = 0;

-#ifndef WORDS_BIGENDIAN
+#if !WORDS_BIGENDIAN
  compat_flags |= MAIL_INDEX_COMPAT_LITTLE_ENDIAN;
  #endif
  if (file->hdr.compat_flags != compat_flags) {


Re: dovecot-2.0.alpha2 doesn't compile on Mac OS X

by Timo Sirainen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Oct 27, 2009, at 12:06 PM, Mike Abbott wrote:

> Howdy, dovecot-2.0.alpha2 doesn't compile on Mac OS X.
>
> First, trivially, there's a typo in array.h:
> --- a/src/lib/array.h   2009-10-08 10:04:35.000000000 -0500
> +++ b/src/lib/array.h 2009-10-27 10:35:58.000000000 -0500
> @@ -72,7 +72,7 @@
>             (elem)++)
> #  define array_foreach_modifiable(array, elem) \
>        for (elem = ARRAY_TYPE_CAST_MODIFIABLE(array) \
> -                       buffer_get_modifiable_data((array)-
> >arr.buffer, NULL)) + \
> + buffer_get_modifiable_data((array)->arr.buffer, NULL) + \

Thanks, fixed. But why is your compiler taking that code path?

#if (defined(__STDC__) && __STDC_VERSION__ >= 199901L)

I think that should test that you're using C99 compiler, and gcc  
definitely is one. I'd think clang would also test success there.

> Second, Mac OS X can't link loadable modules against other loadable  
> modules (http://www.finkproject.org/doc/porting/porting.en.html#shared.lib-and-mod 
> ):

Again it seems to work in my Leopard + gcc. Or actually loading e.g.  
imap_quota without quota gives dlopen() error, but the compiling part  
works fine. It doesn't matter much that this happens, with OSes that  
support it it would have simply given a nicer error message:

Error: Can't load plugin imap_quota_plugin: Plugin quota must be  
loaded also

So are you saying that the compiling part also fails with you? What  
are you then doing differently? Anyway, if this needs to be disabled I  
guess I'll have to add a configure check for it. Any idea how that  
would work?

> Third, for cross-compiling the value of WORDS_BIGENDIAN needs to be  
> tested, not its presence:

Fixed.

Re: dovecot-2.0.alpha2 doesn't compile on Mac OS X

by Mike Abbott-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Thanks, fixed. But why is your compiler taking that code path?
>
> #if (defined(__STDC__) && __STDC_VERSION__ >= 199901L)

For whatever reason, __STDC_VERSION__ isn't defined.  __STDC__ is  
though.

>> Second, Mac OS X can't link loadable modules against other loadable  
>> modules (http://www.finkproject.org/doc/porting/porting.en.html#shared.lib-and-mod 
>> ):
>
> So are you saying that the compiling part also fails with you?

Yes:
/bin/sh ../../../libtool --tag=CC   --mode=link gcc  -Os -pipe -module  
-avoid-version  -o lib02_imap_acl_plugin.la -rpath /usr/lib/dovecot  
imap-acl-plugin.lo ../acl/lib01_acl_plugin.la

*** Warning: Linking the shared library lib02_imap_acl_plugin.la  
against the loadable module
*** lib01_acl_plugin.so is not portable!
libtool: link: gcc -Wl,-undefined -Wl,dynamic_lookup -o .libs/
lib02_imap_acl_plugin.so -bundle  .libs/imap-acl-plugin.o   ../
acl/.libs/lib01_acl_plugin.so
ld: in ../acl/.libs/lib01_acl_plugin.so, can't link with bundle  
(MH_BUNDLE) only dylibs (MH_DYLIB) for architecture i386
collect2: ld returned 1 exit status


Re: dovecot-2.0.alpha2 doesn't compile on Mac OS X

by Timo Sirainen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, 2009-10-27 at 13:13 -0500, Mike Abbott wrote:
> > Thanks, fixed. But why is your compiler taking that code path?
> >
> > #if (defined(__STDC__) && __STDC_VERSION__ >= 199901L)
>
> For whatever reason, __STDC_VERSION__ isn't defined.  __STDC__ is  
> though.

Sounds like gcc isn't being run in C99 mode for some reason. Are you
giving any special configure or CFLAGS options?

> libtool: link: gcc -Wl,-undefined -Wl,dynamic_lookup -o .libs/
> lib02_imap_acl_plugin.so -bundle  .libs/imap-acl-plugin.o   ../
> acl/.libs/lib01_acl_plugin.so
> ld: in ../acl/.libs/lib01_acl_plugin.so, can't link with bundle  
> (MH_BUNDLE) only dylibs (MH_DYLIB) for architecture i386
> collect2: ld returned 1 exit status

I guess there's something different in your setup than in regular OSX. I
just got a new macbook, installed Xcode and Dovecot 2.0.alpha2 tarball
compiled without any errors.

Although fdatasync() seems to have gone missing from .h files, but still
exists in libc. I guess that's intentional?


signature.asc (204 bytes) Download Attachment

Re: dovecot-2.0.alpha2 doesn't compile on Mac OS X

by Axel Luttgens-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Le 27 oct. 2009 à 20:21, Timo Sirainen a écrit :

> On Tue, 2009-10-27 at 13:13 -0500, Mike Abbott wrote:
>>
>> [...]
>
> [...]
>
> Although fdatasync() seems to have gone missing from .h files, but still
> exists in libc. I guess that's intentional?

Hello Timo,

Did Mike reply about that one?

Still the case here with Mac OS 10.6.2: although undefined in any include file, the symbol still exists in libSystem.B.dylib and allows compilation (even if with a warning related to an implicit definition).
On the other hand, the source code of xnu tends to be very circumspect wrt fdatasync().

TIA,
Axel



Re: dovecot-2.0.alpha2 doesn't compile on Mac OS X

by Timo Sirainen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, 2009-11-10 at 22:56 +0100, Axel Luttgens wrote:
> > Although fdatasync() seems to have gone missing from .h files, but still
> > exists in libc. I guess that's intentional?
>
> Hello Timo,
>
> Did Mike reply about that one?

No. I'm also not sure what to do about it. I guess I could just try if
compiler=gcc and compiling it fails with "$CC -Wall -Werror" and in that
case fallback to fsync.. Kind of ugly.


signature.asc (204 bytes) Download Attachment

Re: dovecot-2.0.alpha2 doesn't compile on Mac OS X

by Axel Luttgens-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Le 10 nov. 2009 à 23:44, Timo Sirainen a écrit :

> On Tue, 2009-11-10 at 22:56 +0100, Axel Luttgens wrote:
>>> Although fdatasync() seems to have gone missing from .h files, but still
>>> exists in libc. I guess that's intentional?
>>
>> Hello Timo,
>>
>> Did Mike reply about that one?
>
> No. I'm also not sure what to do about it.

I fear that fdatasync() is currently some kind of a ghost on Mac OS X; I've asked on the darwin-dev list, should someone have definitive information.


> I guess I could just try if
> compiler=gcc and compiling it fails with "$CC -Wall -Werror" and in that
> case fallback to fsync.. Kind of ugly.

On the other hand, autoconf et alii may come with their uglinesses as well. ;-)
Here, AC_SEARCH_LIBS seems to fall in the trap by defining a prototype for an existing yet very ambiguous symbol.
Looks like that AC_TRY_COMPILE could avoid the problem in that precise case.
Now, my knowledge about those matters nearing zero, I'm really *unable* to tell whether the latter would be safer under any circumstances...

HTH,
Axel