CFLAGS=-O3 ... for Gnucash 1.4.7 doesn't work.

Arnold Troeger
Wed, 04 Oct 2000 14:36:25 +0700

Dave Peticolas wrote:

> Arnold Troeger writes:
> > I tried something last night while building the gnucash 1.4.7 rpm for
> > Mandrake 7.0.  I changed the CFLAGS environment variable to "i586 -O3
> > -fomit-frame-pointer -fno-exceptions -fno-rtti -pipe -s -mpentium
> > -mcpu=pentium -march=pentium -ffast-math -fexpensive-optimizations
> > -malign-loops=2 -malign-jumps=2 -malign-functions=2
> > -mpreferred-stack-boundary=2."  These are the default compiler options
> > in the rpmrc file and will be used when building the rpm if you put
> > "CFLAGS=$RPM_OPT_FLAGS" before "./configure ..." in the %build section
> > of the rpm spec file.  Gnucash did not seem to like those compiler
> > options.  The first thing I noticed wrong was in the register window, my
> > new entries were sorting themselves in a different order than I was
> > entering them.  I immediately exited, rebuilt the rpm file without the
> > CFLAGS statement, reinstalled and everything worked properly.   The
> > behavior was definitely corrected by reducing the optimization, but I'm
> > curious as to what does go wrong at higher optimizations.  Has anyone
> > else tried this and if so, what did you decide?
> I don't think anyone has ever reported this problem before. Did you try
> using a different set of optimizations?
> dave

What I did was to change the %build section of gnucash.spec from:
./configure --prefix=/usr --sysconfdir=/etc

CFLAGS=$RPM_OPT_FLAGS ./configure --prefix=/usr --sysconfdir=/etc

In Mandrake RPM_OPT_FLAGS is set as I noted above.  I wondered if it might
make a difference.  I've seen this sort of problem in other applications, but
I confess, I don't normally look beyond noting that there's a problem.  I
just lower the optimization and carry on.  The default optimization in
Gnucash's Makefiles is "-O2"

Best regards,

Arnold Troeger                          Unocal Thailand
Phone:  011-66-2-545-5456               5th Floor, Tower 3, SCB Park Plaza
FAX:    011-66-2-545-5374               19 Ratchadapisek Road, Chatuchak
Email:   Bangkok 10900, Thailand
"Microsoft Windows:  for when your machine is just too fast"