Qihoo360 / mysql-sniffer

mysql-sniffer is a network traffic analyzer tool for mysql, it is developed by Qihoo DBA and infrastructure team
MIT License
852 stars 295 forks source link

cmake编译错误 #8

Closed keaixiaou closed 6 years ago

keaixiaou commented 7 years ago
-- Check for working C compiler: /usr/local/bin/cc
-- Check for working C compiler: /usr/local/bin/cc -- broken
CMake Error at /usr/share/cmake/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler "/usr/local/bin/cc" is not able to compile a simple test
  program.

  It fails with the following output:

   Change Dir: /root/mysql-sniffer/proj/CMakeFiles/CMakeTmp

  Run Build Command:/usr/bin/gmake "cmTryCompileExec3142220837/fast"

  /usr/bin/gmake -f CMakeFiles/cmTryCompileExec3142220837.dir/build.make
  CMakeFiles/cmTryCompileExec3142220837.dir/build

  gmake[1]: Entering directory `/root/mysql-sniffer/proj/CMakeFiles/CMakeTmp'

  /usr/bin/cmake -E cmake_progress_report
  /root/mysql-sniffer/proj/CMakeFiles/CMakeTmp/CMakeFiles 1

  Building C object
  CMakeFiles/cmTryCompileExec3142220837.dir/testCCompiler.c.o

  /usr/local/bin/cc -o
  CMakeFiles/cmTryCompileExec3142220837.dir/testCCompiler.c.o -c
  /root/mysql-sniffer/proj/CMakeFiles/CMakeTmp/testCCompiler.c

  Linking C executable cmTryCompileExec3142220837

  /usr/bin/cmake -E cmake_link_script
  CMakeFiles/cmTryCompileExec3142220837.dir/link.txt --verbose=1

  /usr/local/bin/cc
  CMakeFiles/cmTryCompileExec3142220837.dir/testCCompiler.c.o -o
  cmTryCompileExec3142220837 -rdynamic

  collect2: error: ld terminated with signal 11 [段错误]

  gmake[1]: Leaving directory `/root/mysql-sniffer/proj/CMakeFiles/CMakeTmp'

  gmake[1]: *** [cmTryCompileExec3142220837] 错误 1

  gmake: *** [cmTryCompileExec3142220837/fast] 错误 2
keaixiaou commented 7 years ago

升级binutils ,安装devtoolset-2-binutils-2.23.52.0.1-10就好了。 用yum安装devtoolset-2-binutils很有可能下载失败,可以直接去http://rpm.pbone.net/index.php3/stat/4/idpl/25935266/dir/scientific_linux_6/com/devtoolset-2-binutils-2.23.52.0.1-10.el6.x86_64.rpm.html 直接下载,然后 rpm -ivh devtoolset-2-binutils-2.23.52.0.1-10.el6.x86_64.rpm直接安装,执行后会安装到/opt/rh里, 可以做一个软连接ln -s /opt/rh/devtoolset-2/root/usr/bin/* /usr/local/bin/ 再安装mysql-sniffer就没有问题了。 如果有人碰到类似问题,或者Error: expecting string instruction after `rep' 这样的报错,可以通过上面方法解决。