Re: Building on FreeBSD 14.4

Jeff Aitken via dovecot <[email protected]> Sun, 17 May 2026 22:22:12 -0400
Newsgroups gmane.mail.imap.dovecot
Message-ID <[email protected]>
Evening,

I ran into the same issue on FreeBSD-14.4.  I fixed it by manually removing the offending “-L/usr/local/lib” from the various “*_LIBS = “ definitions in src/auth/Makefile.  I had claude take a look and here’s what it reported:

⏺ Here's the summary of the problem and the fix:

  Root cause: In 2.4.4, am__append_8 was changed to include both $(LIBDOVECOT_LUA) (a .la file dep) and $(LUA_LIBS) (raw linker flags:
  -L/usr/local/lib -llua-5.4 -lm). This append goes into auth_libs, which is used verbatim in auth_DEPENDENCIES. GNU make treats
  everything in a target's prerequisite list as files to build — it handles -l<name> specially, but -L<path> is taken literally,
  causing "no rule to make target '-L/usr/local/lib'".                                                               

  Fix:
  1. Strip $(LUA_LIBS) from am__append_8 — leave only $(LIBDOVECOT_LUA) (the actual file dep)
  2. Add am__append_10 = $(LUA_LIBS), scoped to plugin mode only (AUTH_LUA_PLUGIN_TRUE && HAVE_LUA_TRUE) — in non-plugin mode,
  $(LUA_LIBS) is already covered by AUTH_LUA_LDADD
  3. Append $(am__append_10) to the five LDADD variables that need it
  
  To apply: patch src/auth/Makefile.in /path/to/patch-src-auth-Makefile.in



Here’s the patch I used that resulted in a clean build:

*** src/auth/Makefile.in.orig
--- src/auth/Makefile.in
***************
*** 107,111 ****
  @HAVE_LDAP_TRUE@@LDAP_PLUGIN_TRUE@am__append_6 = libauthdb_ldap.la
  @HAVE_LDAP_TRUE@@LDAP_PLUGIN_FALSE@am__append_7 = $(LIBDOVECOT_LDAP)
- @HAVE_LUA_TRUE@am__append_8 = $(LIBDOVECOT_LUA) $(LUA_LIBS)
  @AUTH_LUA_PLUGIN_TRUE@am__append_9 = libauthdb_lua.la
  subdir = src/auth
--- 107,112 ----
  @HAVE_LDAP_TRUE@@LDAP_PLUGIN_TRUE@am__append_6 = libauthdb_ldap.la
  @HAVE_LDAP_TRUE@@LDAP_PLUGIN_FALSE@am__append_7 = $(LIBDOVECOT_LDAP)
+ @HAVE_LUA_TRUE@am__append_8 = $(LIBDOVECOT_LUA)
+ @AUTH_LUA_PLUGIN_TRUE@@HAVE_LUA_TRUE@am__append_10 = $(LUA_LIBS)
  @AUTH_LUA_PLUGIN_TRUE@am__append_9 = libauthdb_lua.la
  subdir = src/auth
***************
*** 1119,1123 ****
        $(am__append_8)
  auth_CPPFLAGS = $(AM_CPPFLAGS) $(BINARY_CFLAGS)
! auth_LDADD = $(auth_libs) $(LIBDOVECOT) $(AUTH_LIBS) $(BINARY_LDFLAGS) $(AUTH_LUA_LDADD)
  auth_DEPENDENCIES = $(auth_libs) $(LIBDOVECOT_DEPS)
  auth_SOURCES = main.c $(auth_common_sources)
--- 1120,1124 ----
        $(am__append_8)
  auth_CPPFLAGS = $(AM_CPPFLAGS) $(BINARY_CFLAGS)
! auth_LDADD = $(auth_libs) $(LIBDOVECOT) $(AUTH_LIBS) $(BINARY_LDFLAGS) $(AUTH_LUA_LDADD) $(am__append_10)
  auth_DEPENDENCIES = $(auth_libs) $(LIBDOVECOT_DEPS)
  auth_SOURCES = main.c $(auth_common_sources)
***************
*** 1230,1234 ****
        test-main.c

! test_auth_LDADD = $(test_auth_ldadd_plugins) $(LIBDOVECOT) $(auth_libs) $(AUTH_LIBS)
  test_auth_DEPENDENCIES = $(test_auth_ldadd_plugins) $(pkglibexec_PROGRAMS) $(LIBDOVECOT_DEPS)
  test_mech_SOURCES = \
--- 1231,1235 ----
        test-main.c

! test_auth_LDADD = $(test_auth_ldadd_plugins) $(LIBDOVECOT) $(auth_libs) $(AUTH_LIBS) $(am__append_10)
  test_auth_DEPENDENCIES = $(test_auth_ldadd_plugins) $(pkglibexec_PROGRAMS) $(LIBDOVECOT_DEPS)
  test_mech_SOURCES = \
***************
*** 1238,1242 ****
        test-mech.c

! test_mech_LDADD = $(LIBDOVECOT) $(auth_libs) $(AUTH_LIBS)
  test_mech_DEPENDENCIES = $(pkglibexec_PROGRAMS) $(LIBDOVECOT_DEPS)
  test_auth_client_SOURCES = \
--- 1239,1243 ----
        test-mech.c

! test_mech_LDADD = $(LIBDOVECOT) $(auth_libs) $(AUTH_LIBS) $(am__append_10)
  test_mech_DEPENDENCIES = $(pkglibexec_PROGRAMS) $(LIBDOVECOT_DEPS)
  test_auth_client_SOURCES = \
***************
*** 1246,1250 ****
        test-auth-client.c

! test_auth_client_LDADD = $(LIBDOVECOT) $(auth_libs) $(AUTH_LIBS)
  test_auth_client_DEPENDENCIES = $(pkglibexec_PROGRAMS) $(LIBDOVECOT_DEPS)
  test_auth_master_SOURCES = \
--- 1247,1251 ----
        test-auth-client.c

! test_auth_client_LDADD = $(LIBDOVECOT) $(auth_libs) $(AUTH_LIBS) $(am__append_10)
  test_auth_client_DEPENDENCIES = $(pkglibexec_PROGRAMS) $(LIBDOVECOT_DEPS)
  test_auth_master_SOURCES = \
***************
*** 1255,1259 ****
        test-auth-master-server.c

! test_auth_master_LDADD = $(LIBDOVECOT) $(auth_libs) $(AUTH_LIBS)
  test_auth_master_DEPENDENCIES = $(pkglibexec_PROGRAMS) $(LIBDOVECOT_DEPS)
  all: all-am
--- 1256,1260 ----
        test-auth-master-server.c

! test_auth_master_LDADD = $(LIBDOVECOT) $(auth_libs) $(AUTH_LIBS) $(am__append_10)
  test_auth_master_DEPENDENCIES = $(pkglibexec_PROGRAMS) $(LIBDOVECOT_DEPS)
  all: all-am



I haven’t tested the binary yet, but at least it did successfully complete the build.

The right fix is to update src/auth/Makefile.am, but perhaps someone more familiar with this can take a look and confirm.


—Jeff


> On May 17, 2026, at 19:59, Frank Volf via dovecot <[email protected]> wrote:
> 
>   Hi,
> 
>   I'm trying to build dovecot-2.4.4 on FreeBSD 14.4 and I get a strange
>   error message.
> 
>   What I did is download and extract dovecot-2.4.4.tar.gz and then run
>   ./configure without any arguments.
>   After typing make the build started without any problems until this point:
> 
>     ....
>     Making all in auth
>       CC       test_auth_cache-auth-cache.o
>       CC       test_auth_cache-test-auth-cache.o
>       CC       auth-main.o
>       CC       auth-auth.o
>       CC       auth-auth-cache.o
>       CC       auth-auth-client-connection.o
>       CC       auth-auth-master-connection.o
>       CC       auth-auth-policy.o
>       CC       auth-auth-penalty.o
>       CC       auth-auth-request.o
>       CC       auth-auth-request-fields.o
>       CC       auth-auth-request-handler.o
>       CC       auth-auth-request-var-expand.o
>       CC       auth-auth-sasl-mech-apop.o
>       CC       auth-auth-sasl-mech-dovecot-token.o
>       CC       auth-auth-sasl-mech-oauth2.o
>       CC       auth-auth-sasl.o
>       CC       auth-auth-settings.o
>       CC       auth-auth-fields.o
>       CC       auth-auth-token.o
>       CC       auth-auth-worker-connection.o
>       CC       auth-auth-worker-server.o
>       CC       auth-db-oauth2.o
>       CC       auth-db-sql.o
>       CC       auth-db-passwd-file.o
>       CC       auth-passdb.o
>       CC       auth-passdb-blocking.o
>       CC       auth-passdb-bsdauth.o
>       CC       auth-passdb-cache.o
>       CC       auth-passdb-oauth2.o
>       CC       auth-passdb-passwd.o
>       CC       auth-passdb-passwd-file.o
>       CC       auth-passdb-pam.o
>       CC       auth-passdb-sql.o
>       CC       auth-passdb-static.o
>       CC       auth-userdb.o
>       CC       auth-userdb-blocking.o
>       CC       auth-userdb-passwd.o
>       CC       auth-userdb-passwd-file.o
>       CC       auth-userdb-prefetch.o
>       CC       auth-userdb-static.o
>       CC       auth-userdb-sql.o
>       CC       auth-db-ldap.o
>       CC       auth-db-ldap-sasl.o
>       CC       auth-db-ldap-settings.o
>       CC       auth-passdb-ldap.o
>       CC       auth-userdb-ldap.o
>       CC       auth-db-lua.o
>       CC       auth-passdb-lua.o
>       CC       auth-userdb-lua.o
>     make[3]: don't know how to make -L/usr/local/lib. Stop
> 
>     make[3]: stopped making "all" in /home/volf/dovecot-2.4.4/src/auth
>     *** Error code 1
> 
>   So, apparently make is confused and thinks that the compiler/linker
>   commandline option is an item to build.
>   I'm at loss how to solve this.
> 
>   I would appreciate it, if somebody could give me a hint how to solve this.
> 
>   Kind regards,
> 
>   Frank
> _______________________________________________
> dovecot mailing list -- [email protected]
> To unsubscribe send an email to [email protected]

_______________________________________________
dovecot mailing list -- [email protected]
To unsubscribe send an email to [email protected]