pTop --linux 错误处理
问题一:
when I try to compile pTop I get the following message: cc -c -o src/avltree.o src/avltree.c In file included from src/avltree.c:12: src/eperf.h:
In function 'sys_perf_event_open':
src/eperf.h:32: error: '__NR_perf_counter_open' undeclared (first use in this function)
src/eperf.h:32: error: (Each undeclared identifier is reported only once src/eperf.h:32: error: for each function it appears in.)
make: *** [src/avltree.o] Erro
解决方法:
although the kernel version was above the required linux-headers were outdated.
Updating linux-headers to match the kernel version solved the issue.
Also had to rename the system call in pTop code, but this was already documented in the readme file.
具体做法:
1、yum update kernel-devel
2、查看 see the file "/usr/include/asm/unistd_32.h" or "/usr/include/asm/unistd_64.h".中有哪个system call
"__NR_perf_counter_open"(in the latest version, the name is "__NR_perf_event_open")
3、修改源代码中的系统调用
问题二:
找不到<mysql/mysql.h>
解决方法:
安装mysql的时候没有将头文件放入到/usr/include文件夹里。sudo cp -r /usr/local/mysql/include /usr/include/mysql
问题三:
error: /usr/bin/ld: cannot find -lmysqlclient
解决方法:
将mysql下的bin目录的所有文件拷贝到/usr/lib下
问题四:
运行的时候出错: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory ===================================================
解决方法:
网上找到的解决办法是 ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/ 照做后仍然报错,原因是该方法适用于32位系统,64位系统应使用下面的这行 ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/ 另外:在编译的时候,不写mysql的路径,而使用mysqlnd代替,也可解决该问题的出现。