Friday, September 08, 2006

MySQL Benchmarking 3: Installing Sysbench on Solaris 10

So I have been really busy lately dealing with a bunch of stuff including having to reset replication (twice) on some of the slaves that started lagging behind seriously. While I am determined to find and fix this replication lag issue, the majority of it comes from the huge spec differences between the master and the slaves.

Anyway, yesterday I got my plane ticket to go to MySQL Camp which is really exciting. I will be arriving there on Thursday night and leaving Sunday night on an overnight flight.

Last time when I blogged I was writing about MySQL benchmarking, so I will try to pick up where I left off.

I was having some compile issues when trying to compile sysbench on Solaris. When I was running ./configure I was getting the following warnings:

###############################
./configure output
###############################
configure: WARNING: signal.h: present but cannot be compiled
configure: WARNING: signal.h: check for missing prerequisite headers?
configure: WARNING: signal.h: see the Autoconf documentation
configure: WARNING: signal.h: section "Present But Cannot Be Compiled"
configure: WARNING: signal.h: proceeding with the preprocessor's result
configure: WARNING: signal.h: in the future, the compiler will take precedence
configure: WARNING: ## -------------------------------- ##
configure: WARNING: ## Report this to alexeyk at mysql dot com ##
configure: WARNING: ## -------------------------------- ##
configure: WARNING: thread.h: present but cannot be compiled
configure: WARNING: thread.h: check for missing prerequisite headers?
configure: WARNING: thread.h: see the Autoconf documentation
configure: WARNING: thread.h: section "Present But Cannot Be Compiled"
configure: WARNING: thread.h: proceeding with the preprocessor's result
configure: WARNING: thread.h: in the future, the compiler will take precedence
configure: WARNING: ## -------------------------------- ##
configure: WARNING: ## Report this to alexeyk at mysql dot com ##
configure: WARNING: ## -------------------------------- ##

#############################


Eventually the warnings went away when I used cc instead of gcc.

Running make after configure was producing
###########################
output of make
###########################
Making all in doc
make[1]: Entering directory `/home/fmashraqi/install/bench/sysbench-0.4.7/doc'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/fmashraqi/install/bench/sysbench-0.4.7/doc'
Making all in scripts
make[1]: Entering directory `/home/fmashraqi/install/bench/sysbench-0.4.7/scripts'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/fmashraqi/install/bench/sysbench-0.4.7/scripts'
Making all in sysbench
make[1]: Entering directory `/home/fmashraqi/install/bench/sysbench-0.4.7/sysbench'
Making all in drivers
make[2]: Entering directory `/home/fmashraqi/install/bench/sysbench-0.4.7/sysbench/drivers'
Making all in mysql
make[3]: Entering directory `/home/fmashraqi/install/bench/sysbench-0.4.7/sysbench/drivers/mysql'
if gcc -DHAVE_CONFIG_H -I. -I. -I../../../config -I/usr/local/mysql/include -xO3 -mt -D_FORTEC_ -xarch=v9 -xc99=none -I../.. -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -D_REENTRANT -g -O2 -MT libsbmysql_a-drv_mysql.o -MD -MP -MF ".deps/libsbmysql_a-drv_mysql.Tpo" -c -o libsbmysql_a-drv_mysql.o `test -f 'drv_mysql.c' || echo './'`drv_mysql.c; then mv -f ".deps/libsbmysql_a-drv_mysql.Tpo" ".deps/libsbmysql_a-drv_mysql.Po"; else rm -f ".deps/libsbmysql_a-drv_mysql.Tpo"; exit 1; fi
gcc: language c99=none not recognized
gcc: drv_mysql.c: linker input file unused because linking not done
mv: cannot access .deps/libsbmysql_a-drv_mysql.Tpo
make[3]: *** [libsbmysql_a-drv_mysql.o] Error 2
make[3]: Leaving directory `/home/fmashraqi/install/bench/sysbench-0.4.7/sysbench/drivers/mysql'
make[2 ]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/fmashraqi/install/bench/sysbench-0.4.7/sysbench/drivers'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/fmashraqi/install/bench/sysbench-0.4.7/sysbench'
make: *** [all-recursive] Error 1


######################################


The problem was the flag
-xc99=none

which I removed using the following one liner
find . -name Makefile -print | while read i; do  sed -e "s/-xc99=none//g" $i > $i.orig; mv $i.orig $i; done


Then I started getting
Making all in .
make[2]: Entering directory `/home/fmashraqi/install/bench/sysbench-0.4.7/sysbench'
/bin/bash ../libtool --tag=CC --mode=link /opt/SUNWspro/bin/cc -D_REENTRANT -g -lpthread -o sysbench -static sysbench.o sb_timer.o sb_options.o sb_logger.o db_driver.o tests/fileio/libsbfileio.a tests/threads/libsbthreads.a tests/memory/libsbmemory.a tests/cpu/libsbcpu.a tests/oltp/libsboltp.a tests/mutex/libsbmutex.a drivers/mysql/libsbmysql.a -xarch=v9 -L/usr/local/mysql/lib -lmysqlclient_r -lz -lposix4 -lcrypt -lgen -lsocket -lnsl -lm -lmtmalloc -lrt -lm
/opt/SUNWspro/bin/cc -D_REENTRANT -g -o sysbench sysbench.o sb_timer.o sb_options.o sb_logger.o db_driver.o -xarch=v9 -lpthread tests/fileio/libsbfileio.a tests/threads/libsbthreads.a tests/memory/libsbmemory.a tests/cpu/libsbcpu.a tests/oltp/libsboltp.a tests/mutex/libsbmutex.a drivers/mysql/libsbmysql.a -L/usr/local/mysql/lib -lmysqlclient_r -lz -lposix4 -lcrypt -lgen -lsocket -lnsl -lmtmalloc -lrt -lm
ld: fatal: file sysbench.o: wrong ELF class: ELFCLASS32
ld: fatal: File processing errors. No output written to sysbench


The reason for these errros was the conflict when trying to link 32-bit binaries with 64-bit binaries. To address that issue, I set the following in my environment.
CFLAGS=-xarch=v9

Then I tried to build once again. Here's the summarized process


# Removed the current sysbench source directory
rm -r -f sysbench-0.4.7
# Extracted a fresh copy from the tarball.
tar -xf sysbench-0.4.7.tar
# Changed my pwd to sysbench-0.4.7
cd sysbench-0.4.7
# Set up my environment
CC=/opt/SUNWspro/bin/cc
CFLAGS=-xarch=v9
LD_LIBRARY_PATH=/usr/local/mysql/lib:/usr/ccs/lib:/usr/lib:/usr/local/lib:/lib:/usr/ucblib
PATH=/opt/SUNWspro/bin:/opt/SUNWspro/bin:/usr/sbin:/usr/bin:/usr/local/bin:.:/usr/ccs/bin:/usr/local/mysql/bin:/usr/local/bin:.:/usr/ccs/bin:/usr/local/mysql/bin
# Cleaned out -xc99=none which was being produced by mysql_config by using a slightly modified version of the one liner recommended in this thread
find . -name Makefile -print | while read i; do sed -e "s/-xc99=none//g" $i > $i.orig; mv $i.orig $i; done
# run make
make
# finally install
make install


This time it worked! Yay!

Here's how my environment was setup
TERM=xterm
SHELL=/sbin/sh
SSH_CLIENT=192.168.1.11 34203 22
OLDPWD=/home/fmashraqi/install/bench/sysbench-0.4.7/sysbench
SSH_TTY=/dev/pts/5
USER=root
LD_LIBRARY_PATH=/usr/local/mysql/lib:/usr/ccs/lib:/usr/lib:/usr/local/lib:/lib:/usr/ucblib
PATH=/opt/SUNWspro/bin:/opt/SUNWspro/bin:/usr/sbin:/usr/bin:/usr/local/bin:.:/usr/ccs/bin:/usr/local/mysql/bin:/usr/local/bin:.:/usr/ccs/bin:/usr/local/mysql/bin
MAIL=/var/mail//root
PWD=/home/fmashraqi/install/bench/sysbench-0.4.7
TZ=US/Eastern
PS1=[\u@\h:\w]
SHLVL=1
HOME=/
CFLAGS=-xarch=v9
LOGNAME=root
SSH_CONNECTION=192.168.1.11 34203 192.168.1.192 22
CC=/opt/SUNWspro/bin/cc
_=/usr/bin/env


Now let's run sysbench and do a test run
[root@db32:/home/fmashraqi/install/bench/sysbench-0.4.7] sysbench --test=cpu --cpu-max-prime=20000 run
sysbench v0.4.7: multi-threaded system evaluation benchmark

Running the test with following options:
Number of threads: 1

Doing CPU performance benchmark

Threads started!
Done.

Maximum prime number checked in CPU test: 20000


Test execution summary:
total time: 281.8175s
total number of events: 10000
total time taken by event execution: 281.8014
per-request statistics:
min: 0.0281s
avg: 0.0282s
max: 0.0369s
approx. 95 percentile: 0.0283s

Threads fairness:
events (avg/stddev): 10000.0000/0.00
execution time (avg/stddev): 281.8014/0.00

Many thanks to folks at Sun and OpenSolaris.org for their assistance.

References:
Wrong ELF Class
Porting from Solaris to RedHat
Downloading cc (as part of Sun Studio 11)
Sun Studio 11
Compiling Sysbench on Solaris 10

Previously:
MySQL Benchmarking Part 1
MySQL Benchmarking Part 2

Some additional tips:
MySQL compile flags
[$] /usr/local/mysql/bin/mysql_config --cflags
-I/usr/local/mysql/include -xO3 -mt -D_FORTEC_ -xarch=v9 -xc99=none

The -xarch=v9 is a 64-bit flag
Don't confuse CC (C++) with cc.
-O2 -MT -MB are gcc options whereas -xO3 -md -xarch are cc options

6 comments:

Anonymous said...

reference what you mentioned. But it can't make because of the following!
Making all in doc
Making all in scripts
Making all in sysbench
Making all in drivers
Making all in mysql
source='drv_mysql.c' object='libsbmysql_a-drv_mysql.o' libtool=no \
DEPDIR=.deps depmode=none /bin/bash ../../../config/depcomp \
cc -DHAVE_CONFIG_H -I. -I. -I../../../config -I/opt/mysql/mysql/include -mt -D_FORTEC_ -xarch=v9 -I../.. -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -D_REENTRANT -g -c -o libsbmysql_a-drv_mysql.o `test -f 'drv_mysql.c' || echo './'`drv_mysql.c
"drv_mysql.c", line 398: undefined symbol: ulong
"drv_mysql.c", line 398: syntax error before or at: 1
"drv_mysql.c", line 409: cannot recover from previous errors
cc: acomp failed for drv_mysql.c
*** Error code 2
make: Fatal error: Command failed for target `libsbmysql_a-drv_mysql.o'
Current working directory /opt/soft/sysbench-0.4.8/sysbench/drivers/mysql
*** Error code 1
The following command caused the error:
failcom='exit 1'; \
for f in x $MAKEFLAGS; do \
case $f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo all-recursive | sed s/-recursive//`; \
list='mysql '; for subdir in $list; do \
echo "Making $target in $subdir"; \
if test "$subdir" = "."; then \
dot_seen=yes; \
local_target="$target-am"; \
else \
local_target="$target"; \
fi; \
(cd $subdir && make $local_target) \
|| eval $failcom; \
done; \
if test "$dot_seen" = "no"; then \
make "$target-am" || exit 1; \
fi; test -z "$fail"
make: Fatal error: Command failed for target `all-recursive'
Current working directory /opt/soft/sysbench-0.4.8/sysbench/drivers
*** Error code 1
The following command caused the error:
failcom='exit 1'; \
for f in x $MAKEFLAGS; do \
case $f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo all-recursive | sed s/-recursive//`; \
list='drivers tests .'; for subdir in $list; do \
echo "Making $target in $subdir"; \
if test "$subdir" = "."; then \
dot_seen=yes; \
local_target="$target-am"; \
else \
local_target="$target"; \
fi; \
(cd $subdir && make $local_target) \
|| eval $failcom; \
done; \
if test "$dot_seen" = "no"; then \
make "$target-am" || exit 1; \
fi; test -z "$fail"
make: Fatal error: Command failed for target `all-recursive'
Current working directory /opt/soft/sysbench-0.4.8/sysbench
*** Error code 1
The following command caused the error:
failcom='exit 1'; \
for f in x $MAKEFLAGS; do \
case $f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo all-recursive | sed s/-recursive//`; \
list='doc scripts sysbench'; for subdir in $list; do \
echo "Making $target in $subdir"; \
if test "$subdir" = "."; then \
dot_seen=yes; \
local_target="$target-am"; \
else \
local_target="$target"; \
fi; \
(cd $subdir && make $local_target) \
|| eval $failcom; \
done; \
if test "$dot_seen" = "no"; then \
make "$target-am" || exit 1; \
fi; test -z "$fail"
make: Fatal error: Command failed for target `all-recursive

Anonymous said...

making failed with the following:
Making all in doc
Making all in scripts
Making all in sysbench
Making all in drivers
Making all in mysql
source='drv_mysql.c' object='libsbmysql_a-drv_mysql.o' libtool=no \
DEPDIR=.deps depmode=none /bin/bash ../../../config/depcomp \
cc -DHAVE_CONFIG_H -I. -I. -I../../../config -I/opt/mysql/mysql/include -mt -D_FORTEC_ -xarch=v9 -I../.. -D_REENTRANT -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -D_REENTRANT -g -c -o libsbmysql_a-drv_mysql.o `test -f 'drv_mysql.c' || echo './'`drv_mysql.c
"drv_mysql.c", line 398: undefined symbol: ulong
"drv_mysql.c", line 398: syntax error before or at: 1
"drv_mysql.c", line 409: cannot recover from previous errors
cc: acomp failed for drv_mysql.c
*** Error code 2
make: Fatal error: Command failed for target `libsbmysql_a-drv_mysql.o'
Current working directory /opt/soft/sysbench-0.4.8/sysbench/drivers/mysql
*** Error code 1
The following command caused the error:
failcom='exit 1'; \
for f in x $MAKEFLAGS; do \
case $f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo all-recursive | sed s/-recursive//`; \
list='mysql '; for subdir in $list; do \
echo "Making $target in $subdir"; \
if test "$subdir" = "."; then \
dot_seen=yes; \
local_target="$target-am"; \
else \
local_target="$target"; \
fi; \
(cd $subdir && make $local_target) \
|| eval $failcom; \
done; \
if test "$dot_seen" = "no"; then \
make "$target-am" || exit 1; \
fi; test -z "$fail"
make: Fatal error: Command failed for target `all-recursive'
Current working directory /opt/soft/sysbench-0.4.8/sysbench/drivers
*** Error code 1
The following command caused the error:
failcom='exit 1'; \
for f in x $MAKEFLAGS; do \
case $f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo all-recursive | sed s/-recursive//`; \
list='drivers tests .'; for subdir in $list; do \
echo "Making $target in $subdir"; \
if test "$subdir" = "."; then \
dot_seen=yes; \
local_target="$target-am"; \
else \
local_target="$target"; \
fi; \
(cd $subdir && make $local_target) \
|| eval $failcom; \
done; \
if test "$dot_seen" = "no"; then \
make "$target-am" || exit 1; \
fi; test -z "$fail"
make: Fatal error: Command failed for target `all-recursive'
Current working directory /opt/soft/sysbench-0.4.8/sysbench
*** Error code 1
The following command caused the error:
failcom='exit 1'; \
for f in x $MAKEFLAGS; do \
case $f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo all-recursive | sed s/-recursive//`; \
list='doc scripts sysbench'; for subdir in $list; do \
echo "Making $target in $subdir"; \
if test "$subdir" = "."; then \
dot_seen=yes; \
local_target="$target-am"; \
else \
local_target="$target"; \
fi; \
(cd $subdir && make $local_target) \
|| eval $failcom; \
done; \
if test "$dot_seen" = "no"; then \
make "$target-am" || exit 1; \
fi; test -z "$fail"
make: Fatal error: Command failed for target `all-recursive

Frank said...

Dear anonymous,

The problem is, if you don't tell me what your system is and how to contact you to find more about your environment, I really cannot be of any help.

Frank

Anonymous said...

#uname -a
SunOS alustdby 5.10 Generic_118833-24 sun4v sparc SUNW,Sun-Fire-T200

email:davidli@sohu-inc.com

Anonymous said...

Hi All,

I've been trying to compile sysbench on a Sunos platform for a few days now and I've had no luck. I think I am having some library compatibility issues but I am not sure how to resolve.

Here is a summary of my problem. I've configured and tried to run make with/without SunStudio's cc. I have also tried directly putting in the --with-mysql-libs and --with-mysql-includes directives to configure but I get the same result.

When I run make it stops at the following line:
--------------------
mkdir .libs
/opt/SUNWspro/bin/cc -D_REENTRANT -xarch=v9 -o sysbench sysbench.o sb_timer.o sb_options.o sb_logger.o db_driver.o -lpthread tests/fileio/libsbfileio.a tests/threads/libsbthreads.a tests/memory/libsbmemory.a tests/cpu/libsbcpu.a tests/oltp/libsboltp.a tests/mutex/libsbmutex.a drivers/mysql/libsbmysql.a -L/web/sw/src/mysql-4.1.21/libmysql/ -lmysqlclient_r -lrt -lm
cc: Warning: illegal option -xarch=v9
Undefined first referenced
symbol in file
mysql_stmt_param_count drivers/mysql/libsbmysql.a(libsbmysql_a-drv_mysql.o)
mysql_stmt_store_result drivers/mysql/libsbmysql.a(libsbmysql_a-drv_mysql.o)
mysql_stmt_close drivers/mysql/libsbmysql.a(libsbmysql_a-drv_mysql.o)
mysql_stmt_fetch drivers/mysql/libsbmysql.a(libsbmysql_a-drv_mysql.o)
mysql_stmt_free_result drivers/mysql/libsbmysql.a(libsbmysql_a-drv_mysql.o)
mysql_stmt_bind_result drivers/mysql/libsbmysql.a(libsbmysql_a-drv_mysql.o)
mysql_stmt_num_rows drivers/mysql/libsbmysql.a(libsbmysql_a-drv_mysql.o)
mysql_stmt_prepare drivers/mysql/libsbmysql.a(libsbmysql_a-drv_mysql.o)
mysql_stmt_bind_param drivers/mysql/libsbmysql.a(libsbmysql_a-drv_mysql.o)
mysql_stmt_execute drivers/mysql/libsbmysql.a(libsbmysql_a-drv_mysql.o)
mysql_stmt_init drivers/mysql/libsbmysql.a(libsbmysql_a-drv_mysql.o)
ld: fatal: Symbol referencing errors. No output written to sysbench
*** Error code 1
make: Fatal error: Command failed for target `sysbench'


------------------------
uname -a: SunOS onsetdb2.freedom.com 5.10 Generic_118855-36 i86pc i386 i86pc

isainfo -v: 64-bit amd64 applications
sse3 sse2 sse fxsr amd_3dnowx amd_3dnow amd_mmx mmx cmov amd_sysc cx8
tsc fpu
32-bit i386 applications
sse3 sse2 sse fxsr amd_3dnowx amd_3dnow amd_mmx mmx cmov amd_sysc cx8
tsc fpu

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

Any ideas? Can anyone help me with this?


Thanks!
-Carlos

Anonymous said...

i know 2006 was a long time ago, but I am having similar errors compiling sysbench 0.4.12 on Solaris 11 (b127). I followed your example very closely, (using /opt/SUNWspro/bin/cc and your flags but when I run make I get:



GNU_SOURCE -I../sysbench -D_REENTRANT -g -c db_driver.c
/bin/bash ../libtool --tag=CC --mode=link cc -D_REENTRANT -g -lumem -o sysbench sysbench.o sb_timer.o sb_options.o sb_logger.o db_driver.o tests/fileio/libsbfileio.a tests/threads/libsbthreads.a tests/memory/libsbmemory.a tests/cpu/libsbcpu.a tests/oltp/libsboltp.a tests/mutex/libsbmutex.a drivers/mysql/libsbmysql.a -R/usr/sfw/lib -R/usr/sfw/lib/mysql -L/usr/sfw/lib -L/usr/sfw/lib/mysql -lmysqlclient_r -lz -lcrypt -lgen -lsocket -lnsl -lm -lm
../libtool: line 836: X--tag=CC: command not found
../libtool: line 869: libtool: ignoring unknown tag : command not found
../libtool: line 836: X--mode=link: command not found
../libtool: line 1002: *** Warning: inferring the mode of operation is deprecated.: command not found
../libtool: line 1003: *** Future versions of Libtool will require --mode=MODE be specified.: command not found
../libtool: line 2229: X-D_REENTRANT: command not found
../libtool: line 2229: X-g: command not found
../libtool: line 2133: X-R/usr/sfw/lib: No such file or directory
../libtool: line 2138: libtool: link: only absolute run-paths are allowed: command not found
make[2]: *** [sysbench] Error 1
make[2]: Leaving directory `/export/home/mysql/benchmarks/sysbench-0.4.12/sysbench'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/export/home/mysql/benchmarks/sysbench-0.4.12/sysbench'
make: *** [all-recursive] Error 1

any clues? I can try it in Sol10 later.