Bug 237361 - mail/exim: Fails to link with LMDB=on
Summary: mail/exim: Fails to link with LMDB=on
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Dima Panov
URL: https://people.freebsd.org/~tobik/log...
Keywords: needs-qa
Depends on:
Reported: 2019-04-18 14:15 UTC by Tobias Kortkamp
Modified: 2020-02-26 21:40 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (vsevolod)
koobs: merge-quarterly?

exim build log (72.02 KB, text/plain)
2019-04-23 07:05 UTC, Kubilay Kocak
no flags Details
mail-exim-verbose-build (825 bytes, patch)
2019-04-23 07:07 UTC, Kubilay Kocak
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Kortkamp freebsd_committer 2019-04-18 14:15:12 UTC
See the linked build log for more details.

cc -o exim
/usr/bin/ld: warning: cannot find entry symbol xport-dynamic; defaulting to 000000000805eed0
lookups/lookups.a(lmdb.o): In function `lmdb_open':
lmdb.c:(.text+0x4e): undefined reference to `mdb_env_create'
lmdb.c:(.text+0x76): undefined reference to `mdb_env_open'
lmdb.c:(.text+0xa2): undefined reference to `mdb_txn_begin'
lmdb.c:(.text+0xc5): undefined reference to `mdb_dbi_open'
lmdb.c:(.text+0xe8): undefined reference to `mdb_txn_abort'
lmdb.c:(.text+0xfb): undefined reference to `mdb_env_close'
lmdb.c:(.text+0x104): undefined reference to `mdb_strerror'
Comment 1 Tobias Kortkamp freebsd_committer 2019-04-18 14:22:41 UTC
Ports tree is at ports r499067.
Comment 2 Kubilay Kocak freebsd_committer freebsd_triage 2019-04-23 06:10:40 UTC
I can confirm reproduction on 120amd64 @ ports r499617 but the build is not verbose, which makes it difficult to isolate what the issue is. The build should be made verbose.

@Tobias Can you include the full build log as an attachment please

Note: The linker *warning* is spurious, but was resolved in bug 236426
Comment 3 Tobias Kortkamp freebsd_committer 2019-04-23 06:15:21 UTC
(In reply to Kubilay Kocak from comment #2)
> @Tobias Can you include the full build log as an attachment please

See the link in the URL field here instead.
Comment 4 Kubilay Kocak freebsd_committer freebsd_triage 2019-04-23 07:05:27 UTC
Created attachment 203909 [details]
exim build log

Using the method from exim docs to make the build verbose (see below), it appears that -llmdb is missing from CFLAGS or LDFLAGS:

cc -o exim  acl.o base64.o child.o crypt16.o daemon.o dbfn.o debug.o deliver.o  directory.o dns.o drtables.o enq.o exim.o expand.o filter.o  filtertest.o globals.o dkim.o dkim_transport.o hash.o  header.o host.o ip.o log.o lss.o match.o moan.o  os.o parse.o queue.o  rda.o readconf.o receive.o retry.o rewrite.o rfc2047.o  route.o search.o sieve.o smtp_in.o smtp_out.o spool_in.o spool_out.o  std-crypto.o store.o string.o tls.o tod.o transport.o tree.o verify.o  environment.o macro.o  lookups/lf_quote.o lookups/lf_check_file.o lookups/lf_sqlperform.o  local_scan.o perl.o malware.o mime.o regex.o spam.o spool_mbox.o  arc.o  bmi_spam.o  dane.o  dcc.o  dmarc.o  imap_utf7.o  spf.o  srs.o  utf8.o version.o  routers/routers.a transports/transports.a lookups/lookups.a  auths/auths.a pdkim/pdkim.a      -lpam -L/usr/local/lib        -fPIC -rdynamic -Wl,--export-dynamic -L/usr/local/lib -lidn       -Wl,-R/usr/local/lib/perl5/5.28/mach/CORE -pthread -Wl,-E  -fstack-protector-strong -L/usr/local/lib  -L/usr/local/lib/perl5/5.28/mach/CORE -lperl -lpthread -lm -lcrypt -lutil -L/usr/local/openssl/lib -lssl -lcrypto -L/usr/local/lib -Wl,-R/usr/local/lib -lpcre  -L/usr/local/lib

I'll attach a patch to make the build verbose, which should be committed along with the fix to this issue and MFH'd along with it

4.12 Output from "make"

The output produced by the make process for compile lines is often very
unreadable, because these lines can be very long. For this reason, the normal
output is suppressed by default, and instead output similar to that which
appears when compiling the 2.6 Linux kernel is generated: just a short line for
each module that is being compiled or linked. However, it is still possible to
get the full output, by calling make like this:

FULLECHO='' make -e

The value of FULLECHO defaults to "@", the flag character that suppresses
command reflection in make. When you ask for the full output, it is given in
addition to the short output.
Comment 5 Kubilay Kocak freebsd_committer freebsd_triage 2019-04-23 07:07:58 UTC
Created attachment 203910 [details]
Comment 6 andrew 2019-04-25 12:36:33 UTC
So this fails because after adding a sed command to add LMDB_LIBS to LOOKUP_LIBS, another conditional block in the makefile comments LOOKUP_LIBS out, likely unnecessarily, unless certain options are set:

SEDLIST+=	-e 's,^(LOOKUP_LIBS=),\# \1,' \
		-e 's,^(LOOKUP_INCLUDE=),\# \1,'

Adding LMDB to the list of options in the conditional makes the build work at least to the extent of compiling everything (did not test whether it runs).
Comment 7 Tobias Kortkamp freebsd_committer 2019-05-24 05:18:53 UTC
(In reply to andrew from comment #6)
Could you attach this as a patch please?