I removed Clang/LLVM entirely from a Gentoo system (masked the packages and set the USE flags to remove their support) and realized I can't update Telegram after that. Telegram-desktop requires libdispatch, which has no configurable USE flags, to be built. Libdispatch requires clang to be built. Therefore I can't build Telegram-desktop without Clang. This would be an understandable situation if not for the fact that libdispatch is a runtime dependency for Telegram-desktop. It's my understanding (as far as I could search) that runtime dependencies aren't packed into the binary package. I installed telegram-desktop-bin, started it and ran cat /proc/*/maps |grep -i libdispatch and there's no libdispatch library loaded, so that furthers my idea that the binary package either does not come with libdispatch or it's not in use someway. As comparison, running equery f --tree firefox-bin |grep -i lib lists several library files that come with it. Doing the same with telegram-desktop-bin doesn't show anything. Can we have a way to separate telegram-desktop from the need of libdispatch, or separate libdispatch from clang? I'm not a programmer so I can't provide further assessment, I'm just not sure where else to ask this. Reproducible: Always Steps to Reproduce: 1. set USE="-clang -llvm" 2. mask clang and llvm for good measure 3. try to install telegram-desktop Actual Results: Can't build telegram because it can't build libdispatch: (dependency required by "dev-libs/libdispatch-5.7.1::gentoo" [ebuild]) (dependency required by "libdispatch" [argument]) Expected Results: Build telegram-desktop without needing clang
No, libdispatch is split out from Apple's stuff and it uses Blocks. Simply having a system without Clang and LLVM and wanting to achieve that isn't really a bug in itself if there's no evidence for believing it's possible. Your question is actually "does telegram-desktop really need libdispatch?", I think, and I'll let the telegram maintainer answer that. But it could easily be that libdispatch is statically linked or something.
See https://github.com/telegramdesktop/tdesktop/issues/17437 & https://github.com/telegramdesktop/tdesktop/commit/d89597bf64859eaf1bdad57a86c40b810a4923c1. It looks like it _might_ be possible to disable it with a hack but then your Telegram becomes slower.
Telegram-desktop is possible to build without clang. As you say, libdispatch is a runtime dependency, and only needs llvm/clang to build. It sounds like you're using a combination of --deep and --with-bdeps=y, causing portage to try to satisfy the entire dependency tree including build dependencies (a sane choice). Not having clang/llvm installed while --with-bdeps=y is enabled (default) means your system has broken deoendencies. You cannot do what you want unless you disable that or put the compiler in package.provided, but I'm not going to recommend either due to the significant consequences of both of these approaches. It might be possible to make a binpkg repo with *just* libdispatch and enable --usepkg to satisfy this, but it's finnicky. telegram-desktop-bin uses a static version of many libraries. libdispatch is one of them, so of course you won't see it in the resulting binary. Even if it's possible to build the upstream code without libdispatch, I'm not sure I'm comfortable supporting this in gentoo. The flag looks to be quite hidden, untested, and smells like something that'd quickly go wrong, but I'll look at it some time.
Thank you all for your in depth responses! Like I said in my report, I'm not a programmer so I couldn't understand how hard/unfeasible it is/was to build Telegram without libdispatch (and therefore without clang). I'm using telegram-desktop-bin for the moment and am trying to avoid Clang/LLVM in other places as well (slow notebook). Would it be good to somehow add the clang USE flag to Telegram to make it obvious it's a necessity of Telegram to have Clang to build libdispatch and use it? As mentioned by Esteve I was (and have always) indeed using --deep when updating system. emerge -avuDN world
> Would it be good to somehow add the clang USE flag to Telegram to make it obvious it's a necessity of Telegram to have Clang to build libdispatch and use it? No, because clang isn't necessary during telegram's build process, and portage will happily build it without first installing clang if it finds it doesn't need it (e.g. when libdispatch is already installed and "emerge telegram-desktop" is ran without --deep, or with --with-bdeps=n, or with binpkgs, you get the idea). I'll evaluate the suitability of making a use flag for libdispatch, like the one we have for jemalloc.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8580435894e1480944650dd4b297fe0c97f18736 commit 8580435894e1480944650dd4b297fe0c97f18736 Author: Aliaksei Urbanski <aliaksei.urbanski@gmail.com> AuthorDate: 2024-07-03 23:37:13 +0000 Commit: Yixun Lan <dlan@gentoo.org> CommitDate: 2024-07-04 13:46:44 +0000 net-im/telegram-desktop: add 5.2.2 Release: - https://github.com/telegramdesktop/tdesktop/releases/tag/v5.2.2 Changelog: - https://github.com/telegramdesktop/tdesktop/blob/v5.2.2/changelog.txt These changes also: - add the libdispatch USE flag - add the repository url to the HOMEPAGE variable Bug: https://bugs.gentoo.org/881697 Closes: https://github.com/gentoo/gentoo/pull/37165 Signed-off-by: Aliaksei Urbanski <aliaksei.urbanski@gmail.com> Signed-off-by: Yixun Lan <dlan@gentoo.org> net-im/telegram-desktop/Manifest | 1 + .../files/tdesktop-5.2.2-libdispatch.patch | 24 ++ .../files/tdesktop-5.2.2-qt6-no-wayland.patch | 86 +++++++ net-im/telegram-desktop/metadata.xml | 1 + .../telegram-desktop/telegram-desktop-5.2.2.ebuild | 260 +++++++++++++++++++++ 5 files changed, 372 insertions(+)
Hello Rafael, You can now try to build 5.2.2 without libdispatch: # USE="-libdispatch" emerge =net-im/telegram-desktop-5.2.2 -av Would you mind testing it? Thanks in advance!
libdispatch is possible to disable now, closing. If there's any further issues with it, open a new ticket.