I need to explore/modify/build LLVM and Clang. In the Getting Started documentation, it is said to build it with the usual magical recipe (configure → make → make install). However, I noticed that for Debug builds all the libraries are statically linked: this inflates the binaries size, and thus sudo ninja -C ./build install ends up copying a lot of data, moreover in the root partition (on Linux).
My question is: what advantages does installing provide, apart from having the binaries in PATH?
Because this can be equally fized by putting in your .bashrc (or equivalent)
Should I always install the project after compiling it? Or is the PATH export enough? Why? Can’t the IDE still access all the relevant headers for auto-completion and similar? Are the libraries affected?
Ah, I see, thanks. I guess I’m going to delete everything that has been just installed
As a side note, I’ve got two curiosities:
How can you create a shareable package by installing? Setting the install prefix?
If I wanted to install in a portable way, IIUC it would be beneficial to use CMake, much like cmake --build ./build is better than cd build; make if you ever happen to change generator. To install, I read CMake accepts cmake install <dir>, where <dir> is (IIRC) the binaries dir. But LLVM builds also other artifacts, like libraries: if I issued
cmake install ./build/bin
would CMake understand everything it needs, much like make install/ninja install? Maybe using a script (cmake -P), which, IIUC, is also what make and ninja actually do?
Not sure about this - but to install just the toolchain and not the libraries there is a CMake switch for this -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON - in my project, I just do cmake --build ./build --target=install-distribution - see more information about distributions here Building a Distribution of LLVM — LLVM 16.0.0git documentation