SQLAdvisor icon indicating copy to clipboard operation
SQLAdvisor copied to clipboard

Ubuntu下的安装成功的步骤梳理,给大家参考

Open onlyfew opened this issue 7 years ago • 8 comments

1.拉取代码 git clone https://github.com/Meituan-Dianping/SQLAdvisor.git

2.安装依赖项

apt-get install cmake libaio-dev libffi-dev
apt-get install libglib2.0-dev
apt-get install libperconaserverclient18.1-dev
//g++不知道有没有起作用,中间各种出错后尝试安装了他
apt-get install g++

percona的安装参考 https://www.percona.com/doc/percona-server/5.6/installation/apt_repo.html

3.编译依赖项sqlparser

cmake -DBUILD_CONFIG=mysql_release -DCMAKE_BUILD_TYPE=debug -DCMAKE_INSTALL_PREFIX=/usr/local/sqlparser ./
make && make install

4.安装SQLAdvisor源码

cd SQLAdvisor/sqladvisor/
cmake -DCMAKE_BUILD_TYPE=debug ./
make
在本路径下生成一个sqladvisor可执行文件,这即是我们想要的。

onlyfew avatar Apr 11 '17 00:04 onlyfew

太感谢了,之前就卡在libperconaserverclient.so这,按照提示一下就好了

fly-robin avatar Apr 11 '17 03:04 fly-robin

你好,当我运行到最后一步时,得到如下的error:

50%] Building CXX object CMakeFiles/sqladvisor.dir/main.cc.o In file included from /usr/include/glib-2.0/glib/galloca.h:32:0, from /usr/include/glib-2.0/glib.h:30, from /SQLAdvisor/sqladvisor/main.cc:13: /usr/include/glib-2.0/glib/gtypes.h:32:24: fatal error: glibconfig.h: No such file or directory compilation terminated. CMakeFiles/sqladvisor.dir/build.make:62: recipe for target 'CMakeFiles/sqladvisor.dir/main.cc.o' failed make[2]: *** [CMakeFiles/sqladvisor.dir/main.cc.o] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/sqladvisor.dir/all' failed make[1]: *** [CMakeFiles/sqladvisor.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2

不知如何处理?

csimplestring avatar May 26 '17 14:05 csimplestring

根据你的提示,已经成功在Ubuntu 16.4 上安装成功 并把Docker镜像提交到了阿里云镜像仓库上,有后来人可以直接拿来使用 地址 https://dev.aliyun.com/detail.html?spm=5176.1972343.2.4.599c5715PozbG6&repoId=51517

leiwenjie avatar Jun 18 '17 17:06 leiwenjie

glibconfig.h: No such file or directory

解决方法(摘自README):跟据glib安装的路径,修改SQLAdvisor/sqladvisor/CMakeLists.txt中的两处include_directories针对glib设置的path。glib yum 安装默认不需要修改路径

liangry avatar Jul 07 '17 07:07 liangry

感谢

kom0055 avatar Aug 22 '17 03:08 kom0055

执行到:apt-get install libperconaserverclient18.1-dev 提示: Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package libperconaserverclient18.1-dev E: Couldn't find any package by glob 'libperconaserverclient18.1-dev' E: Couldn't find any package by regex 'libperconaserverclient18.1-dev'

google搜了一圈没解决。。很尴尬,前来这里求救

TeslaLyon avatar Dec 10 '19 08:12 TeslaLyon

你好,当我运行到最后一步时,得到如下的error:

50%] Building CXX object CMakeFiles/sqladvisor.dir/main.cc.o In file included from /usr/include/glib-2.0/glib/galloca.h:32:0, from /usr/include/glib-2.0/glib.h:30, from /SQLAdvisor/sqladvisor/main.cc:13: /usr/include/glib-2.0/glib/gtypes.h:32:24: fatal error: glibconfig.h: No such file or directory compilation terminated. CMakeFiles/sqladvisor.dir/build.make:62: recipe for target 'CMakeFiles/sqladvisor.dir/main.cc.o' failed make[2]: *** [CMakeFiles/sqladvisor.dir/main.cc.o] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/sqladvisor.dir/all' failed make[1]: *** [CMakeFiles/sqladvisor.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2

不知如何处理?

ln -sf /usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h /usr/local/sqlparser/include/glibconfig.h

michael-liumh avatar Jun 23 '21 08:06 michael-liumh

完整的安装步骤:

安装依赖

apt-get install -y gcc g++ cmake make libaio1 libaio-dev libffi-dev libglib2.0-0 libglib2.0-dev

安装 libperconaserverclient18.1-dev

apt-get install -y gnupg2 && \
wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb && \
dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb && \
rm -f percona-release_latest.$(lsb_release -sc)_all.deb && \
apt-get update && \
apt-get install -y libperconaserverclient18.1-dev

编译

cmake -DBUILD_CONFIG=mysql_release -DCMAKE_BUILD_TYPE=debug -DCMAKE_INSTALL_PREFIX=/usr/local/sqlparser ./  && \
make && make install  && \
cd sqladvisor/  && \
cmake -DCMAKE_BUILD_TYPE=debug ./

添加 glibconfig.h 软连接

ln -sf /usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h /usr/local/sqlparser/include/glibconfig.h

继续安装

make && \
mv /opt/SQLAdvisor/sqladvisor/sqladvisor /bin && \
rm -rf /opt/SQLAdvisor/

michael-liumh avatar Jun 23 '21 09:06 michael-liumh