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

Mac下如何安装? #12

Closed phoenixg closed 6 years ago

phoenixg commented 7 years ago
# phx at phx.local in ~/mine/softwares/mysql-sniffer/proj on git:master ● [5:58:52]
→ cmake ../
-- The C compiler identification is AppleClang 8.1.0.8020038
-- The CXX compiler identification is AppleClang 8.1.0.8020038
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
rm -f *.o *~ libnids.a libnids.so.1.24
gcc -c -g -O2 -D_BSD_SOURCE -DLIBNET_VER=1 -DHAVE_ICMPHDR=1 -DHAVE_TCP_STATES=1 -DHAVE_BSD_UDPHDR=1 -DENABLE_TCPREASM=1 -I. -I/usr/include/pcap -D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD -DHAVE_NET_ETHERNET_H -DENABLE_TCPREASM -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include   -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib64/glib-2.0/include  checksum.c
gcc -c -g -O2 -D_BSD_SOURCE -DLIBNET_VER=1 -DHAVE_ICMPHDR=1 -DHAVE_TCP_STATES=1 -DHAVE_BSD_UDPHDR=1 -DENABLE_TCPREASM=1 -I. -I/usr/include/pcap -D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD -DHAVE_NET_ETHERNET_H -DENABLE_TCPREASM -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include   -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib64/glib-2.0/include  ip_fragment.c
gcc -c -g -O2 -D_BSD_SOURCE -DLIBNET_VER=1 -DHAVE_ICMPHDR=1 -DHAVE_TCP_STATES=1 -DHAVE_BSD_UDPHDR=1 -DENABLE_TCPREASM=1 -I. -I/usr/include/pcap -D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD -DHAVE_NET_ETHERNET_H -DENABLE_TCPREASM -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include   -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib64/glib-2.0/include  ip_options.c
gcc -c -g -O2 -D_BSD_SOURCE -DLIBNET_VER=1 -DHAVE_ICMPHDR=1 -DHAVE_TCP_STATES=1 -DHAVE_BSD_UDPHDR=1 -DENABLE_TCPREASM=1 -I. -I/usr/include/pcap -D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD -DHAVE_NET_ETHERNET_H -DENABLE_TCPREASM -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include   -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib64/glib-2.0/include  killtcp.c
gcc -c -g -O2 -D_BSD_SOURCE -DLIBNET_VER=1 -DHAVE_ICMPHDR=1 -DHAVE_TCP_STATES=1 -DHAVE_BSD_UDPHDR=1 -DENABLE_TCPREASM=1 -I. -I/usr/include/pcap -D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD -DHAVE_NET_ETHERNET_H -DENABLE_TCPREASM -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include   -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib64/glib-2.0/include  libnids.c
libnids.c:682:3: warning: 'g_thread_init' is deprecated [-Wdeprecated-declarations]
         g_thread_init(NULL);
         ^
/usr/local/include/glib-2.0/glib/deprecated/gthread.h:265:10: note: 'g_thread_init' has been explicitly marked deprecated here
void     g_thread_init                   (gpointer vtable);
         ^
libnids.c:699:5: warning: 'g_thread_create_full' is deprecated [-Wdeprecated-declarations]
    START_CAP_QUEUE_PROCESS_THREAD(); /* threading... */
    ^
libnids.c:555:8: note: expanded from macro 'START_CAP_QUEUE_PROCESS_THREAD'
         if(!(g_thread_create_full((GThreadFunc)cap_queue_process_thread,NULL,0,FALSE,TRUE,G_THREAD_PRIORITY_LOW,&gerror))) { \
              ^
/usr/local/include/glib-2.0/glib/deprecated/gthread.h:110:10: note: 'g_thread_create_full' has been explicitly marked deprecated here
GThread *g_thread_create_full  (GThreadFunc       func,
         ^
libnids.c:759:5: warning: 'g_thread_create_full' is deprecated [-Wdeprecated-declarations]
    START_CAP_QUEUE_PROCESS_THREAD();
    ^
libnids.c:555:8: note: expanded from macro 'START_CAP_QUEUE_PROCESS_THREAD'
         if(!(g_thread_create_full((GThreadFunc)cap_queue_process_thread,NULL,0,FALSE,TRUE,G_THREAD_PRIORITY_LOW,&gerror))) { \
              ^
/usr/local/include/glib-2.0/glib/deprecated/gthread.h:110:10: note: 'g_thread_create_full' has been explicitly marked deprecated here
GThread *g_thread_create_full  (GThreadFunc       func,
         ^
libnids.c:773:5: warning: 'g_thread_create_full' is deprecated [-Wdeprecated-declarations]
    START_CAP_QUEUE_PROCESS_THREAD(); /* threading... */
    ^
libnids.c:555:8: note: expanded from macro 'START_CAP_QUEUE_PROCESS_THREAD'
         if(!(g_thread_create_full((GThreadFunc)cap_queue_process_thread,NULL,0,FALSE,TRUE,G_THREAD_PRIORITY_LOW,&gerror))) { \
              ^
/usr/local/include/glib-2.0/glib/deprecated/gthread.h:110:10: note: 'g_thread_create_full' has been explicitly marked deprecated here
GThread *g_thread_create_full  (GThreadFunc       func,
         ^
4 warnings generated.
gcc -c -g -O2 -D_BSD_SOURCE -DLIBNET_VER=1 -DHAVE_ICMPHDR=1 -DHAVE_TCP_STATES=1 -DHAVE_BSD_UDPHDR=1 -DENABLE_TCPREASM=1 -I. -I/usr/include/pcap -D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD -DHAVE_NET_ETHERNET_H -DENABLE_TCPREASM -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include   -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib64/glib-2.0/include  scan.c
gcc -c -g -O2 -D_BSD_SOURCE -DLIBNET_VER=1 -DHAVE_ICMPHDR=1 -DHAVE_TCP_STATES=1 -DHAVE_BSD_UDPHDR=1 -DENABLE_TCPREASM=1 -I. -I/usr/include/pcap -D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD -DHAVE_NET_ETHERNET_H -DENABLE_TCPREASM -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include   -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib64/glib-2.0/include  tcp.c
In file included from tcp.c:23:
./hash.h:1:9: warning: '_HASH_H_' is used as a header guard here, followed by #define of a different macro [-Wheader-guard]
#ifndef _HASH_H_
        ^~~~~~~~
./hash.h:2:9: note: '_HAHS_H_' is defined here; did you mean '_HASH_H_'?
#define _HAHS_H_
        ^~~~~~~~
        _HASH_H_
tcp.c:417:16: error: use of undeclared identifier 'TCP_ESTABLISHED'
        half->state = TCP_ESTABLISHED;
                      ^
tcp.c:427:22: error: use of undeclared identifier 'TCP_ESTABLISHED'
        other_half->state = TCP_ESTABLISHED;
                            ^
tcp.c:506:27: error: use of undeclared identifier 'TCP_SYN_SENT'
    a_tcp->client.state = TCP_SYN_SENT;
                          ^
tcp.c:512:27: error: use of undeclared identifier 'TCP_CLOSE'
    a_tcp->server.state = TCP_CLOSE;
                          ^
tcp.c:704:23: error: use of undeclared identifier 'TCP_CLOSING'
    if (rcv->state == TCP_CLOSING)
                      ^
tcp.c:782:20: error: use of undeclared identifier 'TCP_CLOSING'
      snd->state = TCP_CLOSING;
                   ^
tcp.c:1086:15: error: use of undeclared identifier 'TCP_ESTABLISHED'
        snd->state = TCP_ESTABLISHED;
                     ^
tcp.c:1094:47: error: use of undeclared identifier 'TCP_SYN_SENT'
    if (from_client || a_tcp->client.state != TCP_SYN_SENT ||
                                              ^
tcp.c:1095:30: error: use of undeclared identifier 'TCP_CLOSE'
      a_tcp->server.state != TCP_CLOSE || !(this_tcphdr->th_flags & TH_ACK))
                             ^
tcp.c:1099:27: error: use of undeclared identifier 'TCP_SYN_RECV'
    a_tcp->server.state = TCP_SYN_RECV;
                          ^
tcp.c:1156:47: error: use of undeclared identifier 'TCP_SYN_SENT'
    if (from_client && a_tcp->client.state == TCP_SYN_SENT &&
                                              ^
tcp.c:1157:25: error: use of undeclared identifier 'TCP_SYN_RECV'
        a_tcp->server.state == TCP_SYN_RECV) {
                               ^
tcp.c:1162:27: error: use of undeclared identifier 'TCP_ESTABLISHED'
    a_tcp->client.state = TCP_ESTABLISHED;
                          ^
tcp.c:1169:26: error: use of undeclared identifier 'TCP_ESTABLISHED'
          a_tcp->server.state = TCP_ESTABLISHED;
                                ^
tcp.c:1378:13: error: invalid application of 'sizeof' to an incomplete type 'struct icmphdr'
  if (len < sizeof(STRUCT_ICMP))
            ^     ~~~~~~~~~~~~~
tcp.c:1365:3: note: forward declaration of 'struct icmphdr'
  STRUCT_ICMP *pkt;
  ^
tcp.c:1343:28: note: expanded from macro 'STRUCT_ICMP'
#define STRUCT_ICMP struct icmphdr
                           ^
tcp.c:1383:10: error: incomplete definition of type 'struct icmphdr'
  if (pkt->ICMP_TYPE != ICMP_DEST_UNREACH)
      ~~~^
tcp.c:1365:3: note: forward declaration of 'struct icmphdr'
  STRUCT_ICMP *pkt;
  ^
tcp.c:1343:28: note: expanded from macro 'STRUCT_ICMP'
#define STRUCT_ICMP struct icmphdr
                           ^
tcp.c:1386:10: error: invalid application of 'sizeof' to an incomplete type 'struct icmphdr'
  len -= sizeof(STRUCT_ICMP);
         ^     ~~~~~~~~~~~~~
tcp.c:1365:3: note: forward declaration of 'struct icmphdr'
  STRUCT_ICMP *pkt;
  ^
tcp.c:1343:28: note: expanded from macro 'STRUCT_ICMP'
#define STRUCT_ICMP struct icmphdr
                           ^
tcp.c:1397:11: error: incomplete definition of type 'struct icmphdr'
  if ((pkt->ICMP_CODE & 15) == ICMP_PROT_UNREACH ||
       ~~~^
tcp.c:1365:3: note: forward declaration of 'struct icmphdr'
  STRUCT_ICMP *pkt;
  ^
tcp.c:1343:28: note: expanded from macro 'STRUCT_ICMP'
#define STRUCT_ICMP struct icmphdr
                           ^
tcp.c:1398:11: error: incomplete definition of type 'struct icmphdr'
      (pkt->ICMP_CODE & 15) == ICMP_PORT_UNREACH)
       ~~~^
tcp.c:1365:3: note: forward declaration of 'struct icmphdr'
  STRUCT_ICMP *pkt;
  ^
tcp.c:1343:28: note: expanded from macro 'STRUCT_ICMP'
#define STRUCT_ICMP struct icmphdr
                           ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
make: *** [tcp.o] Error 1
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/phx/mine/softwares/mysql-sniffer/proj
cong5 commented 7 years ago

同样求解

Turtle1991 commented 7 years ago

也遇到同样的问题 求解

nathan6 commented 6 years ago

目前只支持 centos ~~