Bug 268178 - lang/tcl8[5-7]: fix build with clang/lld 15
Summary: lang/tcl8[5-7]: fix build with clang/lld 15
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: freebsd-tcltk (Nobody)
URL:
Keywords:
Depends on:
Blocks: 265425
  Show dependency treegraph
 
Reported: 2022-12-05 18:25 UTC by Dimitry Andric
Modified: 2022-12-06 08:58 UTC (History)
1 user (show)

See Also:


Attachments
lang/tcl8[5-7]: fix build with clang/lld 15 (5.31 KB, patch)
2022-12-05 18:29 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer freebsd_triage 2022-12-05 18:25:23 UTC
During an exp-run for llvm 15 (see bug 265425), it turned out that lang/tcl86 failed to build with clang (and lld) 15:

...
cc -O2 -O2 -pipe  -fstack-protector-strong -fno-strict-aliasing  -pipe   -fstack-protector-strong  -Wl,--export-dynamic -shared -o libtcl86.so.1 regcomp.o regexec.o regfree.o regerror.o tclAlloc.o  tclAssembly.o tclAsync
.o tclBasic.o tclBinary.o tclCkalloc.o  tclClock.o tclCmdAH.o tclCmdIL.o tclCmdMZ.o  tclCompCmds.o tclCompCmdsGR.o tclCompCmdsSZ.o tclCompExpr.o  tclCompile.o tclConfig.o tclDate.o tclDictObj.o tclDisassemble.o  tclEncod
ing.o tclEnsemble.o  tclEnv.o tclEvent.o tclExecute.o tclFCmd.o tclFileName.o tclGet.o  tclHash.o tclHistory.o tclIndexObj.o tclInterp.o tclIO.o tclIOCmd.o  tclIORChan.o tclIORTrans.o tclIOGT.o tclIOSock.o tclIOUtil.o  t
clLink.o tclListObj.o  tclLiteral.o tclLoad.o tclMain.o tclNamesp.o tclNotify.o  tclObj.o tclOptimize.o tclPanic.o tclParse.o tclPathObj.o tclPipe.o  tclPkg.o tclPkgConfig.o tclPosixStr.o  tclPreserve.o tclProc.o tclRege
xp.o  tclResolve.o tclResult.o tclScan.o tclStringObj.o  tclStrToD.o tclThread.o  tclThreadAlloc.o tclThreadJoin.o tclThreadStorage.o tclStubInit.o  tclTimer.o tclTrace.o tclUtf.o tclUtil.o tclVar.o tclZlib.o  tclTomMath
Interface.o tclUnixChan.o tclUnixEvent.o tclUnixFCmd.o  tclUnixFile.o tclUnixPipe.o tclUnixSock.o  tclUnixTime.o tclUnixInit.o tclUnixThrd.o  tclUnixCompat.o tclUnixNotfy.o   tclOO.o tclOOBasic.o tclOOCall.o tclOODefineC
mds.o tclOOInfo.o  tclOOMethod.o tclOOStubInit.o tclLoadDl.o bn_s_mp_reverse.o bn_s_mp_mul_digs_fast.o  bn_s_mp_sqr_fast.o bn_mp_add.o bn_mp_and.o  bn_mp_add_d.o bn_mp_clamp.o bn_mp_clear.o bn_mp_clear_multi.o  bn_mp_cmp
.o bn_mp_cmp_d.o bn_mp_cmp_mag.o  bn_mp_cnt_lsb.o bn_mp_copy.o  bn_mp_count_bits.o bn_mp_div.o bn_mp_div_d.o bn_mp_div_2.o  bn_mp_div_2d.o bn_mp_div_3.o bn_mp_exch.o bn_mp_expt_u32.o  bn_mp_grow.o bn_mp_init.o  bn_mp_ini
t_copy.o bn_mp_init_multi.o bn_mp_init_set.o  bn_mp_init_size.o bn_s_mp_karatsuba_mul.o  bn_s_mp_karatsuba_sqr.o bn_s_mp_balance_mul.o  bn_mp_lshd.o bn_mp_mod.o bn_mp_mod_2d.o bn_mp_mul.o bn_mp_mul_2.o  bn_mp_mul_2d.o bn
_mp_mul_d.o bn_mp_neg.o bn_mp_or.o  bn_mp_radix_size.o bn_mp_radix_smap.o  bn_mp_read_radix.o bn_mp_rshd.o bn_mp_set.o  bn_mp_shrink.o  bn_mp_sqr.o bn_mp_sqrt.o bn_mp_sub.o bn_mp_sub_d.o  bn_mp_signed_rsh.o  bn_mp_to_ubi
n.o  bn_s_mp_toom_mul.o bn_s_mp_toom_sqr.o bn_mp_to_radix.o  bn_mp_ubin_size.o bn_mp_xor.o bn_mp_zero.o bn_s_mp_add.o  bn_s_mp_mul_digs.o bn_s_mp_sqr.o bn_s_mp_sub.o tclDTrace.o   -fstack-protector-strong  -Wl,--export-d
ynamic -ldl -lz -lpthread -lm -Wl,-soname,libtcl86.so.1   "-Wl,-rpath,/usr/local/lib"
ld: error: duplicate symbol: __dtrace_tcl___obj__create
>>> defined in tclAssembly.o
>>> defined in tclBasic.o

ld: error: duplicate symbol: __dtrace_tcl___obj__create
>>> defined in tclAssembly.o
>>> defined in tclCmdMZ.o

ld: error: duplicate symbol: __dtrace_tcl___obj__free
>>> defined in tclBasic.o
>>> defined in tclCmdMZ.o
... more of those...

This is similar to the problem reported for lang/perl5.* in bug 265516, i.e. the DTrace-related postprocessing of object files messes up the symbols in such a way that there are multiple definitions.

And similarly to the perl5.x workaround, I propose adding -Wl,-z,muldefs to LDFLAGS, to silence the linker errors.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2022-12-05 18:29:16 UTC
Created attachment 238549 [details]
lang/tcl8[5-7]: fix build with clang/lld 15
Comment 2 Pietro Cerutti freebsd_committer freebsd_triage 2022-12-06 08:58:15 UTC
Thanks, I left tcl85 alone: it doesn't come with dtrace support.
Comment 3 commit-hook freebsd_committer freebsd_triage 2022-12-06 08:58:25 UTC
A commit in branch main references this bug:

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

commit 21c4bd8da93cc1b7d8d2b5aa9501244282fff358
Author:     Pietro Cerutti <gahr@FreeBSD.org>
AuthorDate: 2022-12-06 08:55:39 +0000
Commit:     Pietro Cerutti <gahr@FreeBSD.org>
CommitDate: 2022-12-06 08:56:41 +0000

    lang/tcl8[6-7]: fix build with clang/lld 15

    PR:             268178
    Reported by:    dim

 lang/tcl86/Makefile | 1 +
 lang/tcl87/Makefile | 1 +
 2 files changed, 2 insertions(+)