M. Edward (Ed) Borasky
2/4/2009 4:57:00 PM
Rados3aw Bu3at wrote:
> On Mon, Feb 2, 2009 at 3:18 AM, M. Edward (Ed) Borasky
> <znmeb@cesmail.net> wrote:
>> cd <ruby-source>
>> export CFLAGS='-O3 -march=athlon64 -mtune=athlon64'
>> ./configure
>> make
>
> I do:
> export CFLAGS="-O3 -march=native -mtune=native"
> ./configure
> make
>
> and see
>
> gcc -O3 -march=native -mtune=native -O2 -g -Wall -Wno-parentheses (...)
>
> It is ok if my options goes before default options to gcc? I wonder
> what gcc will take, O2 or O3?
>
>
Well ... gcc will take the *last* option it sees, so it will use -O2 :(.
There is a work-around, though. After you unpack the 1.9.1 tarball,
there will be a file in the main directory called "configure.in". Around
line 193 you'll see a definition for "optflags":
if test "$GCC" = yes; then
linker_flag=-Wl,
: ${optflags=-O2} ${warnflags="-Wall -Wno-parentheses"}
else
linker_flag=
fi
Change the "-O2" to "-O3". Then do
autoconf
export CFLAGS="-march=native"
/configure
make
Then the compile lines should look like this
gcc -march=native -O3 -g -Wall -Wno-parentheses (...)
Make sure you look at the output from "make test" to verify that the
extra level of optimization didn't cause bugs. In fact, you should
probably run "RubySpec" against the resulting Ruby interpreter as well. :)
--
M. Edward (Ed) Borasky
I've never met a happy clam. In fact, most of them were pretty steamed.