Bug 257162

Summary: net-mgmt/mk-livestatus: ld: error: duplicate symbol: g_mainthread_id
Product: Ports & Packages Reporter: Dan Langille <dvl>
Component: Individual Port(s)Assignee: Vinícius Zavam <egypcio>
Status: Closed FIXED    
Severity: Affects Only Me Flags: egypcio: maintainer-feedback+
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Description Flags
Fix building with clang 11 ("ld: error: duplicate symbol: g_mainthread_id") egypcio: maintainer-approval+

Description Dan Langille freebsd_committer 2021-07-13 19:20:04 UTC
I am getting this build failure for mk-livestatus-1.2.8p25 on FreeBSD 13 and 12.2:

--- livestatus.so ---
ranlib livestatus.so
--- livestatus.o ---
c++: warning: argument unused during compilation: '-static-libstdc++' [-Wunused-command-line-argument]
ld: error: duplicate symbol: g_mainthread_id

The 13.x build details are at:


I also see pkg fallout here


Comment 1 Vinícius Zavam freebsd_committer 2021-08-12 18:08:56 UTC
ACK. thanks for sharing! I shall also update this port to a newer version
Comment 2 Vinícius Zavam freebsd_committer 2021-09-30 15:02:33 UTC
I'm having issues to bring this one up to date. would report it back ASAP -- must rebuild my local poudriere-testing-env.

should any1 be able to get it before me, I give the blessing.
Comment 3 Vinícius Zavam freebsd_committer 2021-10-17 07:45:13 UTC
Created attachment 228774 [details]
Fix building with clang 11 ("ld: error: duplicate symbol: g_mainthread_id")

hello there! truly sorry about such a long time on the line to patch this one; good news is that we came up with a fix :)

as adopted by other ports, like:

  - net-mgmt/argus3;
  - net-mgmt/argus3-clients;
  - net-mgmt/bandwidthd;
  - and others ...

we now use CFLAGS with -fcommon to workaround it.

soon should the patch land in tree!
Comment 4 commit-hook freebsd_committer 2021-10-17 08:00:21 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=b1fe2ae52311869265eb74a9940a1dd502bd1e74

commit b1fe2ae52311869265eb74a9940a1dd502bd1e74
Author:     Vinícius Zavam <egypcio@FreeBSD.org>
AuthorDate: 2021-10-17 07:53:55 +0000
Commit:     Vinícius Zavam <egypcio@FreeBSD.org>
CommitDate: 2021-10-17 07:53:55 +0000

    net-mgmt/mk-livestatus: fix "ld: error: duplicate symbol: g_mainthread_id"

      - add '-fcommon' to our CFLAGS in order to build with clang 11;
      - fix used by other ports as well (mentioned a few on original PR);
      - this is applied in a conditional way, checking OSVERSION;
      - while here, also added new DISTSITES.

    Reported by:    dvl@, pkg-fallout
    PR:             257162

 net-mgmt/mk-livestatus/Makefile | 18 ++++++++++++------
 net-mgmt/mk-livestatus/distinfo |  2 +-
 2 files changed, 13 insertions(+), 7 deletions(-)