使用git bash编译安装sysbench时遇到的坑


  Preface       When I was compiling the sysbench just now,I encountered some failures in the precedure.I'll show the issue and workaround below.   Issues   1. Executing autogen.sh script turned out to be error. [root@docker1 sysbench]# ./autogen.sh -bash: ./autogen.sh: /bin/sh^M: bad interpreter: No such file or directory [root@docker1 sysbench]# cat autogen.sh  #!/bin/sh   autoreconf -vi   Even I directly run "autoreconf -vi" command,it still showed error   [root@docker1 sysbench]# autoreconf -vi autoreconf: Entering directory `.' autoreconf: configure.ac: not using Gettext autoreconf: running: aclocal -I m4 autoreconf: configure.ac: tracing autoreconf: running: libtoolize --copy .ibtoolize: AC_CONFIG_MACRO_DIR([m4]) conflicts with ACLOCAL_AMFLAGS=-I m4 autoreconf: libtoolize failed with exit status: 1   Then,I found a workaround: https://yq.aliyun.com/articles/497392   Because I've used "git clone" to download the source package of sysbench directly without disabling the transcoding first.   After that,the shell could be executed,but when I continue to execute configure and make,there were still some errors found.   2. Executing make turned out to be error. [root@docker1 sysbench]# ./configure --with-mysql-includes=/usr/local/mysql/include --with-mysql-libs=/usr/local/mysql/lib && make && make install ... In file included from lj_ffrecord.c:1197:0: lj_recdef.h:225:1: error: ?.ecff_rawlen?.undeclared here (not in a function)  recff_rawlen,  ^ make[3]: *** [lj_ffrecord.o] Error 1 make[3]: Leaving directory `/opt/mysql/sysbench/third_party/luajit/tmp/luajit/src' make[2]: *** [src/luajit] Error 2 make[2]: Leaving directory `/opt/mysql/sysbench/third_party/luajit/tmp/luajit' make[1]: *** [lib/libluajit-5.1.a] Error 2 make[1]: Leaving directory `/opt/mysql/sysbench/third_party/luajit' make: *** [all-recursive] Error 1   [root@docker1 luajit]# pwd /opt/mysql/sysbench/third_party/luajit [root@docker1 luajit]# find . -type f -print0 | xargs -0 dos2unix
  Then,the LuaJIT issue was okay.   ==== Successfully installed LuaJIT 2.1.0-beta3 to /opt/mysql/sysbench/third_party/luajit ====   Note: the development releases deliberately do NOT install a symlink for luajit You can do this now by running this command (with sudo):     ln -sf luajit-2.1.0-beta3 /opt/mysql/sysbench/third_party/luajit/bin/luajit   make[2]: warning: Clock skew detected. Your build may be incomplete. make[2]: Leaving directory `/opt/mysql/sysbench/third_party/luajit/tmp/luajit' make[1]: warning: Clock skew detected. Your build may be incomplete. make[1]: Leaving directory `/opt/mysql/sysbench/third_party/luajit' Making all in third_party/concurrency_kit make[1]: Entering directory `/opt/mysql/sysbench/third_party/concurrency_kit' make[1]: Warning: File `Makefile' has modification time 143 s in the future rm -rf tmp mkdir tmp tar -C . -cf - ck | tar -xf - -C tmp/ chmod -R u+w tmp cd tmp/ck && \ CC="gcc -std=gnu99" \ CFLAGS="-O3 -funroll-loops -ggdb3 -march=core2 -D_GNU_SOURCE " \ LDFLAGS="-L/usr/local/lib" \   ./configure \   --prefix=/opt/mysql/sysbench/third_party/concurrency_kit && \ make && \ make install /bin/sh: ./configure: /bin/sh^M: bad interpreter: No such file or directory make[1]: *** [lib/libck.a] Error 126 make[1]: Leaving directory `/opt/mysql/sysbench/third_party/concurrency_kit' make: *** [all-recursive] Error 1   Then,I used dos2unix to transcode all the files in "/opt/mysql/sysbench/third_party" and it began to go on.But I was not be happy for long.Errors appeared one by one,faint!   lua/internal/sysbench.histogram.lua.h:137:3: warning: missing terminating " character [enabled by default] lua/internal/sysbench.histogram.lua.h:137:1: error: missing terminating " character make[2]: *** [sb_lua.o] Error 1 make[2]: Leaving directory `/opt/mysql/sysbench/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/opt/mysql/sysbench/src' make: *** [all-recursive] Error 1   This time I decided to transcode the whole files in "/opt/mysql/sysbench/src",but it turned out to be useless.Okay,then I gave up for continuing seeking the way to find it out.I downloaded the sysbench package again and disable transcoding automatically method by executing command below:   git config --global core.autocrlf false git config --global core.safecrlf true git config --global core.eol lf   Another make error shew up.   Making all in lua make[2]: Entering directory `/opt/mysql/sysbench/src/lua' make[2]: Warning: File `Makefile' has modification time 479 s in the future Making all in internal make[3]: Entering directory `/opt/mysql/sysbench/src/lua/internal' make[3]: Warning: File `Makefile' has modification time 479 s in the future make all-am make[4]: Entering directory `/opt/mysql/sysbench/src/lua/internal' make[4]: Warning: File `Makefile' has modification time 478 s in the future make[4]: Nothing to be done for `all-am'. make[4]: warning: Clock skew detected. Your build may be incomplete. make[4]: Leaving directory `/opt/mysql/sysbench/src/lua/internal' make[3]: warning: Clock skew detected. Your build may be incomplete. make[3]: Leaving directory `/opt/mysql/sysbench/src/lua/internal' make[3]: Entering directory `/opt/mysql/sysbench/src/lua' make[3]: Warning: File `Makefile' has modification time 478 s in the future make[3]: Nothing to be done for `all-am'. make[3]: warning: Clock skew detected. Your build may be incomplete. make[3]: Leaving directory `/opt/mysql/sysbench/src/lua' make[2]: warning: Clock skew detected. Your build may be incomplete. make[2]: Leaving directory `/opt/mysql/sysbench/src/lua' Making all in . make[2]: Entering directory `/opt/mysql/sysbench/src' make[2]: Warning: File `.deps/sysbench.Po' has modification time 536 s in the future make[2]: Nothing to be done for `all-am'. make[2]: warning: Clock skew detected. Your build may be incomplete. make[2]: Leaving directory `/opt/mysql/sysbench/src' make[1]: warning: Clock skew detected. Your build may be incomplete. make[1]: Leaving directory `/opt/mysql/sysbench/src' Making all in tests make[1]: Entering directory `/opt/mysql/sysbench/tests' make[1]: Warning: File `Makefile' has modification time 478 s in the future make[1]: Nothing to be done for `all'. make[1]: warning: Clock skew detected. Your build may be incomplete. make[1]: Leaving directory `/opt/mysql/sysbench/tests' make[1]: Entering directory `/opt/mysql/sysbench' make[1]: Warning: File `Makefile' has modification time 478 s in the future make[1]: Nothing to be done for `all-am'. make[1]: warning: Clock skew detected. Your build may be incomplete. make[1]: Leaving directory `/opt/mysql/sysbench' make: warning: Clock skew detected. Your build may be incomplete.   There's a solution here: http://smilejay.com/2012/08/warning-clock-skew/   But I waited for the count down over and then make it again.It was done successfully in the end.   [root@docker1 third_party]# sysbench -v sysbench 1.1.0-431660d (using bundled LuaJIT 2.1.0-beta3)