slusarz / dovecot-fts-flatcurve

Dovecot FTS Flatcurve plugin (Xapian)
https://slusarz.github.io/dovecot-fts-flatcurve/
GNU Lesser General Public License v2.1
38 stars 8 forks source link

remove use of .la files #59

Closed patrickdk77 closed 4 months ago

patrickdk77 commented 4 months ago

Is it possible to remove the usage of the .la files? The .la files are removed from the dovecot packages, even the -dev packages built by debian/ubuntu, so if anyone wishes to compile this package against it, they first have to custom compile dovecot, then build this package against that custom version.

patrickdk77 commented 4 months ago

I believe this is why I keep getting these errors when attempting to build against dovecot 2.3.21

fts-flatcurve-plugin.c: In function 'fts_flatcurve_mail_user_created': fts-flatcurve-plugin.c:161:9: warning: the address of 'error' will always evaluate as 'true' [-Waddress] 161 | if (fts_mail_user_init(user, &error) < 0) { | ^~ fts-flatcurve-plugin.c:161:13: error: too few arguments to function 'fts_mail_user_init' 161 | if (fts_mail_user_init(user, &error) < 0) { | ^~~~~~ In file included from fts-flatcurve-plugin.c:6: /usr/include/dovecot/fts-user.h:21:5: note: declared here 21 | int fts_mail_user_init(struct mail_user *user, bool initialize_libfts, | ^~~~~~

patrickdk77 commented 4 months ago

./configure --build=x86_64-linux-gnu --prefix=/usr --includedir=\${prefix}/include --mandir=\${prefix}/share/man --infodir=\${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --disable-option-checking --disable-silent-rules --libdir=\${prefix}/lib/x86_64-linux-gnu --runstatedir=/run --disable-maintainer-mode --disable-dependency-tracking --with-dovecot=/usr/lib/dovecot checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a race-free mkdir -p... /usr/bin/mkdir -p checking for gawk... no checking for mawk... mawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking whether UID '0' is supported by ustar format... yes checking whether GID '0' is supported by ustar format... yes checking how to create a ustar tar archive... gnutar checking whether to enable maintainer-specific portions of Makefiles... no checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether the compiler supports GNU C... yes checking whether gcc accepts -g... yes checking for gcc option to enable C11 features... none needed checking whether gcc understands -c and -o together... yes checking whether make supports the include directive... yes (GNU style) checking dependency style of gcc... none checking how to run the C preprocessor... gcc -E checking for g++... g++ checking whether the compiler supports GNU C++... yes checking whether g++ accepts -g... yes checking for g++ option to enable C++11 features... none needed checking dependency style of g++... none checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking how to print strings... printf checking for a sed that does not truncate output... /usr/bin/sed checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for fgrep... /usr/bin/grep -F checking for ld used by gcc... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B checking the name lister (/usr/bin/nm -B) interface... BSD nm checking whether ln -s works... yes checking the maximum length of command line arguments... 1572864 checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop checking for /usr/bin/ld option to reload object files... -r checking for file... file checking for objdump... objdump checking how to recognize dependent libraries... pass_all checking for dlltool... no checking how to associate runtime and link libraries... printf %s\n checking for ar... ar checking for archiver @FILE support... @ checking for strip... strip checking for ranlib... ranlib checking command to parse /usr/bin/nm -B output from gcc object... ok checking for sysroot... no checking for a working dd... /usr/bin/dd checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1 checking for mt... no checking if : is a manifest tool... no checking for stdio.h... yes checking for stdlib.h... yes checking for string.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for strings.h... yes checking for sys/stat.h... yes checking for sys/types.h... yes checking for unistd.h... yes checking for dlfcn.h... yes checking for objdir... .libs checking if gcc supports -fno-rtti -fno-exceptions... no checking for gcc option to produce PIC... -fPIC -DPIC checking if gcc PIC flag -fPIC -DPIC works... yes checking if gcc static flag -static works... yes checking if gcc supports -c -o file.o... yes checking if gcc supports -c -o file.o... (cached) yes checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes checking whether -lc should be explicitly linked in... no checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... yes checking how to run the C++ preprocessor... g++ -E checking for ld used by g++... /usr/bin/ld -m elf_x86_64 checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes checking for g++ option to produce PIC... -fPIC -DPIC checking if g++ PIC flag -fPIC -DPIC works... yes checking if g++ static flag -static works... yes checking if g++ supports -c -o file.o... yes checking if g++ supports -c -o file.o... (cached) yes checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes checking dynamic linker characteristics... (cached) GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking for pkg-config... /usr/bin/pkg-config checking pkg-config is at least version 0.9.0... yes checking whether C compiler handles -Werror -Wunknown-warning-option... no checking for "/usr/lib/dovecot/dovecot-config"... /usr/lib/dovecot/dovecot-config checking whether gcc is clang 3.3+... no checking Whether to enable hardening... yes checking whether C compiler handles -pie... yes checking whether C compiler handles -fstack-protector-strong... yes checking whether C compiler handles -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2... yes checking whether C compiler handles -mfunction-return=keep... yes checking whether C compiler handles -mindirect-branch=keep... yes checking for how to force completely read-only GOT table... -Wl,-z -Wl,relro -Wl,-z -Wl,now checking whether we want undefined behaviour sanitizer... no checking whether OS supports plugin dependencies... yes checking for valgrind... reject checking Whether to enable hardening... yes checking whether C compiler handles -pie... (cached) yes checking whether C compiler handles -fstack-protector-strong... (cached) yes checking whether C compiler handles -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2... (cached) yes checking whether C compiler handles -mfunction-return=keep... (cached) yes checking whether C compiler handles -mindirect-branch=keep... (cached) yes checking for how to force completely read-only GOT table... -Wl,-z -Wl,relro -Wl,-z -Wl,now checking whether we want undefined behaviour sanitizer... no checking for xapian-config... /usr/bin/xapian-config checking /usr/bin/xapian-config works... yes checking for fts_mail_user_init API version 2.3.17+... no checking that generated files are newer than configure... done configure: creating ./config.status config.status: creating Makefile config.status: creating src/Makefile config.status: creating stamp.h config.status: creating dummy-config.h config.status: creating fts-flatcurve-config.h config.status: executing depfiles commands config.status: executing libtool commands

patrickdk77 commented 4 months ago

onfigure:19381: checking for xapian-config configure:19404: found /usr/bin/xapian-config configure:19416: result: /usr/bin/xapian-config configure:19439: checking /usr/bin/xapian-config works -L/usr/lib/x86_64-linux-gnu -lxapian

configure:19443: result: yes configure:19486: checking for fts_mail_user_init API version 2.3.17+ configure:19517: gcc -c -std=gnu99 -std=gnu99 -g -O2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffile-prefix-map=/build/dovecot-fts-flatcurve/t/dovecot-fts-flatcurve-1.0.1=. -flto=auto -ffat-lto-objects -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -fdebug-prefix-map=/build/dovecot-fts-flatcurve/t/dovecot-fts-flatcurve-1.0.1=/usr/src/dovecot-fts-flatcurve-1.0.1-0~24.04a -Wall -W -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wformat=2 -Wbad-function-cast -fno-builtin-strftime -Wstrict-aliasing=2 -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -mfunction-return=keep -mindirect-branch=keep -Wall -W -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wformat=2 -Wbad-function-cast -fno-builtin-strftime -Wstrict-aliasing=2 -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -mfunction-return=keep -mindirect-branch=keep -Werror -DHAVE_CONFIG_H -I/usr/include/dovecot -Wdate-time -D_FORTIFY_SOURCE=3 conftest.c >&5

: error: "_FORTIFY_SOURCE" redefined [-Werror] : note: this is the location of the previous definition cc1: all warnings being treated as errors configure:19517: $? = 1 configure: failed program was: | /* confdefs.h */ | #define PACKAGE_NAME "Dovecot FTS Flatcurve" | #define PACKAGE_TARNAME "dovecot-fts-flatcurve" | #define PACKAGE_VERSION "1.0.0" | #define PACKAGE_STRING "Dovecot FTS Flatcurve 1.0.0" | #define PACKAGE_BUGREPORT "slusarz@curecanti.org" | #define PACKAGE_URL "" | #define FTS_FLATCURVE_NAME "Dovecot FTS Flatcurve" | #define FTS_FLATCURVE_VERSION "1.0.0" | #define HAVE_STDIO_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_UNISTD_H 1 | #define STDC_HEADERS 1 | #define HAVE_DLFCN_H 1 | #define LT_OBJDIR ".libs/" | #define XAPIAN_HAS_COMPACT 1 | /* end confdefs.h. */ | #undef PACKAGE_BUGREPORT | #undef PACKAGE_NAME | #undef PACKAGE_STRING | #undef PACKAGE_TARNAME | #undef PACKAGE_VERSION | #include "lib.h" | #include "mail-storage-hooks.h" | #include "fts-user.h" | int | main (void) | { | int (*ptr)(struct mail_user *, bool, const char **), i = 0; | ptr = fts_mail_user_init; | if (ptr && i) ++i; | ; | return 0; | } | configure:19528: result: no configure:19654: checking that generated files are newer than configure configure:19660: result: done configure:19699: creating ./config.status
slusarz commented 4 months ago

Not sure what .la files have to do with this ... Dovecot/plugins use "pkg-config" to determine dependencies these days.

It's definitely not going to work with flatcurve v1.0.1 if "checking for fts_mail_user_init API version 2.3.17+" test fails. So that's the core issue.

Not seeing any problems a base Debian (bookworm) install/configure. Using 'debian:bookworm-slim' container:

root@5180133a62a5:/tmp/flatcurve# history
    1  apt-get update && apt-get install -y dovecot-core dovecot-dev build-essential git libtool
    2  git clone https://github.com/slusarz/dovecot-fts-flatcurve.git /tmp/flatcurve && cd /tmp/flatcurve
    3  sh autogen.sh && ./configure --with-dovecot=/usr/lib/dovecot

I see:

checking for fts_mail_user_init API version 2.3.17+... yes

Log:

configure:19226: checking for fts_mail_user_init API version 2.3.17+ configure:19257: gcc -c -std=gnu99 -std=gnu99 -g -O2 -Wall -W -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wformat=2 -Wbad-function-cast -fno-builtin-strftime -Wstrict-aliasing=2 -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -mfunction-return=keep -mindirect-branch=keep -Wall -W -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wformat=2 -Wbad-function-cast -fno-builtin-strftime -Wstrict-aliasing=2 -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -mfunction-return=keep -mindirect-branch=keep -Werror -DHAVE_CONFIG_H -I/usr/include/dovecot conftest.c >&5

On your system, definitely looks like "-D_FORTIFY_SOURCE=3" is what is breaking that test (it would need a -U_FORTIFY_SOURCE=3 before that to work correctly). But doesn't seem to be a problem with stock Debian. So it feels like a local compilation issue.

patrickdk77 commented 4 months ago

The logs for that are generated from a ubuntu noble compile, I had tested some debian also, but when I was testing it out last month, I had tought it was the .la causing it to fail. I tried it some more and figured it was something to do with the fortify_source, but I am not adding or adjusting anything, just asking the launchpad ppa to compile it.

maybe the hardening option is causing issues?

!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS=hardening=+all

override_dh_auto_configure: dh_auto_configure -- --with-dovecot=/usr/lib/dovecot/

override_dh_auto_install: dh_auto_install --destdir=debian/tmp

%: dh $@

slusarz commented 4 months ago

If hardening options are breaking things, that sounds like a Debian bug. (Hardening options are troublesome in general, though. This is why we can't support selinux in Dovecot core, for example.)

But we really aren't doing anything complicated with the configure stuff. We are adding just enough to CFLAGS to find the important Dovecot libraries needed. Stuff like "FORTIFY_SOURCE" is unrelated to flatcurve itself and instead depends on the configuration environment.

If there is something simple that can be added to flatcurve libtool stuff to "fix" this, and doesn't break normal compilations, I'm open to it. But I don't see this as a flatcurve issue, or at least it hasn't been proven it is.

slusarz commented 4 months ago

Closing due to no activity.