From f0fb968346dea9bbe8ff3872b9ade5e3a88f4e18 Mon Sep 17 00:00:00 2001 From: "Daniel F. Dickinson" Date: Thu, 16 Aug 2018 03:32:50 -0400 Subject: [PATCH 1/2] dovecot: Fix managesieve-login needs libdovecot-login When trying to use managesieve my MUA complained sieve wasn't supported. On investigation dovecot logs the following could be seen: Aug 16 00:28:44 managesieve-login: Fatal: master: service(managesieve-login): child 1430 returned error 127 Aug 16 00:31:32 managesieve-login: Error: Error loading shared library libdovecot-login.so.0: No such file or directory (needed by /usr/lib/dovecot/managesieve-login) Aug 16 00:31:32 managesieve-login: Error: Error loading shared library libdovecot.so.0: No such file or directory (needed by /usr/lib/dovecot/managesieve-login) Aug 16 00:31:32 managesieve-login: Error: Error relocating /usr/lib/dovecot/managesieve-login: net_ip2addr: symbol not found The issue (verified with readelf on non-working build and build with my fix) is that there is no RPATH information in the pigeonhole binaries (like managesieve-login). The dovecot-config that is 'installed' in the staging dir assumes that plugins will be built on the same host as the installed files. The 'installed' dovecot-config (partial) looks like: LIBDOVECOT='-L/usr/lib/dovecot -ldovecot' LIBDOVECOT_LOGIN='-ldovecot-login -L/home/user/Build/openwrt/openwrt-ath79/staging_dir/target-mips_24kc_musl/usr/lib -lssl -lcrypto' LIBDOVECOT_SQL=-ldovecot-sql LIBDOVECOT_COMPRESS=-ldovecot-compression LIBDOVECOT_LDA=-ldovecot-lda LIBDOVECOT_STORAGE='-ldovecot-storage ' LIBDOVECOT_DSYNC=-ldovecot-dsync LIBDOVECOT_LIBFTS=-ldovecot-fts The solution I used was to modify dovecot-config to add the rpath to DOVECOT_BINARY_LDFLAGS, and to replace references to host directories with staging_dir directories. This results in RPATH being added as it needs to be, and results in a working version of dovecot+pigeonhole. NB: I've also touched package version of pigeonhole as this change in dovecot results in (needed) binary changes for pigeonhole. Signed-off-by: Daniel F. Dickinson --- mail/dovecot/Makefile | 2 +- ...fix-dovecot-config-for-cross-compile.patch | 58 +++++++++++++++++++ mail/pigeonhole/Makefile | 2 +- 3 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 mail/dovecot/patches/050-fix-dovecot-config-for-cross-compile.patch diff --git a/mail/dovecot/Makefile b/mail/dovecot/Makefile index 33d77caa31..3b06d98c7f 100644 --- a/mail/dovecot/Makefile +++ b/mail/dovecot/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=dovecot PKG_VERSION:=2.3.2.1 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://www.dovecot.org/releases/2.3 diff --git a/mail/dovecot/patches/050-fix-dovecot-config-for-cross-compile.patch b/mail/dovecot/patches/050-fix-dovecot-config-for-cross-compile.patch new file mode 100644 index 0000000000..6c0bc743db --- /dev/null +++ b/mail/dovecot/patches/050-fix-dovecot-config-for-cross-compile.patch @@ -0,0 +1,58 @@ +pigeonhole: Fix managesieve-login needs libdovecot-login + +When trying to use managesieve my MUA complained sieve wasn't supported. +On investigation dovecot logs the following could be seen: + + Aug 16 00:28:44 managesieve-login: Fatal: master: + service(managesieve-login): child 1430 returned error 127 + Aug 16 00:31:32 managesieve-login: Error: Error loading shared + library libdovecot-login.so.0: No such file or directory + (needed by /usr/lib/dovecot/managesieve-login) + Aug 16 00:31:32 managesieve-login: Error: Error loading + shared library libdovecot.so.0: No such file or directory + (needed by /usr/lib/dovecot/managesieve-login) + Aug 16 00:31:32 managesieve-login: Error: Error relocating + /usr/lib/dovecot/managesieve-login: net_ip2addr: symbol not found + +The issue (verified with readelf on non-working build and build with my fix) +is that there is no RPATH information in the pigeonhole binaries (like +managesieve-login). + +The dovecot-config that is 'installed' in the staging dir +assumes that plugins will be built on the same host as the installed files. +The 'installed' dovecot-config (partial) looks like: + +LIBDOVECOT='-L/usr/lib/dovecot -ldovecot' +LIBDOVECOT_LOGIN='-ldovecot-login -L/home/user/Build/openwrt/openwrt-ath79/staging_dir/target-mips_24kc_musl/usr/lib -lssl -lcrypto' +LIBDOVECOT_SQL=-ldovecot-sql +LIBDOVECOT_COMPRESS=-ldovecot-compression +LIBDOVECOT_LDA=-ldovecot-lda +LIBDOVECOT_STORAGE='-ldovecot-storage ' +LIBDOVECOT_DSYNC=-ldovecot-dsync +LIBDOVECOT_LIBFTS=-ldovecot-fts + +This patch modifed dovecot-config that gets installed on the assumption +that users of libdovecot will also be cross-compiled (a safe bet). +Index: dovecot-2.3.2.1/Makefile.am +=================================================================== +--- dovecot-2.3.2.1.orig/Makefile.am ++++ dovecot-2.3.2.1/Makefile.am +@@ -73,7 +73,7 @@ install-exec-hook: + grep -v '^LIBDOVECOT_.*_INCLUDE' dovecot-config | \ + grep -v '^LIBDOVECOT.*_DEPS' | sed \ + -e "s|^\(DOVECOT_INSTALLED\)=.*$$|\1=yes|" \ +- -e "s|^\(LIBDOVECOT\)=.*$$|\1='-L$(pkglibdir) -ldovecot'|" \ ++ -e "s|^\(LIBDOVECOT\)=.*$$|\1='-L$(STAGING_DIR)$(pkglibdir) -ldovecot'|" \ + -e "s|^\(LIBDOVECOT_LOGIN\)=.*$$|\1='-ldovecot-login $(SSL_LIBS)'|" \ + -e "s|^\(LIBDOVECOT_SQL\)=.*$$|\1=-ldovecot-sql|" \ + -e "s|^\(LIBDOVECOT_COMPRESS\)=.*$$|\1=-ldovecot-compression|" \ +@@ -81,7 +81,8 @@ install-exec-hook: + -e "s|^\(LIBDOVECOT_LDA\)=.*$$|\1=-ldovecot-lda|" \ + -e "s|^\(LIBDOVECOT_LIBFTS\)=.*$$|\1=-ldovecot-fts|" \ + -e "s|^\(LIBDOVECOT_STORAGE\)=.*$$|\1='-ldovecot-storage $(LINKED_STORAGE_LDADD)'|" \ +- -e "s|^\(LIBDOVECOT_INCLUDE\)=.*$$|\1=-I$(pkgincludedir)|" \ ++ -e "s|^\(LIBDOVECOT_INCLUDE\)=.*$$|\1=-I$(STAGING_DIR)$(pkgincludedir)|" \ ++ -e "s|^\(DOVECOT_BINARY_LDFLAGS=\".*\)\"$$|\1 -Wl,-rpath -Wl,$(pkglibdir)\"|" \ + > $(DESTDIR)$(pkglibdir)/dovecot-config + + uninstall-hook: diff --git a/mail/pigeonhole/Makefile b/mail/pigeonhole/Makefile index e7418c595e..6772b9a677 100644 --- a/mail/pigeonhole/Makefile +++ b/mail/pigeonhole/Makefile @@ -11,7 +11,7 @@ PKG_NAME:=dovecot-pigeonhole PKG_VERSION_PLUGIN:=0.5.2 PKG_VERSION_DOVECOT:=$(shell make --no-print-directory -C ../dovecot/ val.PKG_VERSION V=s) PKG_VERSION:=$(PKG_VERSION_DOVECOT)-$(PKG_VERSION_PLUGIN) -PKG_RELEASE:=3 +PKG_RELEASE:=4 DOVECOT_VERSION:=2.3 From 2b7531ad9fa767fdcbf1b7d1e9a02a56678bdbea Mon Sep 17 00:00:00 2001 From: "Daniel F. Dickinson" Date: Thu, 16 Aug 2018 18:11:42 -0400 Subject: [PATCH 2/2] doveco: pigeonhole: Use stock dovecot dir locations We move dovecot libexec binaries and modules (including the package pigeonhole) to their standard locations. This is okay for libexec because it was added to core prior to 17.04 release. Moving the binaries normally in libexec eliminates the reason the modules were in an unusual directory, which is that there were conflicts with libexec binaries that were in lib, which the modules normally use. Signed-off-by: Daniel F. Dickinson --- mail/dovecot/Makefile | 4 +++- mail/pigeonhole/Makefile | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/mail/dovecot/Makefile b/mail/dovecot/Makefile index 3b06d98c7f..17bccd1b22 100644 --- a/mail/dovecot/Makefile +++ b/mail/dovecot/Makefile @@ -98,8 +98,8 @@ define Package/dovecot-utils endef CONFIGURE_ARGS += \ + --libexecdir=/usr/libexec \ --without-pam \ - --with-moduledir=/usr/lib/dovecot/modules \ --with-notify=dnotify \ --without-lzma \ --without-lz4 \ @@ -137,10 +137,12 @@ define Package/dovecot/install $(1)/etc/dovecot \ $(1)/usr/share/doc/dovecot \ $(1)/usr/lib/dovecot \ + $(1)/usr/libexec/dovecot \ $(1)/usr/bin \ $(1)/usr/sbin $(CP) $(PKG_INSTALL_DIR)/etc/dovecot/* $(1)/etc/dovecot/ $(CP) $(PKG_INSTALL_DIR)/usr/lib/dovecot/* $(1)/usr/lib/dovecot/ + $(CP) $(PKG_INSTALL_DIR)/usr/libexec/dovecot/* $(1)/usr/libexec/dovecot/ $(CP) $(PKG_INSTALL_DIR)/usr/share/doc/dovecot/example-config $(1)/usr/share/doc/dovecot/ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/doveconf $(1)/usr/bin/ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin/ diff --git a/mail/pigeonhole/Makefile b/mail/pigeonhole/Makefile index 6772b9a677..9956483e32 100644 --- a/mail/pigeonhole/Makefile +++ b/mail/pigeonhole/Makefile @@ -50,9 +50,10 @@ CONFIGURE_VARS += \ CPPFLAGS="$(TARGET_CPPFLAGS) -I$(STAGING_DIR)/usr/include/dovecot/" define Package/dovecot-pigeonhole/install - $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/dovecot/ + $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/dovecot/ $(1)/usr/libexec/dovecot/ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/ $(CP) $(PKG_INSTALL_DIR)/usr/lib/dovecot/* $(1)/usr/lib/dovecot/ + $(CP) $(PKG_INSTALL_DIR)/usr/libexec/dovecot/* $(1)/usr/libexec/dovecot/ find $(1)/usr/lib/dovecot/ -name "*.a" -o -name "*.la" | xargs rm endef