Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

CFLAGS Central (Part 2)

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
408 posts
  • Page 16 of 17
    • Jump to page:
  • Previous
  • 1
  • …
  • 13
  • 14
  • 15
  • 16
  • 17
  • Next
Author
Message
bmeagle
n00b
n00b
User avatar
Posts: 56
Joined: Wed Nov 30, 2005 10:46 am
Location: South Africa

fpic amd64 cflag warnings

  • Quote

Post by bmeagle » Mon Feb 18, 2008 4:59 pm

I am getting the following warning, I think it started after the emul32bit stuff got emerged when I emerged mozilla-flash.
* Your CFLAGS contains "-fPIC" which can break packages.
* Your CXXFLAGS contains "-fPIC" which can break packages.
* Your CFLAGS contains "-m64" which can break packages.
* Your CXXFLAGS contains "-m64" which can break packages.
*
* Before you file a bug, please remove these flags and
* re-compile the package in question as well as all its dependencies
My make.conf reveals:
CFLAGS="-O2 -march=athlon64 -fomit-frame-pointer -pipe -mmmx -msse -msse2 -msse3 -m3dnow"
CHOST="x86_64-pc-linux-gnu"
CXXFLAGS="${CFLAGS}
emerge --info reveals:
Portage 2.1.4.4 (default-linux/amd64/2007.0, gcc-4.2.2, glibc-2.7-r1, 2.6.24-gentoo-r1 x86_64)
=================================================================
System uname: 2.6.24-gentoo-r1 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 4200+
Timestamp of tree: Mon, 18 Feb 2008 01:47:01 +0000
app-shells/bash: 3.2_p33
dev-java/java-config: 1.3.7, 2.1.4
dev-lang/python: 2.4.3-r4, 2.5.1-r5
dev-python/pycrypto: 2.0.1-r6
sys-apps/baselayout: 1.12.9
sys-apps/sandbox: 1.2.18.1-r2
sys-devel/autoconf: 2.13, 2.61
sys-devel/automake: 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils: 2.18-r1
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool: 1.5.26
virtual/os-headers: 2.6.24
ACCEPT_KEYWORDS="amd64 ~amd64"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-m64 -fPIC"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-m64 -fPIC"
Where is the -m64 and -fpic coming from?
Thanx
Top
Ormaaj
Guru
Guru
User avatar
Posts: 319
Joined: Mon Jan 28, 2008 8:04 am

Yet another cflags question...

  • Quote

Post by Ormaaj » Tue Mar 18, 2008 6:42 am

Hi. Has anyone done a comparison of -march=native and explicitly declaring a cflag for > gcc 4.2.x? What I'm particularly wondering about is that in the guide: http://gentoo-wiki.com/Safe_Cflags it recommends using the native march flag. However, I'm rebuilding my whole system under gcc 4.3 (just for fun, and to see how much stuff I can break.) Its an intel core2 quad, and gcc 4.3 also includes the -march=core2 option. Previously you had to pick different ones depending on if you were building for a 32 bit or 64 bit system (32 in this case). So basically... whats best? the old prescott option, native, or core2?
Top
cts
n00b
n00b
Posts: 3
Joined: Fri Aug 12, 2005 12:02 am

Fast and stable settings for dualprocessor quadcore Xeon?

  • Quote

Post by cts » Tue Mar 18, 2008 5:55 pm

My new baby arrived at my doorstep a few days ago and is ready to dive into work ;-)

It's a dual processor quadcore (would that be an octocore machine then? :) Xeon with 4GB RAM and an Areca 1230 hardware RAID controller with 12x1TB HDDs as RAID6. It should do for a while.

Now, can anyone point out a few things to me in regard of

Code: Select all

make.conf
and it's friends so that I can get up to speed? I also need to recompile "what was on my system image" (ie. all the stuff I just untared onto my system-HDD) I guess as that is generic i686 stuff - how would I do that?

Thanks for any help,
Christian.

PS. One rather strange thing I noticed is that when "Machine Check Exception" is enabled in the Kernel the machine likes to crash, actually quite often. Any ideas why that would happen? Disabling that options makes everything good again.
Top
nixnut
Bodhisattva
Bodhisattva
User avatar
Posts: 10974
Joined: Fri Apr 09, 2004 1:43 pm
Location: the dutch mountains

  • Quote

Post by nixnut » Tue Mar 18, 2008 6:32 pm

merged above post here.
Please add [solved] to the initial post's subject line if you feel your problem is resolved. Help answer the unanswered

talk is cheap. supply exceeds demand
Top
a.b.
Apprentice
Apprentice
User avatar
Posts: 218
Joined: Sun Mar 23, 2008 12:37 pm
Location: Anus Mundi, Germany
Contact:
Contact a.b.
Website

  • Quote

Post by a.b. » Mon Apr 07, 2008 12:54 pm

I'm currently running

Code: Select all

-O2 -march=athlon-xp -pipe -fomit-frame-pointer -momit-leaf-frame-pointer -fno-strict-aliasing"
on a Sempron 2200+ with a cache of 256 KB and 786 MB RAM.

-Would -Os be the better choice here? The difference of this CPU to the full Athlon XP is a smaller cache, IIRC.
-Is there anything else you would recommend? (e.g. specific cxxflags)
Top
unK
l33t
l33t
User avatar
Posts: 769
Joined: Tue Feb 06, 2007 5:08 pm

  • Quote

Post by unK » Mon Apr 07, 2008 2:05 pm

I would recommend you to get rid of -momit-leaf-frame-pointer flag, it actually does nothing as you have also -fomit-frame-pointer in your flags.
-Would -Os be the better choice here?
I don't think so. I was playing around with cflags some time ago and my system compiled with -Os was noticeably slower than with -O2 (Athlon 2600+ & 768 MB RAM here).
ncmpcpp - featureful ncurses based MPD client inspired by ncmpc
Top
harvester
Tux's lil' helper
Tux's lil' helper
Posts: 123
Joined: Sat Jan 21, 2006 10:41 pm

  • Quote

Post by harvester » Mon Apr 07, 2008 3:56 pm

Hi guys, My CPU is a T2310

cpuinfo says its family 6 and model 15

according to the safe cflags wiki, march =nocona and it recomends -02 and -pipe

does that sound right ? it says nocona is for core2duo, i dont think I have that, its a laptop and it says Pentium Dual Core... but according to the cflags wiki, my family and model are core2 duo and recomends march=nocona

Also, any other optimizations you think I can benefit from and are safe ?
Top
a.b.
Apprentice
Apprentice
User avatar
Posts: 218
Joined: Sun Mar 23, 2008 12:37 pm
Location: Anus Mundi, Germany
Contact:
Contact a.b.
Website

  • Quote

Post by a.b. » Sat Apr 12, 2008 8:21 pm

unK wrote:I would recommend you to get rid of -momit-leaf-frame-pointer flag, it actually does nothing as you have also -fomit-frame-pointer in your flags.
-Would -Os be the better choice here?
I don't think so. I was playing around with cflags some time ago and my system compiled with -Os was noticeably slower than with -O2 (Athlon 2600+ & 768 MB RAM here).
I have removed the -momit-leaf-frame-pointer and kept O2 as you advised. No desire to recompile mz whole szstem to check if Os is a good choice on Sempron :)
Top
kernelOfTruth
Watchman
Watchman
User avatar
Posts: 6111
Joined: Tue Dec 20, 2005 10:34 pm
Location: Vienna, Austria; Germany; hello world :)
Contact:
Contact kernelOfTruth
Website

  • Quote

Post by kernelOfTruth » Sat Apr 12, 2008 8:34 pm

No desire to recompile mz whole szstem
check your keyboard layout :wink:
https://github.com/kernelOfTruth/ZFS-fo ... scCD-4.9.0
https://github.com/kernelOfTruth/pulsea ... zer-ladspa

Hardcore Gentoo Linux user since 2004 :D
Top
kernelOfTruth
Watchman
Watchman
User avatar
Posts: 6111
Joined: Tue Dec 20, 2005 10:34 pm
Location: Vienna, Austria; Germany; hello world :)
Contact:
Contact kernelOfTruth
Website

  • Quote

Post by kernelOfTruth » Sat Apr 19, 2008 9:21 pm

is -fvisibility-inlines-hidden in cxxflags safe to use in combination with the linux-kernel ? or will it make your computer go explode ? :roll: :?:

(this is a serious question :idea: )

is there even c++ code in the kernel ?
https://github.com/kernelOfTruth/ZFS-fo ... scCD-4.9.0
https://github.com/kernelOfTruth/pulsea ... zer-ladspa

Hardcore Gentoo Linux user since 2004 :D
Top
lotusvale
Guru
Guru
User avatar
Posts: 339
Joined: Thu Mar 06, 2003 6:22 am
Location: Canada

  • Quote

Post by lotusvale » Fri Apr 25, 2008 1:33 pm

has anyone tried -march=core2 ? i have T7200 core 2 duo @ 2 ghz, just wondering if i should use this or prescott.

thanks

-SuSe shot-
| -G shot-

Shadowrider's Lair
Top
kernelOfTruth
Watchman
Watchman
User avatar
Posts: 6111
Joined: Tue Dec 20, 2005 10:34 pm
Location: Vienna, Austria; Germany; hello world :)
Contact:
Contact kernelOfTruth
Website

  • Quote

Post by kernelOfTruth » Fri Apr 25, 2008 1:41 pm

lotusvale wrote:has anyone tried -march=core2 ? i have T7200 core 2 duo @ 2 ghz, just wondering if i should use this or prescott.

thanks
this only applies to >=gcc-4.3.0

if you're using a core 2 (obviously) then try it out, you'll most likely will run into problems with some apps not compiling, though

so it'll be better right now sticking to =gcc-4.2* and -march=native
https://github.com/kernelOfTruth/ZFS-fo ... scCD-4.9.0
https://github.com/kernelOfTruth/pulsea ... zer-ladspa

Hardcore Gentoo Linux user since 2004 :D
Top
lotusvale
Guru
Guru
User avatar
Posts: 339
Joined: Thu Mar 06, 2003 6:22 am
Location: Canada

  • Quote

Post by lotusvale » Fri Apr 25, 2008 4:29 pm

k thanks

-SuSe shot-
| -G shot-

Shadowrider's Lair
Top
a.b.
Apprentice
Apprentice
User avatar
Posts: 218
Joined: Sun Mar 23, 2008 12:37 pm
Location: Anus Mundi, Germany
Contact:
Contact a.b.
Website

  • Quote

Post by a.b. » Sun Jun 08, 2008 2:08 pm

Some people seem to have flags like "falign-functions", falign-loops and falign-jumps that are also present in O2, but they've specified numbers (e.g. -falign-functions=32). What do those flags do and what does the best value depend on? Cache size?
Top
mv
Watchman
Watchman
User avatar
Posts: 6795
Joined: Wed Apr 20, 2005 12:12 pm

  • Quote

Post by mv » Sun Jun 08, 2008 4:53 pm

a.b. wrote:-falign-functions=32). What do those flags do and what does the best value depend on?
It means that the code is enlarged (sometimes filled with noops) so that the code can be put at the beginning of an e.g. 32bit boundary.
The best values depend on the code and the processor (i.e. on the way the processor pipelines commands or caches memory).
gcc selects the defaults on the processor type, so unless you know something special about the code (or want to build code "semi-optimized" for several processors) you should leave the defaults.
Top
avendesora
Veteran
Veteran
User avatar
Posts: 1739
Joined: Fri Aug 16, 2002 1:04 pm
Location: Betelgeuse vicinity

  • Quote

Post by avendesora » Sun Jun 08, 2008 5:19 pm

kernelOfTruth wrote:is -fvisibility-inlines-hidden in cxxflags safe to use in combination with the linux-kernel ? or will it make your computer go explode ? :roll: :?:

(this is a serious question :idea: )

is there even c++ code in the kernel ?
There is no C++ code in the kernel. But do not mess with compiler flags in there.
(Unless you really don't care if it eats your disks, scrambles your ram or eats you children, of course.)
Top
pdw_hu
Apprentice
Apprentice
Posts: 200
Joined: Mon Jun 02, 2008 6:56 pm
Location: Budapest, Hungary

  • Quote

Post by pdw_hu » Wed Jun 11, 2008 10:15 am

I'm in the process of recompiling with gcc 4.3.1 and -march=core2. Will edit my post if anything comes up...
Top
exif
n00b
n00b
Posts: 57
Joined: Mon Jul 07, 2008 4:41 pm
Location: Waterloo, ON, Canada

  • Quote

Post by exif » Fri Jul 18, 2008 5:35 pm

lotusvale wrote:has anyone tried -march=core2 ? i have T7200 core 2 duo @ 2 ghz, just wondering if i should use this or prescott.

thanks
On a new install of my laptop with a T8100 Core2 Duo I re-compiled the toolchain and the base minimal install with march=core2. I had to use the ~amd64 versions of net-tools and glibc in order for everything to compile, but everything looks good now.

I'm now setting up the kernel.
Top
frak10
n00b
n00b
Posts: 3
Joined: Mon Aug 11, 2008 4:10 pm

  • Quote

Post by frak10 » Wed Aug 13, 2008 10:41 pm

Pentium 4 Williamette 1.8Ghz

CFLAGS="-O2 -march=pentium4 -mtune=pentium4 -pipe -frename-registers -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"
USE="X alsa apm arts artworkextra avi berkdb bitmap-fonts branding c++ cairo
cdr client-only crypt cups dvd encode f77 foomaticdb fortran gdbm gif
gnome gpm gtk imlib jpeg kde libg++ libwww mad mikmod motif mp3 mp4 mpeg
ncurses nls oggvorbis openal opengl oss pam pdflib png python quicktime
readline sdl spell ssl svga symlink tcpd truetype vorbis x86 xml2 xv zlib
-birdstep -bitdefender -bluetooth -br -brltty -brnet -cluster -qt3 -qt4"

Built entire system from the Network CD. I'd rather build my own system that let a package manager put poorly optimized packages on my disk.

I used to have -funroll-loops, but I found it slowed my system down somewhat.
Top
kernelOfTruth
Watchman
Watchman
User avatar
Posts: 6111
Joined: Tue Dec 20, 2005 10:34 pm
Location: Vienna, Austria; Germany; hello world :)
Contact:
Contact kernelOfTruth
Website

  • Quote

Post by kernelOfTruth » Thu Aug 21, 2008 3:25 pm

avendesora wrote:
kernelOfTruth wrote:is -fvisibility-inlines-hidden in cxxflags safe to use in combination with the linux-kernel ? or will it make your computer go explode ? :roll: :?:

(this is a serious question :idea: )

is there even c++ code in the kernel ?
There is no C++ code in the kernel. But do not mess with compiler flags in there.
(Unless you really don't care if it eats your disks, scrambles your ram or eats you children, of course.)
I'm a little adventurous ;)

and thanks for explaining !

anyone using -frtl-abstract-sequences noticed that it causes infinite loops / letting the compilation stall at a point ?

(at least with gcc-4.3.1)
https://github.com/kernelOfTruth/ZFS-fo ... scCD-4.9.0
https://github.com/kernelOfTruth/pulsea ... zer-ladspa

Hardcore Gentoo Linux user since 2004 :D
Top
zaccret
n00b
n00b
Posts: 18
Joined: Fri Dec 07, 2007 5:25 pm

  • Quote

Post by zaccret » Sat Aug 23, 2008 10:40 pm

I tried -march=native on my AMD64 (Venice model).
I executed

Code: Select all

echo 'int main(){return 0;}' > test.c && gcc -v -Q -march=native -O2 test.c -o test && rm test.c test
and it gives me

Code: Select all

options passées:  -v test.c -march=k8-sse3 -msahf --param l1-cache-size=64 --param l1-cache-line-size=64 -mtune=k8 -O2
2 things are interesting :
1 - march=native gives mtune AND march. I thought that march was implying mtune...
2 - It gives k8-sse3 for march and k8 for mtune

Do anybody has explanations ?
Top
AnXa
Apprentice
Apprentice
User avatar
Posts: 250
Joined: Tue Apr 06, 2004 5:29 pm

  • Quote

Post by AnXa » Tue Nov 04, 2008 7:03 pm

Anyone remember in which document amd did state that these are official cflags for athlon64 processors like 3500+. I tried to look x86_64.org but it wheren't there anymore.

Code: Select all

CFLAGS="-O3 -march=athlon64 -ffast-math -funroll-all-loops -funit-at-a-time -fpeel-loops -ftracer -funswitch-loops -fomit-frame-pointer -pipe"
The idea isn't about how do you see or hear it, it's about how do you experience it...
Top
Shining Arcanine
Veteran
Veteran
Posts: 1110
Joined: Thu Sep 24, 2009 9:08 pm

What are your CFLAGS?

  • Quote

Post by Shining Arcanine » Tue Apr 27, 2010 12:31 pm

I thought it would be nice if people shared their CFLAGS so people can get a better idea of what works and what does not work. I have an ~amd64 virtual machine running on a Core 2 Quad 9550 system with the following CFLAGS:

CFLAGS="-O3 -pipe -march=core2 -msse4.1 -mcx16 -msahf --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=6144 -ftree-loop-linear -fgcse-sm -fgcse-las -ftree-loop-im -ftree-loop-ivcanon -fivopts -frename-registers -fweb"

I originally had graphite optimizations included too, but those seemed to be more thread parallelism oriented than vector parallelism oriented, so I removed them and rebuilt my system. I am using "-march=core2 -msse4.1 -mcx16 -msahf --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=6144" in place of "-march=native" because I do not want GCC's auto-detection logic to be called on each invocation of GCC. The other flags probably do not make much of a difference, but they work and in the very rare cases that they do make a difference, I feel that they make the assembly code GCC produces closer to what I could write by hand, so I am happy with them.

I also have a laptop running ~x86 Gentoo Linux, but it had some hardware failures, so I do not have access to its CFLAGS at the moment. It is going back to Dell as soon as I receive a box from them that I can use to send it to them for repairs. It is using much more conservative CFLAGS (something like "-O2 -pipe -march=prescott" plus the graphite flags that I plan to remove in the near future), in particular because packages failed to compile correclty with -O3 and also because I did not want to experiment with the flags of a production system. Trying -O3 was the most ambitious thing I did in terms of my laptop's CFLAGS.
Top
eccerr0r
Watchman
Watchman
Posts: 10239
Joined: Thu Jul 01, 2004 6:51 pm
Location: almost Mile High in the USA
Contact:
Contact eccerr0r
Website

  • Quote

Post by eccerr0r » Tue Apr 27, 2010 2:33 pm

Code: Select all

subaru:~/c/Program Files/Ventrilo$ grep Hz /proc/cpuinfo |head -2
model name      : Intel(R) Core(TM)2 Quad CPU    Q9550  @ 2.83GHz
cpu MHz         : 2974.639
subaru:~/c/Program Files/Ventrilo$ grep ^CFLAGS /etc/make.conf 
CFLAGS="-O2 -mtune=i686 -fomit-frame-pointer"
Yes, I'm running 32-bit code on a 64-bit capable machine.

I guess I don't like being that much on the edge ... well maybe a little. Also that this hard disk I'm using with this cpu is meant to be moved from machine to machine and still be usable... I guess I've given up on weird CFLAGS as it somewhat makes debugging harder, as gcc bugs can be exposed, and can't test on other machines to see if behavior matches.

In all honesty, it's a toss up what's "best" - this is in regards to a couple of my AVR GCC projects. I've been futzing around with how to get my code smaller, and -Os goes so far. Hacking my C code around seems to make a bigger difference.
Intel Core i7 2700K/Radeon Firepro W2100/24GB DDR3/800GB SSD
What am I supposed watching?
Top
Ahenobarbi
Retired Dev
Retired Dev
User avatar
Posts: 345
Joined: Thu Apr 02, 2009 6:54 pm
Location: Warsaw, PL

  • Quote

Post by Ahenobarbi » Tue Apr 27, 2010 5:42 pm

How about Gentoo in numbers(forums on that)?
Top
Post Reply

408 posts
  • Page 16 of 17
    • Jump to page:
  • Previous
  • 1
  • …
  • 13
  • 14
  • 15
  • 16
  • 17
  • Next

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy