This repository has been archived by the owner on Oct 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from ian-moone/update-readme
README.md: Update instructions for self-hosting (v5 to v6)
- Loading branch information
Showing
1 changed file
with
23 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,60 @@ | ||
# Gentoo-Clang overlay | ||
An overlay for Gentoo, providing patches for upstream Gentoo repository to make it possible to build entire world with clang compiler. | ||
An overlay for Gentoo, providing patches for upstream Gentoo repository to make it possible to build entire @world with clang compiler. | ||
|
||
## Quick start | ||
First of all you need to build clang with clang. The easiest way is to install clang:4 and then to build clang:5 (or clang:6 testing) with it. | ||
First of all you need to build clang with clang (self-host). The easiest way is to install clang:5 and then to build clang:6 (or clang:7 testing) with it. | ||
|
||
``` | ||
emerge -av1 clang:4 llvm:4 | ||
emerge -av1 clang:5 llvm:5 | ||
``` | ||
Now add following to your make.conf (just like [wiki](https://wiki.gentoo.org/wiki/Clang#Global_configuration_via_make.conf) says): | ||
(it is important that you define full path to clang binaries or at least version of clang binaries, as compilation may fail somewhere in the middle because some biniries would be updated with llvm package and others - with clang package) | ||
Now add the following to your make.conf (just like [wiki](https://wiki.gentoo.org/wiki/Clang#Global_configuration_via_make.conf) says): | ||
|
||
> **Note:** It is important that you define full path to clang's binaries or at least the version of clang's binaries, as compilation may fail somewhere in the middle because some binaries would be updated with LLVM package and others - with clang package. | ||
``` | ||
CC="/usr/lib/llvm/4/bin/clang-4.0" | ||
CXX="/usr/lib/llvm/4/bin/clang++-4.0" | ||
CC="/usr/lib/llvm/5/bin/clang-5.0" | ||
CXX="/usr/lib/llvm/5/bin/clang++-5.0" | ||
CFLAGS="-O2 -pipe -march=native" | ||
CXXFLAGS="${CFLAGS}" | ||
LDFLAGS="-Wl,-O2 -Wl,--as-needed" | ||
AR="/usr/lib/llvm/4/bin/llvm-ar" | ||
NM="/usr/lib/llvm/4/bin/llvm-nm" | ||
RANLIB="/usr/lib/llvm/4/bin/llvm-ranlib" | ||
AR="/usr/lib/llvm/5/bin/llvm-ar" | ||
NM="/usr/lib/llvm/5/bin/llvm-nm" | ||
RANLIB="/usr/lib/llvm/5/bin/llvm-ranlib" | ||
``` | ||
Now you can build clang using clang (remember to remove clang:4 after you've done and change your make.conf to new version) | ||
Now you can self-host LLVM/Clang (remember to remove clang:5 after you've done and change your make.conf to new version) | ||
``` | ||
emerge -av clang:5 llvm:5 | ||
emerge -av clang:6 llvm:6 | ||
emerge --depclean -a | ||
``` | ||
Change your make.conf to new version of clang: | ||
``` | ||
CC="/usr/lib/llvm/5/bin/clang-5.0" | ||
CXX="/usr/lib/llvm/5/bin/clang++-5.0" | ||
CC="/usr/lib/llvm/6/bin/clang-6.0" | ||
CXX="/usr/lib/llvm/6/bin/clang++-6.0" | ||
CFLAGS="-O2 -pipe -march=native" | ||
CXXFLAGS="${CFLAGS}" | ||
LDFLAGS="-Wl,-O2 -Wl,--as-needed" | ||
AR="/usr/lib/llvm/5/bin/llvm-ar" | ||
NM="/usr/lib/llvm/5/bin/llvm-nm" | ||
RANLIB="/usr/lib/llvm/5/bin/llvm-ranlib" | ||
AR="/usr/lib/llvm/6/bin/llvm-ar" | ||
NM="/usr/lib/llvm/6/bin/llvm-nm" | ||
RANLIB="/usr/lib/llvm/6/bin/llvm-ranlib" | ||
``` | ||
Before you start rebuilding entire world remember to include overrided eclasses to your gentoo repository. | ||
Add following to `/etc/portage/repos.conf/gentoo.conf` in `[DEFAULT]` section: | ||
``` | ||
eclass-overrides = gentoo-clang | ||
``` | ||
Finnaly you are good to go: | ||
Finally you are good to go: | ||
``` | ||
emerge -eav1 --with-bdeps=y @world | ||
``` | ||
|
||
## Notes | ||
### libunwid | ||
In general it is good idea to switch form `sys-libs/libunwind` to `sys-libs/llvm-libunwind`. They are blocking each other so just `emerge --unmerge sys-libs/libunwind && emerge -av1 sys-libs/llvm-libunwind`. | ||
In general it is good idea to switch from `sys-libs/libunwind` to `sys-libs/llvm-libunwind`. They are blocking each other so just `emerge --unmerge sys-libs/libunwind && emerge -av1 sys-libs/llvm-libunwind`. | ||
### libcxx | ||
If we are getting rid of GCC and moving forward LLVM and CLang, so why not to switch to libc++ as STL? | ||
If we are getting rid of GCC and moving forward LLVM and Clang, so why not switch to libc++ as STL? | ||
Just add `default-libcxx` for clang and `libcxx` for all dev-qt to your USE. | ||
### GCC fallback | ||
Even if we are aiming to completely replace GCC with CLang it is not possible yet to compile everything with clang. So make sure you have GCC fallback environment set up like [wiki](https://wiki.gentoo.org/wiki/Clang#GCC_fallback_environments) describes. | ||
Even if we are aiming to completely replace GCC with Clang, it is not possible yet to compile everything with it. So make sure you have GCC fallback environment set up like [wiki](https://wiki.gentoo.org/wiki/Clang#GCC_fallback_environments) describes. | ||
|
||
## Issues and bug reports | ||
Definitely I'll do my best to cover as much packages as possible and to provide patches ASAP. Nevertheless [reporting of broken packages via issue](https://github.com/BilyakA/gentoo-clang/issues/new) and pull requests are welcome! |