Bug #12640 Overwrited -O2 in CFLAGS
Submitted: 18 Aug 2005 11:30 Modified: 20 Nov 2005 4:41
Reporter: Vadim Tkachenko Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:4.1, 5.0.11 OS:Linux (Linux, Solaris)
Assigned to: Jim Winstead CPU Architecture:Any

[18 Aug 2005 11:30] Vadim Tkachenko
Description:
I'm trying to compile mysql from sources:
CC=gcc CFLAGS="-O2 -g" ./configure --prefix=/usr/local/mysql
make

but I see in compiling progress:

if gcc -DMYSQL_INSTANCE_MANAGER -DMYSQL_SERVER -I. -I. -I../.. -I../../include  -I../../include   -O3 -DDBUG_OFF -O2 -g   -fno-implicit-templates -fno-exceptions -fno-rtti 

what does gcc use actually, -O3 or -O2 ?
 

How to repeat:
CC=gcc CFLAGS="-O2 -g" ./configure --prefix=/usr/local/mysql
make
[26 Aug 2005 19:42] Jim Winstead
If you want to use -O3 for compiling, you also need to set CXXFLAGS or you will get what you observed for compiling C++ files. (That's just autoconf being typically goofy.)

You can also just set C_EXTRA_FLAGS, and it will get set for both of them.
[27 Aug 2005 4:58] Vadim Tkachenko
I don't want to use -O3. I want to use  -O2.
But autoconf adds -O3 by itself, so I cannot compile mysql with -O2.
[19 Oct 2005 2:05] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/31238
[19 Oct 2005 2:24] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/31239
[3 Nov 2005 2:27] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/31856
[18 Nov 2005 16:08] Jim Winstead
Fixed in 4.1.16 and 5.0.17.
[20 Nov 2005 4:41] Paul DuBois
No changelog entry needed.