ошибка при компиляции dsniff на mac 10.6 - PullRequest
0 голосов
/ 24 июня 2010

Я получил эту ошибку, когда macport автоматически попытался скомпилировать

Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_net_dsniff/work/dsniff-2.3" && /usr/bin/make -j2 all " returned error 2
Command output: /usr/bin/gcc-4.2 -O2 -DBIND_8_COMPAT -arch x86_64 -D_BSD_SOURCE -   DHAVE_SOCKADDR_SA_LEN -DLIBNET_BSDISH_OS -DLIBNET_BSD_BYTE_SWAP - DDSNIFF_LIBDIR=\"/opt/local/lib/\" -I. -I/opt/local/include -I/opt/local/include -   I/opt/local/include  -I/opt/local/include  -I./missing -c ./missing/dummy.c
/usr/bin/gcc-4.2 -O2 -DBIND_8_COMPAT -arch x86_64 -D_BSD_SOURCE -DHAVE_SOCKADDR_SA_LEN -DLIBNET_BSDISH_OS -DLIBNET_BSD_BYTE_SWAP -DDSNIFF_LIBDIR=\"/opt/local/lib/\" -I. -I/opt/local/include -I/opt/local/include -I/opt/local/include  -I/opt/local/include  -I./missing -c ./missing/md5.c
/usr/bin/gcc-4.2 -O2 -DBIND_8_COMPAT -arch x86_64 -D_BSD_SOURCE -DHAVE_SOCKADDR_SA_LEN -DLIBNET_BSDISH_OS -DLIBNET_BSD_BYTE_SWAP -DDSNIFF_LIBDIR=\"/opt/local/lib/\" -I. -I/opt/local/include -I/opt/local/include -I/opt/local/include  -I/opt/local/include  -I./missing -c ./arpspoof.c
./arpspoof.c:25: warning: 'struct ether_addr' declared inside parameter list
./arpspoof.c:25: warning: its scope is only this definition or declaration, which is probably not what you want
./arpspoof.c:26: warning: 'struct ether_addr' declared inside parameter list
./arpspoof.c: In function 'arp_send':
./arpspoof.c:49: warning: passing argument 1 of 'libnet_get_hwaddr' from incompatible pointer type
./arpspoof.c:49: error: too many arguments to function 'libnet_get_hwaddr'
./arpspoof.c:60: warning: passing argument 6 of 'libnet_build_ethernet' from incompatible pointer type
./arpspoof.c:60: error: too few arguments to function 'libnet_build_ethernet'
./arpspoof.c:64: error: 'ETH_H' undeclared (first use in this function)
./arpspoof.c:64: error: (Each undeclared identifier is reported only once
./arpspoof.c:64: error: for each function it appears in.)
./arpspoof.c:64: error: too few arguments to function 'libnet_build_arp'
./arpspoof.c:67: warning: passing argument 1 of 'ether_ntoa' from incompatible pointer type
./arpspoof.c:71: warning: passing argument 1 of 'ether_ntoa' from incompatible pointer type
./arpspoof.c:73: warning: format '%s' expects type 'char *', but argument 4 has type 'int'
./arpspoof.c:73: warning: format '%s' expects type 'char *', but argument 5 has type 'int'
./arpspoof.c:77: warning: passing argument 1 of 'ether_ntoa' from incompatible pointer type
./arpspoof.c:78: warning: format '%s' expects type 'char *', but argument 4 has type 'int'
./arpspoof.c:80: warning: passing argument 1 of 'ether_ntoa' from incompatible pointer type
./arpspoof.c: In function 'arp_find':
./arpspoof.c:114: warning: passing argument 2 of 'arp_cache_lookup' from incompatible     pointer type
./arpspoof.c: In function 'main':
./arpspoof.c:181: warning: assignment makes pointer from integer without a cast
make: *** [arpspoof.o] Error 1
make: *** Waiting for unfinished jobs....

Есть идеи?

1 Ответ

2 голосов
/ 24 июня 2010

Первые предупреждения:

./arpspoof.c:25: warning: 'struct ether_addr' declared inside parameter list
./arpspoof.c:25: warning: its scope is only this definition or declaration,
                          which is probably not what you want
./arpspoof.c:26: warning: 'struct ether_addr' declared inside parameter list

Это означает, что есть строка, похожая на:

extern somefunc(struct ether_addr *arg1, ...);

Нет предварительного объявления 'struct ether_addr', что означает, что компилятор должен обрабатывать его как новый тип, который имеет область действия только для объявления функции. И, как отмечает компилятор, это не то, что вы хотите. Вы можете обойти это, предшествуя строке объявления:

struct ether_addr;

Это говорит компилятору, что тип будет определен в конце концов. До тех пор, пока компилятору не понадобятся подробные сведения о внутренней части структуры, вы можете передавать указатели с обычным отказом от языка C.

Ошибки говорят вам, что что-то серьезно сбито с толку. Код предполагает, что ETH_H будет определен, но это не так.

Существуют и другие объявления, отличающиеся от ожидаемых в коде, которые ведут к дальнейшим предупреждениям через файл. Скорее всего, проблемы «указатель из целого числа без приведения» - это функции, которые не объявлены, поэтому они предполагаются как функции, которые возвращают целое число, но на самом деле они являются функциями, которые возвращают «char *» и поэтому должны быть объявлены.

Когда я попытался скомпилировать dsniff, фаза настройки завершилась неудачно, поскольку она не нашла libnet.

Итак:

  • Убедитесь, что у вас есть соответствующие библиотеки (если у вас есть URL для соответствующей 'libnet', это будет полезно) и соответствующие заголовки.
  • Посмотрите на вывод конфигурации; возможно, он не анализирует все, что нужно анализировать.
  • Посмотрите, можете ли вы найти какую-либо информацию о компиляции dsniff для MacOS X или одного из выпусков BSD (MacOS X / Darwin чем-то напоминает выпуски Unix для BSD).
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...