Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Make.conf (CFLAGS & critical USE flags) question
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
SAngeli
l33t
l33t


Joined: 16 Apr 2004
Posts: 904
Location: Italy

PostPosted: Sat May 14, 2005 7:05 am    Post subject: Make.conf (CFLAGS & critical USE flags) question Reply with quote

Hi,

Even if I have performed several gentoo install, I am lost when it gets to make.conf configuration file.
I am talking about two settings: CFLAGS & critical USE flags

(1) CFLAGS
Let's start talking about CFLAGS: Why do I see sometimes in some users CFLAGS this:?
Code:
-msse -msse2 -msse3 -m3dnow -mmmx

So, my questions is: is it true that all sort of USE flags cannot be placed inside CFLAGS settings?


(2) critical USE flags
Among several flags, there are few that are critical. To my knowledgs these are: video, multimedia and cpu devices, being 3dfx 3dnow 3dnowex, mmx mmx2, sse, sse2. Correct?

My questions are:
1) How to determine (Yes/No) to put 3dfx 3dnow 3dnowex flags in my USE flags? And what would happend if I still place them in my Use flags but are not supported by my system?
2) mmx mmx2, sse, sse2 are directly related to the output of /proc/cpuinfo. Is it correct to say that whatever appears in the cpuinfo flags list should be matched against this mmx mmx2, sse, sse2 flags and therefore whatever is missing from cpuinfo must not be added as use flag? (Example: If my cpu does not support mmx2 and sse2, then I will not add these two flags in my USE flags?

I thank you for your reply and hope to get it done this time.

Thanks,
Spiro
Back to top
View user's profile Send private message
Gherald
Veteran
Veteran


Joined: 23 Aug 2004
Posts: 1399
Location: CLUAConsole

PostPosted: Sat May 14, 2005 7:19 am    Post subject: Re: Make.conf (CFLAGS & critical USE flags) question Reply with quote

SAngeli wrote:
Hi,

Even if I have performed several gentoo install, I am lost when it gets to make.conf configuration file.
I am talking about two settings: CFLAGS & critical USE flags

(1) CFLAGS
Let's start talking about CFLAGS: Why do I see sometimes in some users CFLAGS this:?
Code:
-msse -msse2 -msse3 -m3dnow -mmmx

All valid CFLAGS should be listed in man gcc.. Those are listed.
Quote:
So, my questions is: is it true that all sort of USE flags cannot be placed inside CFLAGS settings?

It is true for the vast majority of USE flags, because USE flags are a very different concept that have no direct relation to CFLAGS.

Quote:
(2) critical USE flags
Among several flags, there are few that are critical. To my knowledgs these are: video, multimedia and cpu devices, being 3dfx 3dnow 3dnowex, mmx mmx2, sse, sse2. Correct?

No USE flags are critical. You probably don't want 3dfx unless you have a Voodoo video card. Some of the rest might be ok IF they are listed under /proc/cpuinfo and IF they are valid USE flags to begin with. But most USE flags have nothing to do with your CPU. They are for compiling optional software support for thingls like e.g. KDE or Gnome.
Quote:
My questions are:1) How to determine (Yes/No) to put 3dfx 3dnow 3dnowex flags in my USE flags? And what would happend if I still place them in my Use flags but are not supported by my system?

try emerging "ufed" and using that to edit USE flags. It has descriptions...
Quote:
2) mmx mmx2, sse, sse2 are directly related to the output of /proc/cpuinfo. Is it correct to say that whatever appears in the cpuinfo flags list should be matched against this mmx mmx2, sse, sse2 flags and therefore whatever is missing from cpuinfo must not be added as use flag? (Example: If my cpu does not support mmx2 and sse2, then I will not add these two flags in my USE flags?

Only a small number of the things that appear in /proc/cpuinfo are actual valid USE flags.
Back to top
View user's profile Send private message
SAngeli
l33t
l33t


Joined: 16 Apr 2004
Posts: 904
Location: Italy

PostPosted: Sat May 14, 2005 7:50 am    Post subject: Reply with quote

Hi Gherald,

thank you for your reply

1) How do you reply to a thred quoting the question and respecting the format and color, like you did with mine?

2) 3dfx refers to voodoo3 and I got this. As for 3dnow 3dnowex I do not believe they appear in cpuinfo as they should be related to multimedia. Is this correct? if not, where exactely should I find out this?

3) As for cpuinfo flags, two questions:
Here is my example:
Code:
vendor_id       : GenuineIntel
model name      : Intel(R) Celeron(R) CPU 2.40GHz
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe pni monitor ds_cpl cid xtpr

a. Do I have to add all of them in my use flags or not? If not what would make me decide what to place and what not to place in my use flags (refer also to mmx mmx2, sse, sse2)?
b. In order to be sure that at least my cpu has all the flags inplace, after I addes my use flags in make.conf, by just doing emerge info should this be a good way to verify that the flags are recognized? And what if some flags still do not appear in the list, like in my case?

Here is an output of my emerge info and make.conf (so that I have something tangible to talk about)
- make.conf
Code:
CFLAGS="-O3 -march=i686 -fomit-frame-pointer -march=pentium4 -mfpmath=sse -msse2 -mmmx"
CHOST="i686-pc-linux-gnu"
CXXFLAGS="${CFLAGS}"

USE="3dfx 3dnow 3dnowex acpi alsa arts avantgo avi cdparanoia cdr crypt cups devfs dga doc dvd dvdread \
     dvdreader esd fbcon foomaticdb ftp gif gimp gimpprint gtk gtk2 i8x0 icq ipv6 java kde mmx \
     mozilla mozsvg -moznoxft mp3 mpeg4 mplayer msn mmx mmx2 nas nntp nptl opengl pda pdf pdflib \
     pic ppds python qt real samba scanner sd1 spell sse sse2 ssl svga tcltk tiff truetype unicode usb \
     xchattext xprint yahoo -gnome -libg X"


- emerge info:
Code:
Portage 2.0.51.19 (default-linux/x86/2005.0, gcc-3.3.5-20050130, glibc-2.3.4.20041102-r1, 2.6.11-gentoo-r4 i686)
=================================================================
System uname: 2.6.11-gentoo-r4 i686 Intel(R) Celeron(R) CPU 2.40GHz
Gentoo Base System version 1.4.16
Python:              dev-lang/python-2.3.5 [2.3.5 (#1, Apr 27 2005, 17:11:43)]
dev-lang/python:     2.3.5
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.5, 1.8.5-r3, 1.6.3, 1.9.4, 1.7.9-r1, 1.4_p6
sys-devel/binutils:  2.15.92.0.2-r7
sys-devel/libtool:   1.5.16
virtual/os-headers:  2.6.11
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-O3 -march=i686 -fomit-frame-pointer -march=pentium4 -mfpmath=sse -msse2 -mmmx"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.3/env /usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O3 -march=i686 -fomit-frame-pointer -march=pentium4 -mfpmath=sse -msse2 -mmmx"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig ccache distlocks sandbox sfperms strict"
GENTOO_MIRRORS="http://gentoo.inode.at/                 ftp://ftp6.uni-erlangen.de/pub/mirrors/gentoo    ftp://vlaai.snt.ipv6.utwente.nl/pub/os/linux/gentoo/                 http://ftp6.uni-erlangen.de/pub/mirrors/gentoo                 http://vlaai.snt.ipv6.utwente.nl/pub/os/linux/gentoo/                 ftp://ftp.ipv6.uni-muenster.de/pub/linux/distributions/gentoo                 ftp://chod.cwru.edu/gentoo                 http://mirror.gentoo.ru/pub/mirror/gentoo/"
LINGUAS="en it"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 3dfx 3dnow 3dnowex X acpi alsa apm arts avantgo avi berkdb bitmap-fonts cdparanoia cdr crypt cups curl devfs dga doc dvd dvdread dvdreader emboss encode esd fam fbcon foomaticdb fortran ftp gd gdbm gif gimp gimpprint gpm gtk gtk2 i8x0 icq imagemagick imlib ipv6 java jpeg kde libg++ libwww mad mikmod mmx mmx2 motif mozilla mozsvg mp3 mpeg mpeg4 mplayer msn nas ncurses nls nntp nptl odbc ogg oggvorbis opengl oss pam pda pdf pdflib perl pic png ppds python qt quicktime readline real samba scanner sd1 sdl spell sse sse2 ssl svga tcltk tcpd tetex tiff truetype truetype-fonts type1-fonts unicode usb vorbis xchattext xml2 xmms xprint xv yahoo zlib linguas_en linguas_it"
Unset:  ASFLAGS, CBUILD, CTARGET, LANG, LC_ALL, LDFLAGS

Thank you Gherald for your answers. I want to finally feel confortable with my CFLAGS and use flags knowledge.

Spiro
Back to top
View user's profile Send private message
Gherald
Veteran
Veteran


Joined: 23 Aug 2004
Posts: 1399
Location: CLUAConsole

PostPosted: Sat May 14, 2005 8:10 am    Post subject: Reply with quote

SAngeli wrote:
Hi Gherald,

thank you for your reply

1) How do you reply to a thred quoting the question and respecting the format and color, like you did with mine?
Click quote in the upper right of my above post, and look at the formatting.

Quote:
2) 3dfx refers to voodoo3 and I got this. As for 3dnow 3dnowex I do not believe they appear in cpuinfo as they should be related to multimedia. Is this correct? if not, where exactely should I find out this?

3dnow(ex) are for AMD CPUs only. You have a Celeron, and you'll notice there is no 3dnow in cpuinfo. So don't use it.

Quote:
3) As for cpuinfo flags, two questions:
Here is my example:
Code:
vendor_id       : GenuineIntel
model name      : Intel(R) Celeron(R) CPU 2.40GHz
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe pni monitor ds_cpl cid xtpr

a. Do I have to add all of them in my use flags or not? If not what would make me decide what to place and what not to place in my use flags (refer also to mmx mmx2, sse, sse2)?
Only add them to your USE flags IF they are valid USE flags. You can use ufed to check this.
AFAIK mmx2 isn't, but the rest are, and they appear in your cpuinfo, so you can use them.
Quote:
b. In order to be sure that at least my cpu has all the flags inplace, after I addes my use flags in make.conf, by just doing emerge info should this be a good way to verify that the flags are recognized? And what if some flags still do not appear in the list, like in my case?

Specifically, which? Everything in your USE setting appears in your emerge --info, at first glance... ( I didn't look too closely ).

Your CFLAGS look good although I recommend -O2 instead of -O3, and adding "-pipe" should help compilation speeds.
Back to top
View user's profile Send private message
brettb
n00b
n00b


Joined: 28 Apr 2005
Posts: 5

PostPosted: Sat May 14, 2005 6:54 pm    Post subject: Reply with quote

You declared -march twice in your cflags, don't know if that will be a problem.
Code:
-march=i686 ... -march=pentium4
Back to top
View user's profile Send private message
drwook
Veteran
Veteran


Joined: 30 Mar 2005
Posts: 1324
Location: London

PostPosted: Sat May 14, 2005 7:40 pm    Post subject: Reply with quote

march=pentium4 might be filtered by an ebuild, so I guess he has i686 in as a 'fallback' (later declared flags take priority, but if they're stripped then what's left is left...)
Back to top
View user's profile Send private message
Gherald
Veteran
Veteran


Joined: 23 Aug 2004
Posts: 1399
Location: CLUAConsole

PostPosted: Sat May 14, 2005 11:42 pm    Post subject: Reply with quote

drwook wrote:
march=pentium4 might be filtered by an ebuild, so I guess he has i686 in as a 'fallback' (later declared flags take priority, but if they're stripped then what's left is left...)

That's right, althought doing it with -march is kinda pointless IMO. I do it with -O2 and -Os, since ebuilds are known to behave irrationally when just -Os is set.

Code:

CFLAGS="-mtune=pentium-m -march=pentium-m -pipe -mmmx -msse -msse2 -mfpmath=sse \
-fomit-frame-pointer -momit-leaf-frame-pointer -funit-at-a-time -frename-registers \
-O2 -Os -fno-align-functions -fno-align-jumps -fno-align-loops \
-fno-align-labels -fno-reorder-blocks -fno-prefetch-loop-arrays"
Back to top
View user's profile Send private message
drwook
Veteran
Veteran


Joined: 30 Mar 2005
Posts: 1324
Location: London

PostPosted: Sun May 15, 2005 12:13 pm    Post subject: Reply with quote

seems especially pointless having i686 as the fallback - if anything, why not pentium3? or i386, then i586, then i686 and so on, all the way up to your actual processor, to ensure you always get the 'highest' unfiltered -march? (damn, I'm sounding like a ricer ;) )

Personally I don't bother at all though, I just use e.g.

Code:
CFLAGS="-march=athlon-tbird -O2 -fomit-frame-pointer -pipe"


Maybe I could tweak another 5% out of my system, but the performance is more than good enough anyway.
Back to top
View user's profile Send private message
SAngeli
l33t
l33t


Joined: 16 Apr 2004
Posts: 904
Location: Italy

PostPosted: Sun May 15, 2005 1:59 pm    Post subject: Reply with quote

Thank you guys for the -march=i686 ... -march=pentium4. I did not even noticed this error.
I was under the impression I have to use -march=pentium4. Which one should it be for my Intel Celeron D 2400GHz processor?

Could I ask two more questions?

1) How to learn how to optimize CFLAGS. A good way and good resources. Is it worth messing with it or just put the basic settings?
2) I have an AMD64 3200+ Winchester. I wish to have some existing CFLAGS even some optimized one, not only to have it but to see how you guys have optimized it so that I can use it as the example to learn how to optimize my CFLAGS.

Thank you,
Spiro
Back to top
View user's profile Send private message
Gherald
Veteran
Veteran


Joined: 23 Aug 2004
Posts: 1399
Location: CLUAConsole

PostPosted: Sun May 15, 2005 3:18 pm    Post subject: Reply with quote

pentium4 is fine (a celeron is just a p4 with less cache)

1) just use basic settings
2) just use basic settings
Back to top
View user's profile Send private message
SAngeli
l33t
l33t


Joined: 16 Apr 2004
Posts: 904
Location: Italy

PostPosted: Sun May 15, 2005 3:20 pm    Post subject: Reply with quote

Hi,

could I have a basic settings for AMD64?

Thanks,
Spiro
Back to top
View user's profile Send private message
Gherald
Veteran
Veteran


Joined: 23 Aug 2004
Posts: 1399
Location: CLUAConsole

PostPosted: Sun May 15, 2005 3:30 pm    Post subject: Reply with quote

http://gentoo-wiki.com/Safe_Cflags
Back to top
View user's profile Send private message
SAngeli
l33t
l33t


Joined: 16 Apr 2004
Posts: 904
Location: Italy

PostPosted: Sun May 15, 2005 6:11 pm    Post subject: Reply with quote

Hi Gherald,

Please do not get me wrong: I wish if possible to have (if you know or have in place) couple of CFLAGS settings "safe" and "optimized" for AMD64. I ask you this because I noticed that you have some knowledge with CFLAGS and was hoping to receive the reply through your openion first.

I do not like to set few settings knowing that perhaps I could optimize a bit my system.

But, if you have to do research for me and spend time, please do not! I do not want to ask you this. Just if you happend to know, then it would help.

My goal is the following: Start from a complete "safe" setting where to start from.

Now,
Code:
 Opteron/Athlon64 (AMD)

    CHOST="x86_64-pc-linux-gnu"
    CFLAGS="-march=k8 -O3 -pipe"
    CXXFLAGS="-march=k8 -O3 -pipe"

is this complete for being safe or not? What about -fomit-frame-pointer and few others?

Thank you,
Spiro
Back to top
View user's profile Send private message
drwook
Veteran
Veteran


Joined: 30 Mar 2005
Posts: 1324
Location: London

PostPosted: Sun May 15, 2005 9:34 pm    Post subject: Reply with quote

-fomit-frame-pointer is one you do want, unless you're debugging something. Other than that, I'd say -o2 over -o3, as -o3 tends to create more bloated binaries & so increase load time (even if actual execution is slightly faster once it's been read from disk...). Also -o2 is uber-safe & shouldn't break anything (unless you're running gcc4 ;) )
Back to top
View user's profile Send private message
Gherald
Veteran
Veteran


Joined: 23 Aug 2004
Posts: 1399
Location: CLUAConsole

PostPosted: Mon May 16, 2005 2:21 am    Post subject: Reply with quote

On AMD64, -fomit-frame-pointer is enabled by default on levels -O, -Os, -O2, and -O3 because it does NOT break debugging.

Feel free to stick it in your CFLAGS if you really want to make sure its enabled, but its not going to make any difference.

The flag that breaks debugging on AMD64 is -frename-registers.
Back to top
View user's profile Send private message
drwook
Veteran
Veteran


Joined: 30 Mar 2005
Posts: 1324
Location: London

PostPosted: Mon May 16, 2005 7:26 am    Post subject: Reply with quote

ahh, was thinking x86 as usual after remembering that 'AMD' is up there somewhere.
Back to top
View user's profile Send private message
SAngeli
l33t
l33t


Joined: 16 Apr 2004
Posts: 904
Location: Italy

PostPosted: Sun May 22, 2005 9:36 pm    Post subject: Reply with quote

Hi,

just to make sure:

For my AMD64 +3200 winchester 939 is it -march=athlon64 or -march=k8? I ask this because I also found the athlon64 as some people used.

This is what Safe Cflags says:
Code:
 Opteron/Athlon64 (AMD)

    CHOST="x86_64-pc-linux-gnu"
    CFLAGS="-march=k8 -O2 -pipe"
    CXXFLAGS="-march=k8 -O2 -pipe"


Thanks,
Spiro
Back to top
View user's profile Send private message
Gherald
Veteran
Veteran


Joined: 23 Aug 2004
Posts: 1399
Location: CLUAConsole

PostPosted: Sun May 22, 2005 9:40 pm    Post subject: Reply with quote

k8 for gcc 3.3.x
athlon64 for gcc 3.4.x
Back to top
View user's profile Send private message
SAngeli
l33t
l33t


Joined: 16 Apr 2004
Posts: 904
Location: Italy

PostPosted: Sun May 22, 2005 9:50 pm    Post subject: Reply with quote

Hi Gherald,

I see from packages.gentoo.org that 3.4.3-r1 is under AMD64 stable. So, I would assume LiveCD will install this version. Correct?

You stated:
k8 for gcc 3.3.x
athlon64 for gcc 3.4.x

This makes me think that k8 will no longer be used starting from gcc 3.4.x on, correct?
If so and if LiveCD should rely on 3.4.3-r1 then I would just add CFLAGS="-march=athlon64"

Can you confirm me this?

Also, for my info, could you please tell me how did you get this information, so that I can learn it too how to discover this questions?

Thank you for your quick answer,
Spiro
Back to top
View user's profile Send private message
Gherald
Veteran
Veteran


Joined: 23 Aug 2004
Posts: 1399
Location: CLUAConsole

PostPosted: Sun May 22, 2005 9:58 pm    Post subject: Reply with quote

SAngeli wrote:
I see from packages.gentoo.org that 3.4.3-r1 is under AMD64 stable. So, I would assume LiveCD will install this version. Correct?

yes
Quote:
You stated:
k8 for gcc 3.3.x
athlon64 for gcc 3.4.x

This makes me think that k8 will no longer be used starting from gcc 3.4.x on, correct?
If so and if LiveCD should rely on 3.4.3-r1 then I would just add CFLAGS="-march=athlon64"

Can you confirm me this?

k8 will still work with gcc 3.4.x
but now that athlon64 is available, you should go with that since k8 is more generic (it covers the opteron as well)
Quote:
Also, for my info, could you please tell me how did you get this information, so that I can learn it too how to discover this questions?

Well, I got it because I installed Gentoo on an amd64 system using 3.3.x, before 3.4.x was stable ;)

Now that 3.4.x has been out for some time and all current amd64 stages use it, feel free to update the wiki and change k8 to athlon64.

I recall reading that currently for all versions of gcc 3.4.0 and up, k8 athlon64 and opteron are just synonyms. But this may change in the future...
Back to top
View user's profile Send private message
SAngeli
l33t
l33t


Joined: 16 Apr 2004
Posts: 904
Location: Italy

PostPosted: Sun May 22, 2005 10:06 pm    Post subject: Reply with quote

Thanks a lot Gherald.

Now it is clear.

Have a good day,
Spiro
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo 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