4
這必須是一個相對較新的問題,但我仍然陷入困境。我知道有一個簡單的解決方案。我做了一些谷歌搜索,但無法找到確切的答案。這裏是我的錯誤...如何在Windows上爲紅寶石安裝PCAP
C:\Ruby193\include\ruby-1.9.1\i386-mingw32>gem install pcap
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing pcap:
ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe extconf.rb
checking for socket() in -lsocket... no
checking for gethostbyname() in -lxnet... no
checking for hstrerror()... no
checking for pcap.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
顯然,我是缺少一些庫,但我不知道如何獲得這些我也不知道,他們應該嘗試安裝PCAP時找到。
mkmf.log
have_library: checking for socket() in -lsocket... -------------------- no
"gcc -o conftest -IC:/Ruby193/include/ruby-1.9.1/i386-mingw32 -IC:/Ruby193/include/ruby-1.9.1/ruby/backward -IC:/Ruby193/include/ruby-1.9.1 -I. -I/usr/local/include conftest.c -L. -LC:/Ruby193/lib -L/usr/local/lib -lmsvcrt-ruby191 -lshell32 -lws2_32 -limagehlp "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: int main() {return 0;}
/* end */
"gcc -o conftest -IC:/Ruby193/include/ruby-1.9.1/i386-mingw32 -IC:/Ruby193/include/ruby-1.9.1/ruby/backward -IC:/Ruby193/include/ruby-1.9.1 -I. -I/usr/local/include conftest.c -L. -LC:/Ruby193/lib -L/usr/local/lib -lmsvcrt-ruby191 -lsocket -lshell32 -lws2_32 -limagehlp "
c:/users/user/downloads/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -lsocket
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5:
6: /*top*/
7: int main() {return 0;}
8: int t() { void ((*volatile p)()); p = (void ((*)()))socket; return 0; }
/* end */
"gcc -o conftest -IC:/Ruby193/include/ruby-1.9.1/i386-mingw32 -IC:/Ruby193/include/ruby-1.9.1/ruby/backward -IC:/Ruby193/include/ruby-1.9.1 -I. -I/usr/local/include conftest.c -L. -LC:/Ruby193/lib -L/usr/local/lib -lmsvcrt-ruby191 -lsocket -lshell32 -lws2_32 -limagehlp "
conftest.c: In function 't':
conftest.c:8:1: error: too few arguments to function 'socket'
c:\users\user\downloads\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/winsock2.h:553:35: note: declared here
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5:
6: /*top*/
7: int main() {return 0;}
8: int t() { socket(); return 0; }
/* end */
--------------------
have_library: checking for gethostbyname() in -lxnet... -------------------- no
"gcc -o conftest -IC:/Ruby193/include/ruby-1.9.1/i386-mingw32 -IC:/Ruby193/include/ruby-1.9.1/ruby/backward -IC:/Ruby193/include/ruby-1.9.1 -I. -I/usr/local/include conftest.c -L. -LC:/Ruby193/lib -L/usr/local/lib -lmsvcrt-ruby191 -lxnet -lshell32 -lws2_32 -limagehlp "
c:/users/user/downloads/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -lxnet
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5:
6: /*top*/
7: int main() {return 0;}
8: int t() { void ((*volatile p)()); p = (void ((*)()))gethostbyname; return 0; }
/* end */
"gcc -o conftest -IC:/Ruby193/include/ruby-1.9.1/i386-mingw32 -IC:/Ruby193/include/ruby-1.9.1/ruby/backward -IC:/Ruby193/include/ruby-1.9.1 -I. -I/usr/local/include conftest.c -L. -LC:/Ruby193/lib -L/usr/local/lib -lmsvcrt-ruby191 -lxnet -lshell32 -lws2_32 -limagehlp "
conftest.c: In function 't':
conftest.c:8:1: error: too few arguments to function 'gethostbyname'
c:\users\user\downloads\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/winsock2.h:555:57: note: declared here
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5:
6: /*top*/
7: int main() {return 0;}
8: int t() { gethostbyname(); return 0; }
/* end */
--------------------
have_func: checking for hstrerror()... -------------------- no
"gcc -o conftest -IC:/Ruby193/include/ruby-1.9.1/i386-mingw32 -IC:/Ruby193/include/ruby-1.9.1/ruby/backward -IC:/Ruby193/include/ruby-1.9.1 -I. -I/usr/local/include conftest.c -L. -LC:/Ruby193/lib -L/usr/local/lib -lmsvcrt-ruby191 -lshell32 -lws2_32 -limagehlp "
conftest.c: In function 't':
conftest.c:8:53: error: 'hstrerror' undeclared (first use in this function)
conftest.c:8:53: note: each undeclared identifier is reported only once for each function it appears in
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5:
6: /*top*/
7: int main() {return 0;}
8: int t() { void ((*volatile p)()); p = (void ((*)()))hstrerror; return 0; }
/* end */
"gcc -o conftest -IC:/Ruby193/include/ruby-1.9.1/i386-mingw32 -IC:/Ruby193/include/ruby-1.9.1/ruby/backward -IC:/Ruby193/include/ruby-1.9.1 -I. -I/usr/local/include conftest.c -L. -LC:/Ruby193/lib -L/usr/local/lib -lmsvcrt-ruby191 -lshell32 -lws2_32 -limagehlp "
C:\Users\USER\AppData\Local\Temp\ccbjKHSc.o:conftest.c:(.text+0x19): undefined reference to `hstrerror'
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5:
6: /*top*/
7: int main() {return 0;}
8: int t() { hstrerror(); return 0; }
/* end */
--------------------
have_header: checking for pcap.h... -------------------- no
"gcc -E -IC:/Ruby193/include/ruby-1.9.1/i386-mingw32 -IC:/Ruby193/include/ruby-1.9.1/ruby/backward -IC:/Ruby193/include/ruby-1.9.1 -I. -I/usr/local/include conftest.c -o conftest.i"
conftest.c:5:18: fatal error: pcap.h: No such file or directory
compilation terminated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: #include <pcap.h>
/* end */
--------------------
mkmf.log是什麼意思? – 2012-01-16 22:12:01
它是半長的。我如何附加它?它確實提到像.... – Beaon 2012-01-17 00:39:37
我添加它的帖子。 – Beaon 2012-01-17 00:56:04