Find the answer to your Linux question:
Results 1 to 5 of 5
Gentoo is not an ordinary Linux distro, Gentoo Linux is a meta-distribution. Everything is compiled from source in Gentoo, allowing for almost unlimited customization and optimization. The very heart of ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Engineer Segfault's Avatar
    Join Date
    Jun 2008
    Location
    Acadiana
    Posts
    878

    Setting up make.conf


    Gentoo is not an ordinary Linux distro, Gentoo Linux is a meta-distribution. Everything is compiled from source in Gentoo, allowing for almost unlimited customization and optimization. The very heart of this is /etc/make.conf.
    This is a quick guide to help Gentoo newcomers to get off on the right foot.
    Below is an example for amd64, we will have a brief look at every entry. Adjust it for i686 using common sense.
    ------
    Code:
    CHOST="x86_64-pc-linux-gnu"
    This is your architecture, comes preset with stage3 tarball. If CHOST in your tarball is not what you want you've downloaded incorrect stage3 tarball.
    Changing CHOST after Gentoo is installed is possible in some cases, but this is not something you want to do.
    ------
    For 64-bit Intel architecture
    Code:
    CFLAGS="-march=native -O2 -pipe"
    CXXFLAGS="${CFLAGS}"
    For 32-bit Intel architecture
    Code:
    CFLAGS="-march=native -O2 -pipe -fomit-frame-pointer"
    CXXFLAGS="${CFLAGS}"
    Make sure your -march is set to native. This allows GCC to take advantage of your CPU features.
    NB! Do not use -march=native with distcc!
    BTW, GCC versions older than 4.2 do not support -march=native, not a problem with Gentoo.
    Do not set LDFLAGS unless you know what you are doing. If you do include ${LDFLAGS}, otherwise you will override defaults instead of adding to them.
    ------
    Code:
    MAKEOPTS="-j3"
    General consensus is you should set it to the number of your CPU's plus one for maximum compilation performance. Note, you also need more RAM if you increase the number of make instances. With four CPU's and -j5 you'll need at least 2 GB.
    You can decrease it to leave more resources for user tasks.
    ------
    Code:
    FEATURES="ccache"
    There are default features already set for you, adding ccache will speed up compilation.
    ------
    Code:
    LINGUAS="en_US en"
    Set it to whatever suits you.
    ------

    There are some variables which need to be set, otherwise you will get too many drivers, or, in some cases, none. See below.

    ------
    Code:
    INPUT_DEVICES="evdev"
    That's all most people need nowadays.
    ------
    Code:
    VIDEO_CARDS="nvidia vesa"
    Set it according to your hardware, only the driver(s) you set will be installed. If this variable is unset all possible video drivers will be pulled in, that's not what we want, it's Gentoo, remember?
    ------
    Code:
    ACCEPT_KEYWORDS="amd64"
    Setting it to "~amd64" will switch you to testing version of packages (including system packages), use at your own risk.
    ------
    Code:
    USE="foo0 foo1 foo2"
    USE flags give you the flexibility, although they do not have the power Gentoo newcomers often expect.
    Default USE flags are set by your chosen profile, use eselect profile list to see all profiles available to you, eselect profile set n to set your choice (n is the number of profile).
    A good default set for a given package is also often set in the ebuild. Flags from mplayer ebuild as an example, flags with + are enabled by default:
    Code:
    "3dnow 3dnowext +a52 aalib +alsa altivec +ass bidi bindist bl bs2b
    +cddb +cdio cdparanoia cpudetection custom-cpuopts debug dga +dirac directfb
    doc +dts +dv dvb +dvd +dvdnav dxr3 +enca +encode esd +faac +faad fbcon ftp 
    gif ggi -gmplayer +iconv ipv6 jack joystick jpeg jpeg2k kernel_linux ladspa 
    libcaca lirc +live lzo mad md5sum +mmx mmxext mng +mp3 nas +network nut
     openal amr +opengl +osdmenu oss png pnm pulseaudio pvr +quicktime radio 
    +rar +real +rtc samba +shm +schroedinger sdl +speex sse sse2 ssse3 svga tga 
    +theora +tremor +truetype +toolame +twolame +unicode v4l v4l2 vdpau vidix 
    +vorbis win32codecs +X +x264 xanim xinerama +xscreensaver +xv +xvid xvmc 
    zoran"
    As a result of all this there is no dire need to set your own USE flags at all. Furthermore, you can change your mind any time and edit your USE flags, just follow up with emerge -avN world to apply the changes.
    Anyhow, if the feature you need is not enabled by default or you feel there are some features enabled you do not need go ahead and start setting them in make.conf.

    USE flags have three states:
    1. When enabled by user they enable given feature for all packages that support it. (USE="foo")
    2. When disabled by user it will be disabled for all packages which have this feature as optional. (USE="-foo")
    3. When not set by user defaults from profile and ebuild for given package are used.

    Also, you should understand if a feature is not optional it will be enabled regardless what USE flags are set.
    For instance, if an application relies on GTK toolkit it will be pulled in even if user sets USE="-gtk".
    ------
    Notes

    1. When using distcc (FEATURES="distcc" is set) you cannot use -march=native. Use correct -m options for your CPU in both master and helper boxes. To determine correct options do
    Code:
    gcc -### -march=native -E /usr/include/stdlib.h 2>&1 | grep "/usr/libexec/gcc/.*cc1"
    In my box it will repond with
    Code:
    "/usr/libexec/gcc/x86_64-pc-linux-gnu/4.4.4/cc1" "-E" "-quiet" 
    "/usr/include/stdlib.h" "-D_FORTIFY_SOURCE=2" "-march=core2" "-mcx16" 
    "-msahf" "--param" "l1-cache-size=32" "--param" "l1-cache-line-size=64" 
    "--param" "l2-cache-size=4096" "-mtune=core2"
    so my -m options would be "-march=core2 -mcx16 -msahf".

    2. Every time you emerge something I suggest using emerge -av. This gives you the opportunity to verify correct features and options are set before you install.
    For instance, if you see something like this:
    Code:
    $ emerge -pv libgphoto2
    
    These are the packages that would be merged, in order:
    
    Calculating dependencies... done!
    [ebuild  N    ] media-libs/libgphoto2-2.4.9  USE="exif -bonjour -doc -examples
     -hal -nls" CAMERAS="-adc65 -agfa_cl20 -aox -ax203 -barbie -canon -casio_qv 
    -clicksmart310 -digigr8 -digita -dimagev -dimera3500 -directory -enigma13 -fuji 
    -gsmart300 -hp215 -iclick -jamcam -jd11 -jl2005a -kodak_dc120 -kodak_dc210 
    -kodak_dc240 -kodak_dc3200 -kodak_ez200 -konica -konica_qm150 -largan 
    -lg_gsm -mars -mustek -panasonic_coolshot -panasonic_dc1000 
    -panasonic_dc1580 -panasonic_l859 -pccam300 -pccam600 -polaroid_pdc320 
    -polaroid_pdc640 -polaroid_pdc700 -ptp2 -ricoh -ricoh_g3 -samsung -sierra 
    -sipix_blink -sipix_blink2 -sipix_web2 -smal -sonix -sony_dscf1 -sony_dscf55 
    -soundvision -spca50x -sq905 -st2205 -stv0674 -stv0680 -sx330z -template 
    -topfield -toshiba_pdrm11" 5,511 kB
    
    Total: 1 package (1 new), Size of downloads: 5,511 kB
    you will certainly want to enable at least one of them by adding CAMERAS="mychoice" to the make.conf.

    3. I'd recommend emerging a USE flag editor, I'm using ufed myself.

    4. See /usr/share/portage/config/make.conf.example for more.

    5. In cases when system-wide enabling of a given USE flag is not desirable it can be set in /etc/portage/package.use per package. For instance, you have -gtk in your make.conf because you use KDE desktop and you want to avoid building GTK support into packages which support it. But there is an application which does not support QT so you have to choose whether to build it CLI only or with GUI by enabling gtk USE flag for it.

    6. You can see your settings in effect by looking at emerge --info output.

    Happy compiling!
    Last edited by Segfault; 09-27-2010 at 07:17 PM.

  2. #2
    Linux User Manko10's Avatar
    Join Date
    Sep 2010
    Posts
    250
    As an addition: some packages have special licenses. Those packages won't compile unless you accept their licenses explicitly in your make.conf via the ACCEPT_LICENSE directive.
    For instance:
    Code:
    ACCEPT_LICENSE="skype-eula AdobeFlash-10.1"
    to accept the Skype EULA and the Adobe Flash 10.1 license. A list of all licenses can be found in /usr/portage/licenses. If you try to emerge a package which has such a special license without adding ti to ACCEPT_LICENSE emerge will fail printing an error message with the license you need to accept.
    Another way of accepting licenses is via your /etc/portage/package.license file (which you need to create first)
    For more information on package licenses see Licenses - Gentoo Linux Wiki

    ---
    @ozar this forum is also not make menuconfig friendly. When you post something in square brackets it swallows linefeeds.

  3. #3
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Quote Originally Posted by Segfault View Post
    Gentoo is not an ordinary Linux distro, Gentoo Linux is a meta-distribution. Everything is compiled from source in Gentoo, allowing for almost unlimited customization and optimization. The very heart of this is /etc/make.conf.
    This is a quick guide to help Gentoo newcomers to get off on the right foot.
    Below is an example for amd64, we will have a brief look at every entry. Adjust it for i686 using common sense.
    This is missguiding, since i686 and amd64 are different things. Plus, as you say below changing CHOST is neither supported nor advised.

    This is your architecture, comes preset with stage3 tarball. If CHOST in your tarball is not what you want you've downloaded incorrect stage3 tarball.
    Changing CHOST after Gentoo is installed is possible in some cases, but this is not something you want to do.
    Plus it only makes sense in a few corner cases under very special circumstances. In any case, changing CHOST is not just as trivial as changing a variable in make.conf.

    Gentoo Linux Documentation -- Changing the CHOST variable

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Newbie
    Join Date
    Aug 2009
    Posts
    156
    I appreciate on understand this post by learning that I just got a booted system, with out any USE variables. IMO as a newbie I wish I had not worried about USE, until I understood how to boot a system without USE. For me, I wish I had focused more on creating a correct /etc/fstab, which was one of other reason that was keeping me from a successful boot. I chose eselect set one, as offered by kernel-2.6.36. I had an hda hard drive which added to the complexity for a noob like me. USE was more of an obstacle before booting, now I can see how I cannot get by without it. Thanks for the post, I am sure I will be coming back to learn more or maybe to ask more questions about it. I am learning to walk still, perhaps tomorrow I can learn to run, with USE.

  6. #5
    Linux Guru sdousley's Avatar
    Join Date
    Feb 2004
    Posts
    1,790
    Quote Originally Posted by frank56 View Post
    I appreciate on understand this post by learning that I just got a booted system, with out any USE variables. IMO as a newbie I wish I had not worried about USE, until I understood how to boot a system without USE.
    Just to clarify, all USE flags are entirely optional. All it means with a USE flag disabled is that applications compiled that use that flag will not have support for said USE flag.

    e.g. if you install php without the mysql USE flag enabled, php itself will work fine, you simply wont have access to the mysql_* functions.

    To get an operating system installed and booting, you can skip the use flags.

    Another thing that I use sometimes to help me work out what flags to enable is an app called ufed. This is in portage, and provides an ncurses frontend to USE flag management.
    "I am not an alcoholic, alcoholics go to meetings"
    Registered Linux user = #372327

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •