Bug #13075 MySQL Innobase cannot read the CFLAGS and CXXFLAGS options
Submitted: 8 Sep 2005 21:23 Modified: 9 Sep 2005 7:50
Reporter: luojia chen Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.0.12_beta OS:Solaris (Solaris 10 x64)
Assigned to: CPU Architecture:Any

[8 Sep 2005 21:23] luojia chen
Description:
If you assigned the # of CFLAGS/CXXFLAGS flags more than 7, the generated
"Makefile" under innobase can't include any compiler flags of Sun Studio 10. For example:
case a)the # of C flags <=7

CFLAGS="-DBIG_TABLES -xO3 -mt -xtarget=opteron -xarch=amd64 -fsimple=2
-ftrap=%none" to build MySQL. The innobase/Makefile shows:

CFLAGS = -O -DDBUG_OFF -O -DDBUG_OFF -DBIG_TABLES -xO3 -mt
-xtarget=opteron -xarch=amd64 -fsimple=2 -ftrap=%none -DBIG_TABLES
-DHAVE_RWLOCK_T  -DDEBUG_OFF

case b)the # of C flags > 7

CFLAGS="-DBIG_TABLES -xO3 -mt -xtarget=opteron -xarch=amd64 -fsimple=2
-ftrap=%none -nofstore" to build MySQL The innobase/Makefile shows:

CFLAGS = -O -DDBUG_OFF   -DDEBUG_OFF

- see here no flags was added into the Makefile at all!

How to repeat:
Under the source code directory, build MySQL using the command:
CC=cc CXX=CC CFLAGS='-DBIG_TABLES -xO3 -mt -xtarget=opteron -xarch=amd64 -fsimple=2 -ftrap=%none -nofstore' CXXFLAGS='-DBIG_TABLES -xO3 -mt -xtarget=opteron -xarch=amd64 -fsimple=2 -ftrap=%none -nofstore' LDFLAGS='-xtarget=opteron -xarch=amd64' ASFLAGS='' LD='/shared/dp/vulcan/intel-S2/opt/SUNWspro/bin/cc -xtarget=opteron -xarch=amd64' ./configure --enable-thread-safe-client --enable-local-infile --with-named-curses=-lcurses --with-archive-storage-engine --with-innodb --disable-shared --with-readline --with-embedded-server

The "innobase/Makefile" shows:

CFLAGS = -O -DDBUG_OFF   -DDEBUG_OFF
CXXFLAGS = -O3 -DDBUG_OFF   -DDEBUG_OFF
[9 Sep 2005 7:50] Valeriy Kravchuk
I tried the following configure command line:

CC=cc CXX=CC CFLAGS='-DBIG_TABLES -xO3 -mt -xtarget=opteron -xarch=amd64
-fsimple=2 -ftrap=%none -nofstore' CXXFLAGS='-DBIG_TABLES -xO3 -mt
-xtarget=opteron -xarch=amd64 -fsimple=2 -ftrap=%none -nofstore' \
LDFLAGS='-xtarget=opteron -xarch=amd64' ASFLAGS='' \
LD='/opt/SUNWspro/bin/cc -xtarget=opteron
-xarch=amd64' ./configure --enable-thread-safe-client --enable-local-infile \
--with-named-curses=-lcurses --with-archive-storage-engine --with-innodb \
--disable-shared --with-readline --with-embedded-server

(slightly modified yours, but with all the flags in place).

The problem is in your PATH settings. If PATH includes directory with gcc, then you'll get:

CC = gcc
CCDEPMODE = depmode=gcc3
CFLAGS =  -DDBUG_OFF -O3 -DDBUG_OFF -DHAVE_RWLOCK_T  -DDEBUG_OFF
CPP = gcc -E
CPPFLAGS =
CXX = g++
CXXCPP = g++ -E
CXXDEPMODE = depmode=gcc3
CXXFLAGS = -O3 -DDBUG_OFF -O3 -DDBUG_OFF -fno-implicit-templates -fno-exceptions -fno-rtti -DHAVE_RWLOCK_T  -DDEBUG_OFF

But with the following setting:

-bash-3.00$ uname -a
SunOS sol10-amd64-a 5.10 Generic i86pc i386 i86pc
-bash-3.00$ echo $PATH
/usr/bin:/opt/SUNWspro/bin

I've got with the same command the following in the innobase/Makefile:

CC = cc
CCDEPMODE = depmode=none
CFLAGS = -O -DDBUG_OFF -O -DDBUG_OFF -DBIG_TABLES -xO3 -mt -xtarget=opteron -xarch=amd64 -fsimple=2 -ftrap=%none -nofstore -DBIG_TABLES -DHAVE_RWLOCK_T  -DDEBUG_OFF
CPP = cc -E
CPPFLAGS =
CXX = CC
CXXCPP = CC -E
CXXDEPMODE = depmode=none
CXXFLAGS = -O3 -DDBUG_OFF -O3 -DDBUG_OFF -DBIG_TABLES -xO3 -mt -xtarget=opteron -xarch=amd64 -fsimple=2 -ftrap=%none -nofstore -DBIG_TABLES -DHAVE_RWLOCK_T  -DDEBUG_OFF

So, it's a matter of your environment configuration.
[9 Sep 2005 19:14] luojia chen
I just re-test and found that the problem was caused by the setting of the PATH actually, but it was not related with the PATH setting for GCC. Cause in the compilation command, it set:
CC=cc, CXX=CC
and it will be shown the same in the "innobase/Makefile" no matter with/without PATH setting for GCC

The reason for my reported issue is that the compilation doesn't support BSD command under /usr/ucb under Solaris 10. So in the PATH, if it was set /usr/ucb ahead of /usr/bin. 

bash-3.00$ echo $PATH
/usr/ucb:/usr/bin:/opt/SUNWspro/bin

All the compiler flags can't be added to the "innobase/Makefile":
CFLAGS = -O -DDBUG_OFF   -DDEBUG_OFF

If use the System V command:
bash-3.00$ echo $PATH
/usr/bin:/usr/ucb:/opt/SUNWspro/bin

All the flags can be shown in the "innobase/Makefile":

CFLAGS = -O -DDBUG_OFF -O -DDBUG_OFF -DBIG_TABLES -xO3 -mt
-xtarget=opteron -xarch=amd64 -fsimple=2 -ftrap=%none -nofstore -DBIG_TABLES
-DHAVE_RWLOCK_T  -DDEBUG_OFF