Bug 236426 - mail/exim: incorrect build flags cause spurious build warning
Summary: mail/exim: incorrect build flags cause spurious build warning
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Kubilay Kocak
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-09 18:46 UTC by Andrew "RhodiumToad" Gierth
Modified: 2019-05-24 09:42 UTC (History)
2 users (show)

See Also:
koobs: merge-quarterly+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew "RhodiumToad" Gierth 2019-03-09 18:46:13 UTC
mail/exim port Makefile has this:

EXIM_DYNAMIC_LDFLAGS=  -fPIC -rdynamic -export-dynamic

"-export-dynamic" should have been -Wl,-export-dynamic since it is a linker option. Without that, an error "cannot find entry point symbol xport_dynamic" is given on builds, and the only reason that plugin modules work is that the option is redundant with -rdynamic which apparently does the same thing.

Any of these should be ok:

EXIM_DYNAMIC_LDFLAGS=  -fPIC -rdynamic

or

EXIM_DYNAMIC_LDFLAGS=  -fPIC -Wl,-export-dynamic

or

EXIM_DYNAMIC_LDFLAGS=  -fPIC -rdynamic -Wl,-export-dynamic
Comment 1 Andrew "RhodiumToad" Gierth 2019-04-21 09:52:44 UTC
or indeed

EXIM_DYNAMIC_LDFLAGS=  -fPIC -rdynamic -Wl,--export-dynamic

which is what I've been using for a while in my local ports repo, to build the exim binaries I run.
Comment 2 Andrew "RhodiumToad" Gierth 2019-04-21 11:05:14 UTC
I have also tested that my exim build can correctly load plugins:

#include "local_scan.h"

int tstplugin(uschar **yield, int argc, uschar *argv[])
{
    log_write(0, LOG_MAIN, "tstplugin called with %d args", argc);
    *yield = string_copy(US("blah"));
    return OK; 
}

% exim -be
> ${dlfunc{/home/andrew/exim/plugin/plugin.so}{tstplugin}{a}{b}}
2019-04-21 10:43:39.558 +0000 [77114] tstplugin called with 2 args
blah
> ^D
Comment 3 Kubilay Kocak freebsd_committer freebsd_triage 2019-04-21 12:16:08 UTC
Approved by: portmgr (maintainer timeout: ~6 weeks)
Comment 4 Kubilay Kocak freebsd_committer freebsd_triage 2019-04-21 12:16:26 UTC
@Andrew Thank you for the additional testing and confirmation
Comment 5 commit-hook freebsd_committer freebsd_triage 2019-04-21 12:27:08 UTC
A commit references this bug:

Author: koobs
Date: Sun Apr 21 12:27:02 UTC 2019
New revision: 499536
URL: https://svnweb.freebsd.org/changeset/ports/499536

Log:
  mail/exim: Fix build (linker) flags

  "-export-dynamic" in EXIM_DYNAMIC_LDFLAGS is a linker option, currently
  producing a warning during build:

  /usr/bin/ld: warning: cannot find entry symbol xport-dynamic; defaulting to 00000000004019c0

  The only reason that plugin modules work is that the option is redundant
  with -rdynamic.

  This change makes the minimum necessary change not relying on linker
  argument compatibility (- vs --).

  PR:		236426
  Submitted by:	<andrew tao11 riddles org uk>
  Approved by:	portmgr (maintainer timeout: ~6 weeks, "just fix it")
  MFH:		2019Q2

Changes:
  head/mail/exim/Makefile
Comment 6 commit-hook freebsd_committer freebsd_triage 2019-05-24 09:42:12 UTC
A commit references this bug:

Author: koobs
Date: Fri May 24 09:41:20 UTC 2019
New revision: 502438
URL: https://svnweb.freebsd.org/changeset/ports/502438

Log:
  MFH: mail/exim: r499265 r499536

  mail/exim: Rename LMDB_LIBS to _LMDB_LIBS

  It otherwise looks like an options helper that appears after
  bsd.port.options.mk which will be flagged as a DEV_ERROR after
  D19553.  Rename LMDB_INCLUDES too for consistency.

  mail/exim: Fix build (linker) flags

  "-export-dynamic" in EXIM_DYNAMIC_LDFLAGS is a linker option, currently
  producing a warning during build:

  /usr/bin/ld: warning: cannot find entry symbol xport-dynamic; defaulting to 00000000004019c0

  The only reason that plugin modules work is that the option is redundant
  with -rdynamic.

  This change makes the minimum necessary change not relying on linker
  argument compatibility (- vs --).

  PR:		236426
  Submitted by:	<andrew tao11 riddles org uk>
  Approved by:	portmgr (maintainer timeout: ~6 weeks, "just fix it")

  Approved by:	ports-secteam (blanket: port bug(s))

Changes:
_U  branches/2019Q2/
  branches/2019Q2/mail/exim/Makefile