Bug 257162 - net-mgmt/mk-livestatus: ld: error: duplicate symbol: g_mainthread_id
Summary: net-mgmt/mk-livestatus: ld: error: duplicate symbol: g_mainthread_id
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Vinícius Zavam
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-07-13 19:20 UTC by Dan Langille
Modified: 2022-01-20 14:52 UTC (History)
1 user (show)

See Also:
egypcio: maintainer-feedback+


Attachments
Fix building with clang 11 ("ld: error: duplicate symbol: g_mainthread_id") (1.64 KB, patch)
2021-10-17 07:45 UTC, Vinícius Zavam
egypcio: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Langille freebsd_committer freebsd_triage 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:

https://services.unixathome.org/poudriere/data/13amd64-dvl-git/2021-07-13_17h53m17s/logs/errors/mk-livestatus-1.2.8p25_2.log


I also see pkg fallout here

pkg-fallout:

https://lists.freebsd.org/archives/freebsd-pkg-fallout/2021-July/050399.html
Comment 1 Vinícius Zavam freebsd_committer freebsd_triage 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 freebsd_triage 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 freebsd_triage 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 freebsd_triage 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(-)
Comment 5 peo 2022-01-20 14:52:50 UTC
Same error with 12.3-STABLE and cland 12.

changing
.if ${OSVERSION} >= 1300000
to
.if ${OSVERSION} >= 1200000

fixes it. Perhaps update the patch?