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