Hi Giles, It sounds like we'll need to add some detection to configure.ac for working out when to link against librt.
Do you get the same problem with the master branch? It also has the idle timeout patch, so I'd expect the same problem -- unless master is already linking properly with librt, in which case I can yoink the configure fix from there :) As to the util.c/imapd.c disparity: the comment in util.c doesn't make clear the reasoning behind choosing to avoid librt, unfortunately. And I'm not really clear myself on what differences exist between the three types of time it mentions (I could read up on it, but haven't). It seems from that comment that if we're going to link against librt anyway, sclock() could be updated as it suggests -- but I don't know what ramifications that would have on code using sclock(). Conversely, if there's some good reason for continuing to avoid librt, maybe the idle timeout could be changed to use sclock() rather than clock_gettime(). I don't really have an informed opinion either way -- input would be appreciated. Cheers, ellie On Sat, Dec 3, 2016, at 03:18 AM, Giles Malet via Cyrus-devel wrote: > On the cyrus-imapd-2.5 branch (currently 3a53853) from > https://github.com/cyrusimap/cyrus-imapd, this commit: > > 865199d imapd.c: imapoptions: implement idle timeout > > introduces the use of clock_gettime() in imap/imapd.c. That means it > needs to be linked with -lrt, but that is not happening on my system. > > # cat /etc/redhat-release > Red Hat Enterprise Linux Server release 6.8 (Santiago) > # uname -a > Linux minos 2.6.32-642.6.2.el6.x86_64 #1 SMP Mon Oct 24 10:22:33 EDT > 2016 x86_64 x86_64 x86_64 GNU/Linux > > I use: > > # autoreconf -i > # ./configure --prefix=/usr --libdir=/usr/lib64 --with-libcap > --enable-sieve \ > --enable-idled --enable-murder \ > --enable-replication --with-service-path=/usr/lib/cyrus-imapd \ > --with-cyrus-prefix=/usr/lib/cyrus-imapd > > and end up with this: > > libtool: link: gcc -fPIC -g -O2 -o imap/.libs/imapd imap/imap_proxy.o > imap/imapd.o imap/mutex_fake.o imap/pushstats.o imap/proxy.o > master/service.o sieve/.libs/libcyrus_sieve.so > imap/.libs/libcyrus_imap.so -luuid > /usr/local/mailchk/src/cyrus/cyrus-imapd/lib/.libs/libcyrus_min.so > /usr/local/mailchk/src/cyrus/cyrus-imapd/lib/.libs/libcyrus.so -ljansson > lib/.libs/libcyrus.so lib/.libs/libcyrus_min.so -lsasl2 -lssl -lcrypto > -lwrap -lnsl -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lkrb5support > -ldb-4.7 -lz -lcap > imap/imapd.o: In function `deadline_exceeded': > /usr/local/mailchk/src/cyrus/cyrus-imapd/imap/imapd.c:2874: undefined > reference to `clock_gettime' > imap/imapd.o: In function `cmd_idle': > /usr/local/mailchk/src/cyrus/cyrus-imapd/imap/imapd.c:2905: undefined > reference to `clock_gettime' > collect2: ld returned 1 exit status > > > Interestingly, lib/util.c contains this comment: > > * [...] Would be more > * useful and sensible if it worked in system monotonic > * time using clock_gettime(CLOCK_MONOTONIC) but that > * would require linking with -lrt. > > and it continues without clock_gettime(). > > Is this something missing in the configure scripts? I'm not familiar with > them so don't know how to patch this. > > If the author of libs/util.c avoided using -lrt, should imapd.c too? Or > if imapd.c is introducing it, perhaps util.c could make use of it as > well. > > Anyone have any pointers? > > Thanks, > g