Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 883935 - net-im/telegram-desktop-4.3.4: fails to compile with lld: ld.lld: error: duplicate symbol: main
Summary: net-im/telegram-desktop-4.3.4: fails to compile with lld: ld.lld: error: dupl...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Esteve Varela Colominas
URL:
Whiteboard:
Keywords: PATCH, PullRequest
Depends on:
Blocks: LD-is-lld, systemwide-lld
  Show dependency tree
 
Reported: 2022-12-01 22:10 UTC by John Helmert III
Modified: 2022-12-13 03:13 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log.xz (build.log.xz,46.24 KB, application/x-xz)
2022-12-01 22:10 UTC, John Helmert III
Details
tentative fix (tdesktop-4.3.4-fix-duplicate-main.patch,816 bytes, patch)
2022-12-01 23:14 UTC, Esteve Varela Colominas
Details | Diff
fix-dupe-main-decl.patch (0001-fix-dupe-main-decl.patch,853 bytes, patch)
2022-12-12 04:16 UTC, John Helmert III
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Helmert III archtester Gentoo Infrastructure gentoo-dev Security 2022-12-01 22:10:44 UTC
Created attachment 838861 [details]
build.log.xz

Portage 3.0.40 (python 3.10.8-final-0, default/linux/amd64/17.1/desktop/systemd/merged-usr, gcc-12, glibc-2.36-r6, 5.15.77-gentoo-dist-hardened x86_64)
=================================================================
System uname: Linux-5.15.77-gentoo-dist-hardened-x86_64-AMD_Ryzen_7_5800X_8-Core_Processor-with-glibc2.36
KiB Mem:    65768448 total,  17536048 free
KiB Swap:    8388604 total,   8385788 free
Timestamp of repository gentoo: Thu, 01 Dec 2022 17:46:49 +0000
Head commit of repository ajak: fc227084fe28bbcbf3370b4db1f550367fe8ec32

Timestamp of repository guru: Thu, 01 Dec 2022 11:16:43 +0000
Head commit of repository guru: 7c6face80135da1814f25a9bfb504dd0accfc93c

Timestamp of repository musl: Tue, 29 Nov 2022 21:01:51 +0000
Head commit of repository musl: 0b81e2547ca51d029c31efc339a9e0886cafa84b

Timestamp of repository pentoo: Thu, 01 Dec 2022 11:31:44 +0000
Head commit of repository pentoo: 4013034bed26d3841f0fff06bef4d9d7b74856f2

Timestamp of repository steam-overlay: Sat, 26 Nov 2022 21:17:38 +0000
Head commit of repository steam-overlay: 7725952b048be2987eb0a39b2641a03b30df8f44

sh bash 5.2_p12
ld GNU ld (Gentoo 2.39 p5) 2.39.0
distcc 3.4 x86_64-pc-linux-gnu [disabled]
ccache version 4.7.4 [disabled]
app-misc/pax-utils:        1.3.5::gentoo
app-shells/bash:           5.2_p12::gentoo
dev-java/java-config:      2.3.1::gentoo
dev-lang/perl:             5.36.0-r1::gentoo
dev-lang/python:           2.7.18_p16::gentoo, 3.9.15_p3::gentoo, 3.10.8_p3::gentoo, 3.11.0_p2::gentoo
dev-lang/rust:             1.65.0::gentoo
dev-util/ccache:           4.7.4::gentoo
dev-util/cmake:            3.25.1::gentoo
dev-util/meson:            0.64.1::gentoo
sys-apps/baselayout:       2.9::gentoo
sys-apps/sandbox:          2.29::gentoo
sys-apps/systemd:          252.2::gentoo
sys-devel/autoconf:        2.13-r7::gentoo, 2.71-r5::gentoo
sys-devel/automake:        1.16.5::gentoo
sys-devel/binutils:        2.39-r4::gentoo
sys-devel/binutils-config: 5.4.1::gentoo
sys-devel/clang:           15.0.6::gentoo
sys-devel/gcc:             11.3.1_p20221007::gentoo, 12.2.1_p20221008::gentoo
sys-devel/gcc-config:      2.8::gentoo
sys-devel/libtool:         2.4.7::gentoo
sys-devel/lld:             15.0.6::gentoo
sys-devel/llvm:            15.0.6::gentoo
sys-devel/make:            4.4::gentoo
sys-kernel/linux-headers:  6.0::gentoo (virtual/os-headers)
sys-libs/glibc:            2.36-r6::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/gentoo
    priority: -1000
    sync-git-verify-commit-signature: yes

ajak
    location: /var/db/repos/ajak
    sync-type: git
    sync-uri: https://gitlab.com/ajak/ajak
    masters: gentoo

guru
    location: /var/db/repos/guru
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/guru.git
    masters: gentoo

musl
    location: /var/db/repos/musl
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/musl.git
    masters: gentoo

pentoo
    location: /var/db/repos/pentoo
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/pentoo.git
    masters: gentoo

steam-overlay
    location: /var/db/repos/steam-overlay
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/steam-overlay.git
    masters: gentoo

Installed sets: @infra
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=znver1 -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d"
CXXFLAGS="-march=znver1 -O2 -pipe"
DISTDIR="/var/cache/distfiles/"
EMERGE_DEFAULT_OPTS="--quiet-build=y --binpkg-respect-use=y"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch parallel-install pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
INSTALL_MASK="/etc/portage/savedconfig"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -fuse-ld=lld -Wl,--as-needed -Wl,-z,relro,-z,now"
MAKEOPTS="-j16 -l16"
PKGDIR="/var/cache/binpkgs/"
PORTAGE_BINHOST="http://raptor.wg.ajak.xyz/znver1/"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/bash"
USE="X a52 aac acl acpi alsa amd64 bluetooth branding bzip2 cairo cdda cdr clang cli crypt cups dbus dist-kernel dri dts dvd dvdr emacs encode examples exif flac fortran gdbm gif gpm gtk gui iconv icu ipv6 jpeg lcms libglvnd libnotify libtirpc lto mad mng mp3 mp4 mpeg multilib ncurses nls notmuch nptl ogg opengl openmp pam pango pcre pdf pgo pipewire png policykit ppds pulseaudio qt5 readline screencast sdl seccomp spell ssl startup-notification svg systemd test-rust tiff truetype udev udisks unicode upower usb verify-sig vorbis vulkan wayland wxwidgets x264 xattr xcb xml xv xvid zlib" ABI_X86="64 32" ADA_TARGET="gnat_2021" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt sha sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="joystick libinput" KERNEL="linux" L10N="en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_10" PYTHON_TARGETS="python3_10" QEMU_SOFTMMU_TARGETS="*" QEMU_USER_TARGETS="*" RUBY_TARGETS="ruby27" USERLAND="GNU" VIDEO_CARDS="amdgpu radeon radeonsi" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, LC_ALL, LD, LEX, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Comment 1 Esteve Varela Colominas 2022-12-01 22:56:56 UTC
Please list the version in the title :)
Comment 2 Esteve Varela Colominas 2022-12-01 23:14:49 UTC
Created attachment 838871 [details, diff]
tentative fix

I won't be able to test this fix in some time, but posting it here in case anyone has the spare resources in the meantine.
Comment 3 John Helmert III archtester Gentoo Infrastructure gentoo-dev Security 2022-12-02 00:16:27 UTC
(In reply to Esteve Varela Colominas from comment #2)
> Created attachment 838871 [details, diff] [details, diff]
> tentative fix
> 
> I won't be able to test this fix in some time, but posting it here in case
> anyone has the spare resources in the meantine.

Doesn't work for me:

[snip]
 * Applying user patches from /etc/portage/patches ...
 * Applying fix-dupe-main.patch ...
 [ ok ]
 * User patches applied.
[snip]
ld.lld: error: duplicate symbol: main
>>> defined at main.cpp
>>>            Telegram/CMakeFiles/Telegram.dir/SourceFiles/main.cpp.o:(main)
>>> defined at getonescriptspan_test.cc
>>>            getonescriptspan_test.cc.o:(.text.startup+0x0) in archive cmake/external/cld3/libexternal_cld3_bundled.a
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
Comment 4 Ingo Brunberg 2022-12-08 16:55:31 UTC
Same issue with mold. The patch and an equivalent line removal in "cmake/external/cld3/CMakeLists.txt" allowed a successful build. I have no idea though, if the removal of that source file affects functionality.
Comment 5 Esteve Varela Colominas 2022-12-08 17:35:17 UTC
Thanks for the report. I'll try to add a patch for this as soon as possible. Unfortunately I'm currently stuck with errors when building with clang++ 15, to even reach the linking stage.
Comment 6 John Helmert III archtester Gentoo Infrastructure gentoo-dev Security 2022-12-08 17:38:03 UTC
If it helps, I'm not building telegram-desktop with clang, just linking with lld.
Comment 7 John Helmert III archtester Gentoo Infrastructure gentoo-dev Security 2022-12-11 18:06:19 UTC
(In reply to Esteve Varela Colominas from comment #1)
> Please list the version in the title :)

But what if it affects multiple versions? Affects 4.3.4, 4.3.4-r1, and 4.4.1 so far for me.
Comment 8 Esteve Varela Colominas 2022-12-11 20:30:28 UTC
I thought it was etiquette in this bug tracker to list at least one reproducible version, or multiple if you've confirmed it.
With this new information we could edit the title again but I'm mostly interested in the newest version it affects, as I don't mind dropping older ones, and I hope to be able to submit something newer for stabilization soon.
Comment 9 John Helmert III archtester Gentoo Infrastructure gentoo-dev Security 2022-12-12 04:16:10 UTC
Created attachment 841625 [details, diff]
fix-dupe-main-decl.patch

Yeah, it seems like there's a cache of CMake input/output in cmake/external. This patch fixes it for me. Upstream PR submitted at https://github.com/google/cld3/pull/78
Comment 10 John Helmert III archtester Gentoo Infrastructure gentoo-dev Security 2022-12-12 04:17:38 UTC
(In reply to John Helmert III from comment #9)
> Created attachment 841625 [details, diff] [details, diff]
> fix-dupe-main-decl.patch
> 
> Yeah, it seems like there's a cache of CMake input/output in cmake/external.
> This patch fixes it for me. Upstream PR submitted at
> https://github.com/google/cld3/pull/78

Note that it might be a while before this makes it into Telegram Desktop's distribution, not sure how they're bundling things, so it's probably still desirable to patch in Gentoo for now.
Comment 11 Esteve Varela Colominas 2022-12-12 13:41:57 UTC
Thanks for submitting the patch!

In telegram, the cmake/ folder isn't really a cache, it's a manually edited repository hosted here: https://github.com/desktop-app/cmake_helpers/blob/master/external/cld3/CMakeLists.txt
If we want the fix to be in the next version of tdesktop, it should be submitted here.

I'll submit the gentoo PR for this today.
Comment 12 Larry the Git Cow gentoo-dev 2022-12-13 03:13:21 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8851c84a31b65fb92cdf9d61689929c84d5d23bb

commit 8851c84a31b65fb92cdf9d61689929c84d5d23bb
Author:     Esteve Varela Colominas <esteve.varela@gmail.com>
AuthorDate: 2022-12-12 15:36:04 +0000
Commit:     John Helmert III <ajak@gentoo.org>
CommitDate: 2022-12-13 03:00:34 +0000

    net-im/telegram-desktop: Fix linking with ld.lld
    
    Closes: https://bugs.gentoo.org/883935
    Thanks-to: John Helmert III <ajak@gentoo.org>
    Signed-off-by: Esteve Varela Colominas <esteve.varela@gmail.com>
    Closes: https://github.com/gentoo/gentoo/pull/28646
    Signed-off-by: John Helmert III <ajak@gentoo.org>

 .../files/tdesktop-4.4.1-fix-dupe-main-decl.patch  | 26 ++++++++++++++++++++++
 .../telegram-desktop-4.3.4-r2.ebuild               |  1 +
 .../telegram-desktop/telegram-desktop-4.4.1.ebuild |  1 +
 3 files changed, 28 insertions(+)