myclink程式調試筆記(1)

來源:互聯網
上載者:User

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.設定路由器網關,使探測包可以通過路由器

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.