Jan Engelhardt
2017-Nov-18 22:40 UTC
Dovecots header files not optimized for external plugins
Making third-party plugins for Dovecot is really hard and frustrating.
Using dovecot 2.2.33.2 and the following sources, the compile errors keep
coming. The use of g++ is mandated as the underlying backend this plugin
will access only has a C++ interface.
== Source 1
/* g++-7 -c a.cpp */
#include <byteswap.h>
#include <dovecot/lib.h>
#include <dovecot/auth-request.h>
#include <dovecot/passdb.h>
static enum passdb_result
authdb_mapi_logon(struct auth_request *rq, const char *password)
{
int x = dev_null_fd + bswap_16(1);
}
== Problems 1
/usr/include/dovecot/compat.h:45:4: error: #error uoff_t size not set
# error uoff_t size not set
== Source 2
/* g++-7 -DHAVE_CONFIG_H -c a.cpp */
#include "config.h" /* generated by my configure */
#include <byteswap.h>
#include <dovecot/lib.h>
#include <dovecot/auth-request.h>
#include <dovecot/passdb.h>
static enum passdb_result
authdb_mapi_logon(struct auth_request *rq, const char *password)
{
int x = dev_null_fd + bswap_16(1);
}
== Problems 2
In file included from /usr/include/bits/byteswap.h:35:0,
from /usr/include/byteswap.h:24,
from a.cpp:2:
/usr/include/dovecot/byteorder.h:32:24: error: expected unqualified-id before
?__extension__?
static inline uint16_t bswap_16(uint16_t in);
== Other problems
dovecot headers files are missing 'extern "C"' lines.
This means the linkage of symbols like dev_null_fd is not what it should be.
I can't use
extern "C" {
#include <dovecot/...>
}
either because then the standardy library headers that are included
by dovecot headers can easily start acting up too.
Timo Sirainen
2017-Nov-19 13:19 UTC
Dovecots header files not optimized for external plugins
On 19 Nov 2017, at 0.40, Jan Engelhardt <jengelh at inai.de> wrote:> > > Making third-party plugins for Dovecot is really hard and frustrating. > Using dovecot 2.2.33.2 and the following sources, the compile errors keep > coming. The use of g++ is mandated as the underlying backend this plugin > will access only has a C++ interface.See compile instructions for example here: https://dovecot.org/patches/2.2/imap-logout-plugin.c <https://dovecot.org/patches/2.2/imap-logout-plugin.c>> == Problems 2 > In file included from /usr/include/bits/byteswap.h:35:0, > from /usr/include/byteswap.h:24, > from a.cpp:2: > /usr/include/dovecot/byteorder.h:32:24: error: expected unqualified-id before ?__extension__? > static inline uint16_t bswap_16(uint16_t in);Try #undef bswap_16 (and others)? We have a patch pending that does these #undefs to fix compiling issue with uclibc-ng - maybe a similar problem.> == Other problems > dovecot headers files are missing 'extern "C"' lines. > This means the linkage of symbols like dev_null_fd is not what it should be. > I can't use > extern "C" { > #include <dovecot/...> > } > either because then the standardy library headers that are included > by dovecot headers can easily start acting up too.lucene-wrapper.cc seems to compile fine with this..
Jan Engelhardt
2017-Nov-19 14:34 UTC
Dovecots header files not optimized for external plugins
On Sunday 2017-11-19 14:19, Timo Sirainen wrote:> >See compile instructions for example here:?https://dovecot.org/patches/2.2/imap-logout-plugin.cMh, that -config script should really have been a pkgconfig .pc file. (I see it's not really a script, which is probably the reason it is not in /usr/bin.)> == Problems 2 > In file included from /usr/include/bits/byteswap.h:35:0, > ????????????????from /usr/include/byteswap.h:24, > ????????????????from a.cpp:2: > /usr/include/dovecot/byteorder.h:32:24: error: expected unqualified-id before > ?__extension__? > static inline uint16_t bswap_16(uint16_t in); > > >Try #undef bswap_16 (and others)? We have a patch pending that does these #undefs to fix >compiling issue with?uclibc-ng - maybe a similar problem.That is inside out. Why mess with libc? Why reimplement byteswapping functions at all? Why not at least prefix them e.g. dove_bswap to avoid nameclashes?
Seemingly Similar Threads
- Dovecots header files not optimized for external plugins
- Building dovecot 2.2.33.2 is broken with uclibc-ng
- Building dovecot 2.2.33.2 is broken with uclibc-ng
- [Bug 600] ULOG target does not support --log-uid
- [Bug 926] pam_session_close called as user or not at all