myclink程序调试笔记(1)

gcc -o clink $(./mysql_config --cflags) process.c source_db.c util.c collect.c clink.h $(./mysql_config --libs)生成可执行文件后,

代码编译的时候没有出现错误,运行的时候提示:
./clink: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
然后我输入: ldd clink,发现 libmysqlclient.so.18已经正常加载,提示如下:
joyce@ubuntu:~/workspace/clink.1.0$ ldd clink
    linux-gate.so.1 =>  (0x00b2e000)
    libmysqlclient.so.18 => /usr/local/mysql/lib/libmysqlclient.so.18 (0x007de000)
    libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0x00110000)
    libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0x00129000)
    librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0x0014f000)
    libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0x005a1000)
    libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0x0026f000)
    /lib/ld-linux.so.2 (0x00463000)

这就排除了文件没有加载的可能性;

使用软连接:

ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18

再执行程序,成功!

显示:

clink to 127.0.0.1 (127.0.0.1)
  8 probes at each of 93 sizes (28 to 1500 by 16)
0 localhost
|       n=  744  lat= 0.010 ms  bw= (-38818.172, 7728.663, 3377.487) Mb/s
1 localhost (127.0.0.1)
Connected to database myclink
 ===============================
INSERT INTO myclink VALUES (2, now(), 'Localhost', 'sock_ntop_host: unknown AF_xxx: 0, len 16', 0.010126, 1.000000, 7728.663063)
[INSERT INTO myclink VALUES (2, now(), 'Localhost', 'sock_ntop_host: unknown AF_xxx: 0, len 16', 0.010126, 1.000000, 7728.663063)] made insert succeed


现在遇到的问题是:1.怎么把ip地址提取出来,还有时间如何存储在result中,并打印输出;(已解决)

                                 2.数据库内容要改,增加ttl值,(已解决)

         3.输出时,数据库显示要改,没有对齐位置

         4.设置路由器网关,使探测包可以通过路由器



你可能感兴趣的:(myclink程序调试笔记(1))