CflagsExceptions
Contents |
Preamble
This page is a work in progress. I wrote it because to my knowledge the subject matter is not documented in any official sources. None of the methods shown here are supported or endorsed by Gentoo developers. Do not expect to receive support if you post your issues on Bugzilla.
Tested on: sys-apps/portage-2.1.2.9
Introduction
ADHD version: How to set CFLAGS on per-package basis.
The CFLAGS variable is the primary mechanism to control compiler-level
optimization of packages installed by Portage. CFLAGS defined in /etc/make.conf specifies global optimizations. Therefore, it should be set to optimize the "common case". This typically means that the GCC's -O flag should be set to -O2, as most applications perform best at that setting.
However, some applications benefit significantly from GCC settings that make other applications slower. For example, Python benefits from -O3. And, under some circumstances, performance of BLAS ATLAS can be improved by non-standard -mfpmath flags.
This article is about configuring portage to use custom CFLAGS for specific
packages. In other words, how to set package-specific exceptions to CFLAGS defined in /etc/make.conf
Procedure
(thanks devsk)
- Create a custom CFLAGS file in /etc/portage/env/ containing CFLAGS=<blah> in one line and CXXFLAGS=<blah> in next.
- Create /etc/portage/env/<pkg_cat>/
- Link /etc/portage/env/<pkg_cat>/<pkg_name_withoutversion> to the custom CFLAGS file
E.g. to compile Python with -O3:
| File: /etc/portage/env/O3-cflags |
CFLAGS="-march=<your_arch> -O3 -pipe"
CXXFLAGS="${CFLAGS}"
|
mkdir -p /etc/portage/env/dev-lang
cd /etc/portage/env/dev-lang
ln -s ../O3-cflags python
CFLAGS-sensitive applications
(please contribute to this section!)
Safe Options
-O3
* Python (http://forums.gentoo.org/viewtopic-t-564985.html) * SQLite (up to 35%+ speedup; http://www.sqlite.org/oldnews.html)
Unsafe Options
The following are ones that are known to break with specific CFLAGS.
-ffast-math -mfpmath=sse,387
* fontconfig (will break when Firefox is run)
-fstack-protector-all
If you are not using the hardened profile, it is possible to build most of your system with this, but don't compile glibc or gcc with it
Resources
Based on: http://forums.gentoo.org/viewtopic-t-564985.html
(thanks mudrii) http://forums.gentoo.org/viewtopic-t-499881-postdays-0-postorder-asc-start-0.html http://www.mail-archive.com/gentoo-user@lists.gentoo.org/msg54130.html
Created by NickStallman.net, Luxury Homes Australia
Real estate agents should be using interactive floor plans and real estate agent tools.
