cyrusimap / cyrus-imapd

Cyrus IMAP is an email, contacts and calendar server
http://cyrusimap.org
Other
530 stars 145 forks source link

jmap/ical not fully disabled when compiling with no options #4072

Open robn opened 2 years ago

robn commented 2 years ago

Compiling with no options to configure fails to build:

In file included from imap/index.c:74:
imap/jmap_util.h:209:33: error: unknown type name ‘icalcomponent’
  209 | extern void jmap_alertid_encode(icalcomponent *valarm, struct buf *buf);
      |                                 ^~~~~~~~~~~~~
imap/jmap_util.h:237:41: error: unknown type name ‘icalcomponent’
  237 |                                         icalcomponent *oldical,
      |                                         ^~~~~~~~~~~~~
imap/jmap_util.h:238:41: error: unknown type name ‘icalcomponent’
  238 |                                         icalcomponent *newical);
      |                                         ^~~~~~~~~~~~~

Configure was:

$ configure
...
Cyrus Server configured components

   gssapi:             no
   autocreate:         no
   idled:              no
   httpd:              no
   kerberos V4:        no
   murder:             no
   nntpd:              no
   replication:        no
   sieve:              yes
   srs:                no
   calalarmd:          no
   jmap:               no
   objectstore:        no
   backup:             no
   com_err:            yes

External dependencies:
   ldap:               no
   openssl:            yes
   zlib:               yes
   jansson:            yes
   pcre:               yes
   clamav:             no
   -----------------------
   caringo:            no
   openio:             no
   -----------------------
   nghttp2:            no (httpd is not built)
   wslay:              no (httpd is not built)
   brotli:             no (httpd is not built)
   zstd:               no (httpd is not built)
   xml2:               no (httpd is not built)
   ical:               no (httpd is not built)
   shapelib:           no (httpd is not built)
   icu4c:              yes
   chardet:            no
   cld2:               no
   guesstz:            no

Database support:
   mysql:              no
   postgresql:         no
   sqlite:             no
   zeroskip:           no

Search engine:
   squat:              yes
   xapian:             no
   xapian_cjk_tokens:  none

Documentation dependencies:
   sphinx-build:       
   Pod::POM::View::Restructured:  no
   GitPython:          no

Installation directories:
   prefix:             /usr/local
   sysconfdir:         /etc

Build info:
   shared:             yes
   static:             no
   cflags:             -g -O2
   cxxflags:           -g -O2
   libs:                -ljansson    -lpcre -lpcreposix -lz
   ldflags:            
   unit tests (cunit): 
elliefm commented 2 years ago

I wonder if it's enough to wrap all of imap/jmap_util.h in #ifdef USE_HTTPD, or if the problem goes deeper than that

elliefm commented 2 years ago

It goes deeper. Here's what I get after doing that:

In file included from imap/caldav_util.h:51,
                 from imap/jmap_util.c:55:
imap/httpd.h:48:10: fatal error: libxml/tree.h: No such file or directory
 #include <libxml/tree.h>
          ^~~~~~~~~~~~~~~

Weird that we're trying to build imap/jmap_util.c when httpd is disabled. I guess it's probably listed in the wrong spot in the Makefile.am. Will keep digging...

elliefm commented 2 years ago

Much deeper...

imap/mboxevent.c: In function ‘threadid’:
imap/mboxevent.c:918:20: error: ‘JMAP_THREADID_SIZE’ undeclared (first use in this function); did you mean ‘SORT_THREADID’?
     static char id[JMAP_THREADID_SIZE];
                    ^~~~~~~~~~~~~~~~~~
                    SORT_THREADID
imap/mboxevent.c:918:20: note: each undeclared identifier is reported only once for each function it appears in
imap/mboxevent.c:924:9: warning: implicit declaration of function ‘jmap_set_threadid’ [-Wimplicit-function-declaration]
         jmap_set_threadid(cid, id);
         ^~~~~~~~~~~~~~~~~
imap/mboxevent.c: In function ‘jmap_email’:
imap/mboxevent.c:932:18: error: ‘JMAP_EMAILID_SIZE’ undeclared (first use in this function); did you mean ‘EVP_MAX_MD_SIZE’?
     char emailid[JMAP_EMAILID_SIZE];
                  ^~~~~~~~~~~~~~~~~
                  EVP_MAX_MD_SIZE
imap/mboxevent.c:934:5: warning: implicit declaration of function ‘jmap_set_emailid’; did you mean ‘jmap_email’? [-Wimplicit-function-declaration]
     jmap_set_emailid(guid, emailid);
     ^~~~~~~~~~~~~~~~
     jmap_email
imap/mboxevent.c:939:32: warning: implicit declaration of function ‘jmap_header_as_date’ [-Wimplicit-function-declaration]
                      "sentAt", jmap_header_as_date(body->date),
                                ^~~~~~~~~~~~~~~~~~~
imap/mboxevent.c:940:33: warning: implicit declaration of function ‘jmap_header_as_text’; did you mean ‘hash_iter_has_next’? [-Wimplicit-function-declaration]
                      "subject", jmap_header_as_text(body->subject),
                                 ^~~~~~~~~~~~~~~~~~~
                                 hash_iter_has_next
imap/mboxevent.c:942:22: warning: implicit declaration of function ‘jmap_emailaddresses_from_addr’ [-Wimplicit-function-declaration]
                      jmap_emailaddresses_from_addr(body->from,
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
imap/mboxevent.c:943:52: error: ‘HEADER_FORM_ADDRESSES’ undeclared (first use in this function)
                                                    HEADER_FORM_ADDRESSES),
                                                    ^~~~~~~~~~~~~~~~~~~~~
imap/mboxevent.c:960:22: warning: implicit declaration of function ‘jmap_header_as_messageids’; did you mean ‘message_get_messageid’? [-Wimplicit-function-declaration]
                      jmap_header_as_messageids(body->in_reply_to),
                      ^~~~~~~~~~~~~~~~~~~~~~~~~
                      message_get_messageid
imap/mboxevent.c: In function ‘mboxevent_extract_record’:
imap/mboxevent.c:1022:33: error: ‘JMAP_EMAILID_SIZE’ undeclared (first use in this function); did you mean ‘EVP_MAX_MD_SIZE’?
         char *emailid = xmalloc(JMAP_EMAILID_SIZE);
                                 ^~~~~~~~~~~~~~~~~
                                 EVP_MAX_MD_SIZE
imap/mboxevent.c: In function ‘mboxevent_extract_msgrecord’:
imap/mboxevent.c:1197:33: error: ‘JMAP_EMAILID_SIZE’ undeclared (first use in this function); did you mean ‘EVP_MAX_MD_SIZE’?
         char *emailid = xmalloc(JMAP_EMAILID_SIZE);
                                 ^~~~~~~~~~~~~~~~~
                                 EVP_MAX_MD_SIZE
elliefm commented 2 years ago

Ahh, mboxevent used to be an optional component, but hasn't been since 9bdf3b198b. And I guess mboxevent needs to do JMAP stuff now for whatever reason (scheduled send?), so if you configure without httpd/etc you end up with a mess.

We've been talking about making httpd/jmap non-optional for a while... maybe it's time to just do it.

Annoyingly, there's similar (but not identical) problems on 3.6. Which is weird, because I'm usually pretty careful about making sure an optionless build succeeds on the stable branches, but apparently I've been missing it.

Anyway I think the fix for this for master will be to make httpd/jmap mandatory, like we planned to anyway. Meanwhile, I'll see if I can concoct a separate set of fixes specially for 3.6.