Bug #59167 Sunstudio12.2 and MySQL 5.5.8 GA compile bug on Solaris express 11
Submitted: 25 Dec 2010 15:03 Modified: 4 Mar 2013 16:46
Reporter: Shailesh Tyagi Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S1 (Critical)
Version:5.5.8, 5.5.13 OS:Solaris (solaris express 11)
Assigned to: CPU Architecture:Any
Tags: mysql-5.5.8, sunstudio12.2

[25 Dec 2010 15:03] Shailesh Tyagi
Description:
encountered a problem while trying to compile MySQL 5.5.8 GA from source on Oracle Solaris express 11 with sunstudio 12.2 C Compiler.

here is the method used..
---------------------------------------
export PATH=$PATH:/usr/sbin:/usr/sfw/bin:/usr/ccs/bin:/opt/solstudio12.2/bin
----------------------------------------------

CC=cc CFLAGS="-xO4 -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -xlibmil -xlibmopt -xtarget=generic -xregs=no%frameptr" CXX=CC CXXFLAGS="-xO3 -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -xlibmil -xlibmopt -xtarget=generic -xregs=no%frameptr" LDFLAGS="-xtarget=generic"
-------------------------------------------------------------------

cmake .

some errors during cmake
----------------------
-- Looking for strunvis - not found
-- Performing Test HAVE_IB_GCC_ATOMIC_BUILTINS
-- Performing Test HAVE_IB_GCC_ATOMIC_BUILTINS - Failed
-- Performing Test HAVE_IB_ATOMIC_PTHREAD_T_GCC
-- Performing Test HAVE_IB_ATOMIC_PTHREAD_T_GCC - Failed
-- Looking for atomic_cas_ulong
-- Looking for atomic_cas_ulong - found
-- Looking for atomic_cas_32
-- Looking for atomic_cas_32 - found
-- Looking for atomic_cas_64
-- Looking for atomic_cas_64 - found
-- Looking for atomic_add_long_nv
-- Looking for atomic_add_long_nv - found
-- Looking for atomic_swap_uchar
-- Looking for atomic_swap_uchar - found
-- Performing Test HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS
-- Performing Test HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS - Success
-- Check size of pthread_t
-- Check size of pthread_t - done
-- Performing Test HAVE_PEERCRED
-- Performing Test HAVE_PEERCRED - Failed
-- Looking for inet_aton
-- Looking for inet_aton - not found
-- Looking for inet_aton in nsl
-- Looking for inet_aton in nsl - found
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/local/src/mysql-5.5.8

---------------------------------------------------------------

# make

[  5%] Built target edit
[  5%] Built target gen_dtrace_header
[ 11%] Built target strings
[ 11%] Building C object mysys/CMakeFiles/mysys.dir/my_rdtsc.c.o
ube: error: Invalid argument number '0' is used in GASM Inlining
cc: ube failed for /usr/local/src/mysql-5.5.8/mysys/my_rdtsc.c
*** Error code 2
The following command caused the error:
cd /usr/local/src/mysql-5.5.8/mysys && /opt/solstudio12.2/bin/cc  -DHAVE_RWLOCK_T -DHAVE_CONFIG_H -xO2 -DDBUG_OFF -I/usr/local/src/mysql-5.5.8/include -I/usr/local/src/mysql-5.5.8/mysys -KPIC /usr/local/src/mysql-5.5.8/mysys/my_timer_cycles.il -o CMakeFiles/mysys.dir/my_rdtsc.c.o   -c /usr/local/src/mysql-5.5.8/mysys/my_rdtsc.c
make: Fatal error: Command failed for target `mysys/CMakeFiles/mysys.dir/my_rdtsc.c.o'
Current working directory /usr/local/src/mysql-5.5.8
*** Error code 1
The following command caused the error:
make -f mysys/CMakeFiles/mysys.dir/build.make mysys/CMakeFiles/mysys.dir/build
make: Fatal error: Command failed for target `mysys/CMakeFiles/mysys.dir/all'
Current working directory /usr/local/src/mysql-5.5.8
*** Error code 1
The following command caused the error:
make -f CMakeFiles/Makefile2 all
make: Fatal error: Command failed for target `all'

How to repeat:
here is the method used..
---------------------------------------
export PATH=$PATH:/usr/sbin:/usr/sfw/bin:/usr/ccs/bin:/opt/solstudio12.2/bin
----------------------------------------------

CC=cc CFLAGS="-xO4 -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -xlibmil -xlibmopt -xtarget=generic -xregs=no%frameptr" CXX=CC CXXFLAGS="-xO3 -mt -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -xlibmil -xlibmopt -xtarget=generic -xregs=no%frameptr" LDFLAGS="-xtarget=generic"
-------------------------------------------------------------------

# cmake .
-----------------------
# make
[1 Feb 2011 8:01] Valeriy Kravchuk
Please, send the output of:

uname -a

from your OS.
[2 Mar 2011 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[14 Jun 2011 12:20] Martin Matuska
I can confirm this bug. It is reproducible on Solaris 10 and OpenSolaris.

MySQL version:
5.5.13

Uname output;
SunOS db8 5.10 Generic_144489-06 i86pc i386 i86pc Solaris

Compiler: Oracle Solaris Studio 12.2
CFLAGS: -xO4

Error message:
[ 12%] Building C object mysys/CMakeFiles/mysys.dir/my_rdtsc.c.o
cd /usr/ports/mysql/build/mysql-5.5.13/mysys && /opt/solstudio12.2/bin/cc  -DHAVE_RWLOCK_T -DDBUG_OFF -DHAVE_CONFIG_H -xO4 -I/usr/local/include -I/usr/ports/mysql/build/mysql-5.5.13/include -I/usr/ports/mysql/build/mysql-5.5.13/mysys   -KPIC /usr/ports/mysql/build/mysql-5.5.13/mysys/my_timer_cycles.il -o CMakeFiles/mysys.dir/my_rdtsc.c.o   -c /usr/ports/mysql/build/mysql-5.5.13/mysys/my_rdtsc.c
ube: error: Invalid argument number '0' is used in GASM Inlining
cc: ube failed for /usr/ports/mysql/build/mysql-5.5.13/mysys/my_rdtsc.c

Workaround:
do not use any -xO[0-4] optimization
[9 Sep 2011 13:55] Laurynas Biveinis
For the record, Sun Studio 12.3 beta is able to proceed past that point with optimizations turned on.
[17 Dec 2011 18:56] Valeriy Kravchuk
So, can we consider this a problem of Sun Studio 12.2 more than MySQL's code?
[19 Dec 2011 13:50] Laurynas Biveinis
It seems so:
http://wesunsolve.net/bugid/id/6984401
[4 Mar 2013 16:46] Yngve Svendsen
Problem was due to issues with Sun Studio 12.2
[16 Jun 2013 5:00] Colin MacKenzie
Verified. Error exists in SolStudio 12.2 but 12.3 compiles it fine! Thanks