Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How do I get rid of LLVM?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
Blind_Sniper
Guru
Guru


Joined: 20 Apr 2018
Posts: 368

PostPosted: Wed Dec 18, 2024 12:05 pm    Post subject: How do I get rid of LLVM? Reply with quote

Hi.
Finally llvm-related software became the most bloated part of the system (apart from qt). As far as I understand llvm is just a kind of frontend to compilers, so I wondering, is it possible to get rid of this bloatware?
If there is useful info about it, please share
Thanks
_________________
GNU is Not Usable
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22841

PostPosted: Wed Dec 18, 2024 12:13 pm    Post subject: Reply with quote

You can remove it just like anything else: emerge --ask --verbose --depclean sys-devel/llvm. If it is on your system, this will probably fail with a message about some package that needs it. Add that package to the depclean list and retry. Keep growing the list until either you find a package you're not willing to remove, or you get a successful run. In some cases, packages conditionally need it based on a USE flag. If that is your situation, disabling the USE flag (and rebuilding the affected package) may let you remove LLVM without removing the consuming package. This depends on whether the USE flag controls a feature you are not willing to remove.

My guess is that you will fail, as most modern graphical desktops want Mesa, and Mesa wants LLVM, at least in the common configurations. However, some less common configurations, and anything that can remove Mesa, may not be blocked here.
Back to top
View user's profile Send private message
Blind_Sniper
Guru
Guru


Joined: 20 Apr 2018
Posts: 368

PostPosted: Wed Dec 18, 2024 1:43 pm    Post subject: Reply with quote

Thanks ofr reply!

Code:
emerge --ask --verbose --depclean llvm

Calculating dependencies... done!
  llvm-core/llvm-18.1.8-r1 pulled in by:
    dev-util/intel_clc-24.2.8 requires llvm-core/llvm:18/18.1=, llvm-core/llvm:18=
    dev-util/spirv-llvm-translator-18.1.4 requires llvm-core/llvm:18/18.1=[abi_x86_64(-)], llvm-core/llvm:18=[abi_x86_64(-)]
    llvm-core/clang-18.1.8 requires ~llvm-core/llvm-18.1.8[llvm_targets_AMDGPU], ~llvm-core/llvm-18.1.8[llvm_targets_LoongArch], ~llvm-core/llvm-18.1.8[llvm_targets_Lanai], ~llvm-core/llvm-18.1.8[llvm_targets_MSP430], ~llvm-core/llvm-18.1.8[llvm_targets_ARM], ~llvm-core/llvm-18.1.8[llvm_targets_AVR], ~llvm-core/llvm-18.1.8[llvm_targets_WebAssembly], ~llvm-core/llvm-18.1.8[llvm_targets_Sparc], ~llvm-core/llvm-18.1.8[llvm_targets_Mips], ~llvm-core/llvm-18.1.8[llvm_targets_XCore], ~llvm-core/llvm-18.1.8[llvm_targets_NVPTX], ~llvm-core/llvm-18.1.8[llvm_targets_SystemZ], ~llvm-core/llvm-18.1.8[llvm_targets_AArch64], ~llvm-core/llvm-18.1.8:18/18.1=[-debug,abi_x86_64(-)], ~llvm-core/llvm-18.1.8[llvm_targets_PowerPC], ~llvm-core/llvm-18.1.8[llvm_targets_Hexagon], ~llvm-core/llvm-18.1.8[llvm_targets_X86], ~llvm-core/llvm-18.1.8[llvm_targets_RISCV], ~llvm-core/llvm-18.1.8[llvm_targets_BPF], ~llvm-core/llvm-18.1.8[llvm_targets_VE]
    llvm-core/llvm-toolchain-symlinks-18-r1 requires llvm-core/llvm:18
    llvm-core/llvmgold-18 requires llvm-core/llvm:18[binutils-plugin]
    media-libs/mesa-24.2.8 requires llvm-core/llvm:18[llvm_targets_AMDGPU(+),abi_x86_64(-)]


Code:
emerge --ask --verbose --depclean dev-util/intel_clc

Calculating dependencies... done!
  dev-util/intel_clc-24.2.8 pulled in by:
    media-libs/mesa-24.2.8 requires ~dev-util/intel_clc-24.2.8



It seems only mesa depends on llvm . I removed mesa (built from sources) and installed it from binhost, and the same for intel_clc, but emerge --depclean still says that llvm is still required by mesa/intel_clc. Why binary packages requires compilers?
_________________
GNU is Not Usable
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22841

PostPosted: Wed Dec 18, 2024 2:24 pm    Post subject: Reply with quote

LLVM is not just a compiler. Look at the list of libraries it installs. Even if it were only a compiler, if your depclean has --with-bdeps=y, then Portage would retain packages that you would need if you chose to rebuild Mesa from source.
Back to top
View user's profile Send private message
Blind_Sniper
Guru
Guru


Joined: 20 Apr 2018
Posts: 368

PostPosted: Wed Dec 18, 2024 4:17 pm    Post subject: Reply with quote

At least switching to binary mesa prevented two new huge packages from being pulled in: llvm-runtimes/compiler-rt and llvm-runtimes/compiler-rt-sanitizers.
Not bad.
_________________
GNU is Not Usable
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6174
Location: Dallas area

PostPosted: Wed Dec 18, 2024 4:22 pm    Post subject: Reply with quote

a whole 57 meg ... impressive.
_________________
UM780, 6.1 zen kernel, gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
Blind_Sniper
Guru
Guru


Joined: 20 Apr 2018
Posts: 368

PostPosted: Wed Dec 18, 2024 4:58 pm    Post subject: Reply with quote

Anon-E-moose wrote:
a whole 57 meg ... impressive.


137 Mb, and a lot of time...
_________________
GNU is Not Usable
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6174
Location: Dallas area

PostPosted: Wed Dec 18, 2024 5:19 pm    Post subject: Reply with quote

Not to argue, but are you sure we're talking about the same packages?

Code:
equery s compiler-rt-sanitizers
 * llvm-runtimes/compiler-rt-sanitizers-17.0.6
         Total files : 109
         Total size  : 30.22 MiB
equery s compiler-rt
 * llvm-runtimes/compiler-rt-17.0.6
         Total files : 13
         Total size  : 239.07 KiB
genlop -t compiler-rt-sanitizers |tail -3
     Wed Dec 18 05:22:57 2024 >>> llvm-runtimes/compiler-rt-sanitizers-17.0.6
       merge time: 39 seconds.

genlop -t compiler-rt |tail -3
     Wed Dec 18 05:22:18 2024 >>> llvm-runtimes/compiler-rt-17.0.6
       merge time: 15 seconds.


Maybe llvm 19* version is larger, but I wouldn't think it would be that much larger.
_________________
UM780, 6.1 zen kernel, gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
Blind_Sniper
Guru
Guru


Joined: 20 Apr 2018
Posts: 368

PostPosted: Wed Dec 18, 2024 5:59 pm    Post subject: Reply with quote

Code:
emerge -s compiler-rt-sanitizers
 
[ Results for search key : compiler-rt-sanitizers ]
Searching...

*  llvm-runtimes/compiler-rt-sanitizers
      Latest version available: 19.1.4
      Latest version installed: [ Not Installed ]
      Size of files: 137945 KiB
      Homepage:      https://llvm.org/
      Description:   Compiler runtime libraries for clang (sanitizers & xray)
      License:       Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )

[ Applications found : 1 ]

_________________
GNU is Not Usable
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2512

PostPosted: Wed Dec 18, 2024 8:17 pm    Post subject: Reply with quote

Blind_Sniper wrote:
As far as I understand llvm is just a kind of frontend to compilers, so I wondering, is it possible to get rid of this bloatware?
Thanks


Are you seriously calling a compiler frontend bloatware?

Compiler#Frontend wrote:
The front end analyzes the source code to build an internal representation of the program, called the intermediate representation (IR).


In other words it translates a high level language like C++ into IR:

LLVM wrote:
LLVM is designed around a language-independent intermediate representation (IR) that serves as a portable, high-level assembly language that can be optimized with a variety of transformations over multiple passes.


Which is then processed by a frontend resulting in optimized, architecture specific byte code:

Compiler#Backend wrote:
The back end is responsible for the CPU architecture specific optimizations and for code generation[56].

The main phases of the back end include the following:

  • Machine dependent optimizations: optimizations that depend on the details of the CPU architecture that the compiler targets.[57] A prominent example is peephole optimizations, which rewrites short sequences of assembler instructions into more efficient instructions.
  • Code generation: the transformed intermediate language is translated into the output language, usually the native machine language of the system. This involves resource and storage decisions, such as deciding which variables to fit into registers and memory and the selection and scheduling of appropriate machine instructions along with their associated addressing modes (see also Sethi–Ullman algorithm). Debug data may also need to be generated to facilitate debugging.


Blind_Sniper wrote:
Code:
emerge -s compiler-rt-sanitizers
 
[ Results for search key : compiler-rt-sanitizers ]
Searching...

*  llvm-runtimes/compiler-rt-sanitizers
      Latest version available: 19.1.4
      Latest version installed: [ Not Installed ]
      Size of files: 137945 KiB
      Homepage:      https://llvm.org/
      Description:   Compiler runtime libraries for clang (sanitizers & xray)
      License:       Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )

[ Applications found : 1 ]


This is the size of the source package(s) to be downloaded. Although significantly bigger packages are expected to produce bigger binaries, that's not necessarily the case. You can't compare packages by the size of their source code. There might be correlation but not in an proportional.

Here's the binary size with the consideration that gcc is a monolith and say an LLVM C++ based compiler need several components:


Code:
# equery s gcc
 * sys-devel/gcc-13.3.1_p20241115
         Total files : 1861
         Total size  : 264.79 MiB
 * sys-devel/gcc-14.2.1_p20241116
         Total files : 1936
         Total size  : 311.73 MiB


Code:
# equery s llvm-core/*
 * llvm-core/clang-19.1.4
         Total files : 1694
         Total size  : 186.86 MiB
 * llvm-core/clang-common-19.1.4
         Total files : 45
         Total size  : 101.56 KiB
 * llvm-core/clang-runtime-19.1.4
         Total files : 0
         Total size  : 0 bytes
 * llvm-core/clang-toolchain-symlinks-19
         Total files : 11
         Total size  : 72.04 KiB
 * llvm-core/lld-19.1.4
         Total files : 50
         Total size  : 6.22 MiB
 * llvm-core/lld-toolchain-symlinks-19
         Total files : 7
         Total size  : 72.01 KiB
 * llvm-core/llvm-19.1.4
         Total files : 2385
         Total size  : 246.01 MiB
 * llvm-core/llvm-common-19.1.4
         Total files : 24
         Total size  : 129.38 KiB
 * llvm-core/llvm-toolchain-symlinks-18-r1
         Total files : 31
         Total size  : 72.27 KiB
 * llvm-core/llvm-toolchain-symlinks-19
         Total files : 31
         Total size  : 72.27 KiB
 * llvm-core/llvmgold-19
         Total files : 6
         Total size  : 20.04 KiB


Code:
# equery s llvm-runtimes/*
 * llvm-runtimes/compiler-rt-19.1.4
         Total files : 16
         Total size  : 595.33 KiB
 * llvm-runtimes/compiler-rt-sanitizers-19.1.4
         Total files : 138
         Total size  : 40.96 MiB
 * llvm-runtimes/openmp-19.1.4
         Total files : 18
         Total size  : 3.05 MiB


It seems LLVM can also be used independently. At least that seem to be the case with firefox, because I have llvm-18 because of it(stripped from the above output for clarity), but no 18 version of the other components. Unless it's using the newer ones.

One thing to note is the difference between GCC 13 and 14. Programming languages standards evolve and become more complex. Indeed this is the case with C++. This also contributes to increase in source and binary size. So you're calling the development of languages bloatware?

Best Regards,
Georgi
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum