cyrusimap / cyrus-imapd

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

Build fails on Alpine Linux #3891

Open rickyrockrat opened 2 years ago

rickyrockrat commented 2 years ago

Version is V3.14 on X86_64. I develop and build a lot of software. I am using the release tarball 2.4.22 ./configure make

First issue (it's static, I don't know why gcc complains): cyrusdb_berkeley.c:463:12: error: conflicting types for 'gettid' 463 | static int gettid(struct txn mytid, DB_TXN tid, char *where) | ^~ In file included from /usr/include/db.h:29, from cyrusdb_berkeley.c:47: /usr/include/unistd.h:194:7: note: previous declaration of 'gettid' was here 194 | pid_t gettid(void); Fix: sed -i 's!gettid!cyrus_gettid!g' lib/cyrusdb_berkeley.c

Second issue (I think this is a combination of an Alpine Linux issue and an inexperienced Alpine Linux user, me): make[2]: Entering directory '/data/src/cyrus-imapd-2.4.22/perl/imap' "/usr/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- IMAP.bs blib/arch/auto/Cyrus/IMAP/IMAP.bs 644 cc -c -I../../lib -I../.. -I../../com_err/et -D_REENTRANT -D_GNU_SOURCE -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Os -fomit-frame-pointer -DVERSION=\"1.00\" -DXS_VERSION=\"1.00\" -fPIC "-I/usr/lib/perl5/core_perl/CORE" -DPERL_POLLUTE IMAP.c IMAP.xs:50:10: fatal error: EXTERN.h: No such file or directory 50 | #include "EXTERN.h" | ^~~~~~ compilation terminated.

Fix: apk add perl-dev

If nothing else this will help others trying to get it building on Alpine. Any pointers on openRC scripts to start it? Thanks.

dilyanpalauzov commented 2 years ago

Version 2.4 is really old. Recent versions do not have the file cyrus_berkeley.c. So the solution to the first problem is to use a more recent version.

elliefm commented 2 years ago

If you are using 2.4.22 from a release tarball you should be aware that it contains an unfixed security vulnerability (CVE-2021-33582). There is a fix on the cyrus-imapd-2.4 git branch, which we provide for existing 2.4 deployments who are unable to upgrade for whatever reason, but we are no longer able to provide release tarballs for 2.4.

If you are just looking at Cyrus for the first time (and are not supporting a legacy deployment), please use the current stable release, which is 3.4.3. Release notes and download links are here: https://www.cyrusimap.org/imap/download/release-notes/3.4/x/3.4.3.html

rickyrockrat commented 2 years ago

It is a legacy installation (existing mail clients), but I will see if I can deploy 3.4.3. Thanks. I attempted to build 3.4.3, but I cannot seem to find a lot of the dependencies for this version in alpine, and what I do build does not install a cyrus binary.

rickyrockrat commented 2 years ago

This is with Alpine 3.14 on x86_64. What libraries ( on any distro) do I need for the main cyrus binary to be built?

Ideally I would like to be able to run cyrus and to replicate from the legacy 2.4.12 cyrus-imapd that exists now.

Failing that, I will just build 2.4.

Cyrus Server configured components

   gssapi:             yes
   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:            

External dependencies:
   ldap:               no
   openssl:            yes
   zlib:               yes
   jansson:            yes
   pcre:               yes
   clamav:             no
   -----------------------
   caringo:            no
   openio:             no
   -----------------------
   nghttp2:            
   wslay:              
   brotli:             no
   zstd:               no
   xml2:               no
   ical:               no
   icu4c:              yes
   shapelib:           no
   chardet:            no
   cld2:               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:                -lgssapi -lkrb5 -lasn1 -lroken   -lcom_err -lresolv -lresolv -ljansson  -lresolv   -lpcre -lpcreposix -lz
   ldflags:            
   unit tests (cunit):
paulmenzel commented 1 year ago

The gettid error also happens with the 2.5 series, that means Cyrus IMAP 2.5.9, still listed as supported.

 sed -i 's!gettid!cyrus_gettid!g' lib/cyrusdb_berkeley.c

worked around the issue.

dilyanpalauzov commented 1 year ago

Berkeley Database troubles are very unlikely to get any attention by upstream developers. The reason is, that most current Cyrus IMAP versions do not use BDB, thus the problem exists only in ancient versions. The 2.5 being a supported versions more or less means, that once an error is found in most current software, which affects also the 2.5 branch, that correction might (or might not) be back-ported.

Irrespective of this, everybody is entitled to provide a patch.

Consider changing to a different database, and in addition deploying a more recent Cyrus IMAP version.

paulmenzel commented 1 year ago

It’d be great if you cleared that up on the release notes page, what Supported Product Series means then.

elliefm commented 1 year ago

Yeah, you're right, the release notes index page is very out of date -- thanks for calling attention to it. I've opened #4292 to get it updated.

dilyanpalauzov commented 1 year ago

The README.md in 3.0 and later state, that the 3.0 series and later still receive security updates, while version 3.4 is current.

Since 069797b8b58a (October 2021) README.md does not even mention the versions 2.4 and 2.5, but 2.5 does still receive changes.

In 2.4 and 2.5 README states “No further development work will progress on anything older than version 2.2. Versions 2.2 and 2.3 still receive security updates”.

It is not possible to describe how old versions are maintained, since for any such description there will be countless counter-examples from the practice. To adapt the counter-examples in the maintenance description one has to use words like “likely/might” etc, which will raise unjustified hopes. No text on the matter is better than misleading text.

The change in the documentation at https://github.com/cyrusimap/cyrus-imapd/pull/3594 from 2021 tries to provide more clarity, including back-ports, and write down, that each change must be reviewed, before being integrated. Ironically that PR was not reviewed yet.

There is just no logic to describe what changes are back ported, and what not. To your hypothetical question: “Who is in charge of backporting changes?”, the answer is — nobody. Version 3.4.0 was released in April 2021, in March 2021 the most current stable version was 3.2. Back porting fixes for memory leaks from the master to the 3.2 branch were in case of https://github.com/cyrusimap/cyrus-imapd/pull/3409 not done. In other cases back porting fixes, including memory leaks, is done. It is just not predictable what will be fixed and in which versions.