Opened 15 years ago

Last modified 10 years ago

#24778 new enhancement

please add mcpu (march is only for x86)

Reported by: randomshinichi (Andrew Chiw) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: base Version:
Keywords: Cc: cooljeanius (Eric Gallager)
Port:

Description

Hello, I saw that there was a ticket here before that proposed adding mcpu, but the author couldn't really say what was the difference between mcpu and march, so let me state why mcpu is needed: On any architecture other than x86/x86-64 (and it seems ARM too), march, which means to generate code that will run only on the CPU specified, will not work. For the same function, you need mcpu, march=G5 will not work. mcpu on x86/x86-64 is basically mtune, which means generate code that is not architecture specific. Basically:

x86/x86-64 PowerPC
march=mcpu
mcpu=mtune

I also propose that a general purpose dumping ground for compiler flags and linker flags a la Gentoo's /etc/make.conf CFLAGS and LDFLAGS be implemented, so that I don't have to file a ticket every time I find that macports.conf doesn't let you specify a certain compiler flag.

Change History (10)

comment:1 Changed 15 years ago by randomshinichi (Andrew Chiw)

Sorry, it should be portconfigure.tcl. Also, please tell me configure.optflags can accept multiple arguments - or do I have to file a bug on that too?

comment:2 Changed 15 years ago by jmroot (Joshua Root)

Keywords: gcc optimization removed
Milestone: MacPorts 1.9.0
Version: 1.8.2

As per the ticket guidelines linked from the New Ticket page, please don't set the Milestone field.

comment:3 Changed 15 years ago by randomshinichi (Andrew Chiw)

I was about to change it but then I saw you already did...

comment:4 in reply to:  description Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to randomshinichi4869@…:

I also propose that a general purpose dumping ground for compiler flags and linker flags a la Gentoo's /etc/make.conf CFLAGS and LDFLAGS be implemented, so that I don't have to file a ticket every time I find that macports.conf doesn't let you specify a certain compiler flag.

I'm not terribly thrilled about giving the user the ability to specify any random compiler flag. This just increases our support burden when things go wrong as it's yet another way the user's configuration could vary. We are not Gentoo, we don't necessarily have the same kind of power users, we don't have to copy what they do...

comment:5 Changed 15 years ago by afb@…

Well, you could have MacPorts translate those config settings for you ? The names are probably "weird" then, but one could use configure.marchand configure.mtune on the PowerPC too. And automagically translate it to -march or -mtune ?

comment:6 Changed 15 years ago by afb@…

Make that (configure.march) into -march or -mcpu (typo above)

comment:7 Changed 15 years ago by afb@…

#2193
r33599

# We could have m32/m64/march/mtune be global configurable at some point.
# We could have debug/optimizations be global configurable at some point.

comment:8 Changed 15 years ago by randomshinichi (Andrew Chiw)

Well, the problem here is that there is march for x86, but nothing equivalent for PowerPC, which needs mcpu for the same thing. A configure.march that issues -mcpu or -march depending on architecture would be nice, as long as you put a comment after it saying that it does that. In any case, the message that says it could be global configurable seems to have been there for ages - there simply isn't any excuse, seeing as there's already a march option.

Anyway, I managed to cram -mcpu=G5 into configure.optflags.

# We could have debug/optimizations be global configurable at some point.
options configure.optflags configure.cflags configure.cppflags configure.cxxflags configure.objcflags configure.ldflags 
configure.libs configure.fflags configure.f90flags configure.fcflags configure.classpath
default configure.optflags  {"-O2 -mcpu=G5 -mno-powerpc64"}

The -mno-powerpc64 is needed because as of the gcc included in Xcode 3.1.4 -mcpu=G5 gives you -mpowerpc64 as well, which breaks stuff, e.g. htop terminates with a Bus Error if you try to sort the process list, and somebody on the internet reported povray segfaulting. Nobody needs 64bit htop anyway.

htop now takes less CPU (it was about 4-6% before, now mostly 0, occasionally jumping up to 2%) which I like because a CPU usage tool has no business hogging CPU cycles for itself. I guess this may seems little gentoo-ricer-ish.

comment:9 Changed 15 years ago by afb@…

Using configure.optflags meanwhile worksforme... I think m32/m64/etc got derailed with +universal ?

It used to be hardcoded "-O2" before it was changed. Went ricing in r33503, I think. Some "-Omg" request.

I'm all for wiping configure's m32/m64/mtune/march... Nobody is using them anyway, but build_arch/optflags ?

And top using 5-10% is "standard" on Mac OS X, I think. At least with Apple's top, haven't tried using htop.

comment:10 Changed 10 years ago by cooljeanius (Eric Gallager)

Cc: egall@… added

Cc Me!

Note: See TracTickets for help on using tickets.