查看编译帮助:
[root@node2 super-smack-1.2]# ./configure --help
Usage: configure [options] [host]
Options: [defaults in brackets after descriptions]
Configuration:
--cache-file=FILE cache test results in FILE
--help print this message
--no-create do not create output files
--quiet, --silent do not print `checking...' messages
--version print the version of autoconf that created configure
Directory and file names:
--prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[same as prefix]
--bindir=DIR user executables in DIR [EPREFIX/bin]
--sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
--libexecdir=DIR program executables in DIR [EPREFIX/libexec]
--datadir=DIR read-only architecture-independent data in DIR
[PREFIX/share]
--sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data in DIR
[PREFIX/com]
--localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
--libdir=DIR object code libraries in DIR [EPREFIX/lib]
--includedir=DIR C header files in DIR [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
--infodir=DIR info documentation in DIR [PREFIX/info]
--mandir=DIR man documentation in DIR [PREFIX/man]
--srcdir=DIR find the sources in DIR [configure dir or ..]
--program-prefix=PREFIX prepend PREFIX to installed program names
--program-suffix=SUFFIX append SUFFIX to installed program names
--program-transform-name=PROGRAM
run sed PROGRAM on installed program names
Host type:
--build=BUILD configure for building on BUILD [BUILD=HOST]
--host=HOST configure for HOST [guessed]
--target=TARGET configure for TARGET [TARGET=HOST]
Features and packages:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--x-includes=DIR X include files are in DIR
--x-libraries=DIR X library files are in DIR
--enable and --with options recognized:
--with-datadir=DIR Specify default smack datadir
--with-smacks-dir=DIR Directory to install example smacks
--with-mysql Build with MySQL support
--with-pgsql Build with PostgreSQL support
--with-oracle Build with Oracle support
--with-mysql-lib=DIR Look for MySQL client library in DIR
--with-mysql-include=DIR
Look for MySQL include files in DIR
--with-pgsql-lib=DIR Look for PostgreSQL client library in DIR
--with-pgsql-include=DIR
Look for PostgreSQL include files in DIR
编译:
[root@node2 super-smack-1.2]# ./configure --prefix=/usr/local/super-smack --with-mysql --with-mysql-lib=/usr/local/mysql/lib/ --with-smacks-dir=/usr/local/super-smack --with-mysql-include=/usr/local/mysql/include
[root@node2 super-smack-1.2]# make && make install
报错解决:
错误1:
dictionary.h:93:28: error: ‘strlen’ was not declared in this scop
super-smack.cc:126:55: error: ‘strlen’ was not declared in this scope
在src文件 dictionary.h、super-smack.cc 的头文件引用中加入 #include <string.h>
错误2:
query.cc:199:20: error: cast from ‘char*’ to ‘unsigned int’ loses precision [-fpermissive]
query.cc:199:62: error: cast from ‘char*’ to ‘unsigned int’ loses precision [-fpermissive]
query.cc:218:19: error: cast from ‘char*’ to ‘unsigned int’ loses precision [-fpermissive]
query.cc:218:33: error: cast from ‘char*’ to ‘unsigned int’ loses precision [-fpermissive]
修改文件query.cc 199、218行的unsigned 修改为unsigned long
使用super-smack:
[root@node2 super-smack]# pwd
/usr/local/super-smack
[root@node2 super-smack]# ls
bin select-key.smack update-select.smack
修改select-key.smack update-select.smack的对用的mysql.sock路径、user、host、pass、words.dat修改为http_auth.dat
生成测试数据:
[root@node2 super-smack]# bin/gen-data -n 90000 -f %12-12s%n,%25-25s,%n,%d >/var/smack-data/http_auth.dat
测试select:
[root@node2 super-smack]# bin/super-smack -d mysql select-key.smack 10 1000
Table 'http_auth' does not meet condtions, will be dropped
Creating table 'http_auth'
Loading data from file '/var/smack-data/http_auth.dat' into table 'http_auth'
Table http_auth is now ready for the test
Query Barrel Report for client smacker1
connect: max=21ms min=0ms avg= 5ms from 10 clients
Query_type num_queries max_time min_time q_per_s
select_index 20000 0 0 32511.66
测试遇到错误:
错误1:
error while loading shared libraries: libmysqlclient.so.20
find / -name 'libmysqlclient*'
ln -s /usr/local/mysql/lib/libmysqlclient.so.20 /usr/local/lib/libmysqlclient.so.20
/usr/local/lib
/sbin/ldconfig -v
错误2:
The Mysql server is running with the --secure-file-priv option so it cannot execute this statement
添加secure-file-priv='' 到my.cnf