< :前の番号
^ :番号順リスト
> :次の番号
P :前の記事
N :次の記事(自分と同じ返事先を持つ)
|<:スレッドの先頭
>|:次のスレッド
^ :返事先
_:自分への返事
>:同じ返事先を持つ記事(前)
<:同じ返事先を持つ記事(後)
---:分割してスレッド表示、再表示
| :分割して(縦)スレッド表示、再表示
~ :スレッドのフレーム消去
.:インデックス
..:インデックスのインデックス
On Dec 26, 2003, at 7:26 PM, Yukihiro Matsumoto wrote:
> Hi,
>
> In message "Error with Socket.getaddrinfo on OS X"
> on 03/12/27, Richard Kilmer <rich / infoether.com> writes:
>
> | > irb
> |irb(main):001:0> require 'socket'
> |=> true
> |irb(main):002:0> Socket::getaddrinfo('192.168.1.100', 8081,
> |Socket::AF_UNSPEC, Socket::SOCK_STREAM, 0, Socket::AI_PASSIVE)
> |SocketError: getnameinfo: nodename nor servname provided, or not known
> | from (irb):2:in `getaddrinfo'
> | from (irb):2
>
> I have another report that getaddrinfo(3) is not working properly on
> OSX. Can you show me mkmf.log in the ext/socket directory?
>
> matz.
>
>
>
File socket/mkmf.log
have_library: checking for t_open() in -lnsl... -------------------- no
"gcc -o conftest -I/Users/rich/build/ruby -I/Users/rich/build/ruby -g
-O2 -pipe -fno-common conftest.c -L"/Users/rich/build/ruby"
-L"/usr/local/lib" -lruby-static -lnsl -ldl -lobjc "
ld: can't locate file for: -lnsl
checked program was:
/* begin */
/*top*/
int main() { return 0; }
int t() { t_open(); return 0; }
/* end */
"gcc -o conftest -I/Users/rich/build/ruby -I/Users/rich/build/ruby -g
-O2 -pipe -fno-common conftest.c -L"/Users/rich/build/ruby"
-L"/usr/local/lib" -lruby-static -lnsl -ldl -lobjc "
conftest.c: In function `t':
conftest.c:5: error: `t_open' undeclared (first use in this function)
conftest.c:5: error: (Each undeclared identifier is reported only once
conftest.c:5: error: for each function it appears in.)
checked program was:
/* begin */
/*top*/
int main() { return 0; }
int t() { void ((*volatile p)()); p = (void ((*)()))t_open; return 0; }
/* end */
--------------------
have_library: checking for socket() in -lsocket... --------------------
no
"gcc -o conftest -I/Users/rich/build/ruby -I/Users/rich/build/ruby -g
-O2 -pipe -fno-common conftest.c -L"/Users/rich/build/ruby"
-L"/usr/local/lib" -lruby-static -lsocket -ldl -lobjc "
ld: can't locate file for: -lsocket
checked program was:
/* begin */
/*top*/
int main() { return 0; }
int t() { socket(); return 0; }
/* end */
"gcc -o conftest -I/Users/rich/build/ruby -I/Users/rich/build/ruby -g
-O2 -pipe -fno-common conftest.c -L"/Users/rich/build/ruby"
-L"/usr/local/lib" -lruby-static -lsocket -ldl -lobjc "
conftest.c: In function `t':
conftest.c:5: error: `socket' undeclared (first use in this function)
conftest.c:5: error: (Each undeclared identifier is reported only once
conftest.c:5: error: for each function it appears in.)
checked program was:
/* begin */
/*top*/
int main() { return 0; }
int t() { void ((*volatile p)()); p = (void ((*)()))socket; return 0; }
/* end */
--------------------
"gcc -o conftest -I/Users/rich/build/ruby -I/Users/rich/build/ruby -g
-O2 -pipe -fno-common conftest.c -L"/Users/rich/build/ruby"
-L"/usr/local/lib" -lruby-static -ldl -lobjc "
checked program was:
/* begin */
#include <sys/types.h>
#include <sys/socket.h>
main()
{
socket(AF_INET6, SOCK_STREAM, 0);
}
/* end */
"gcc -E -I/Users/rich/build/ruby -I/Users/rich/build/ruby -g -O2 -pipe
-fno-common -DENABLE_IPV6 conftest.c -o conftest.i"
conftest.c:4:3: #error
checked program was:
/* begin */
#include <netinet/in.h>
/*top*/
#ifndef IPV6_INRIA_VERSION
# error
#endif
/* end */
"gcc -E -I/Users/rich/build/ruby -I/Users/rich/build/ruby -g -O2 -pipe
-fno-common -DENABLE_IPV6 conftest.c -o conftest.i"
checked program was:
/* begin */
#include <netinet/in.h>
/*top*/
#ifndef __KAME__
# error
#endif
/* end */
"gcc -o conftest -I/Users/rich/build/ruby -I/Users/rich/build/ruby
-DINET6 -g -O2 -pipe -fno-common -DENABLE_IPV6 conftest.c
-L"/Users/rich/build/ruby" -L"/usr/local/lib" -lruby-static -ldl
-lobjc "
checked program was:
/* begin */
#ifdef _WIN32
# include <windows.h>
# include <winsock.h>
#else
# include <sys/types.h>
# include <netdb.h>
# include <string.h>
# include <sys/socket.h>
# include <netinet/in.h>
#endif
int
main()
{
struct sockaddr_in sin;
sin.sin_len;
return 0;
}
/* end */
"gcc -o conftest -I/Users/rich/build/ruby -I/Users/rich/build/ruby
-DHAVE_SIN_LEN -DINET6 -g -O2 -pipe -fno-common -DENABLE_IPV6
conftest.c -L"/Users/rich/build/ruby" -L"/usr/local/lib"
-lruby-static -ldl -lobjc "
checked program was:
/* begin */
#ifdef _WIN32
# include <windows.h>
# include <winsock.h>
#else
# include <sys/types.h>
# include <netdb.h>
# include <string.h>
# include <sys/socket.h>
#endif
int
main()
{
struct sockaddr_storage ss;
ss.ss_family;
return 0;
}
/* end */
"gcc -o conftest -I/Users/rich/build/ruby -I/Users/rich/build/ruby
-DHAVE_SOCKADDR_STORAGE -DHAVE_SIN_LEN -DINET6 -g -O2 -pipe -fno-common
-DENABLE_IPV6 conftest.c -L"/Users/rich/build/ruby" -L"/usr/local/lib"
-lruby-static -ldl -lobjc "
checked program was:
/* begin */
#include <sys/types.h>
#include <netdb.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
int
main()
{
struct sockaddr sa;
sa.sa_len;
return 0;
}
/* end */
have_header: checking for netinet/tcp.h... -------------------- yes
"gcc -E -I/Users/rich/build/ruby -I/Users/rich/build/ruby
-DHAVE_SA_LEN -DHAVE_SOCKADDR_STORAGE -DHAVE_SIN_LEN -DINET6 -g -O2
-pipe -fno-common -DENABLE_IPV6 conftest.c -o conftest.i"
checked program was:
/* begin */
#include <netinet/tcp.h>
/* end */
--------------------
have_header: checking for netinet/udp.h... -------------------- yes
"gcc -E -I/Users/rich/build/ruby -I/Users/rich/build/ruby
-DHAVE_SA_LEN -DHAVE_SOCKADDR_STORAGE -DHAVE_SIN_LEN -DINET6 -g -O2
-pipe -fno-common -DENABLE_IPV6 conftest.c -o conftest.i"
checked program was:
/* begin */
#include <netinet/udp.h>
/* end */
--------------------
have_func: checking for sendmsg()... -------------------- yes
"gcc -o conftest -I/Users/rich/build/ruby -I/Users/rich/build/ruby
-DHAVE_SA_LEN -DHAVE_SOCKADDR_STORAGE -DHAVE_SIN_LEN -DINET6 -g -O2
-pipe -fno-common -DENABLE_IPV6 conftest.c -L"/Users/rich/build/ruby"
-L"/usr/local/lib" -lruby-static -ldl -lobjc "
checked program was:
/* begin */
/*top*/
int main() { return 0; }
int t() { sendmsg(); return 0; }
/* end */
--------------------
have_func: checking for recvmsg()... -------------------- yes
"gcc -o conftest -I/Users/rich/build/ruby -I/Users/rich/build/ruby
-DHAVE_SA_LEN -DHAVE_SOCKADDR_STORAGE -DHAVE_SIN_LEN -DINET6 -g -O2
-pipe -fno-common -DENABLE_IPV6 conftest.c -L"/Users/rich/build/ruby"
-L"/usr/local/lib" -lruby-static -ldl -lobjc "
checked program was:
/* begin */
/*top*/
int main() { return 0; }
int t() { recvmsg(); return 0; }
/* end */
--------------------
have_struct_member: checking for struct msghdr.msg_control...
-------------------- yes
"gcc -c -I/Users/rich/build/ruby -I/Users/rich/build/ruby
-DHAVE_SA_LEN -DHAVE_SOCKADDR_STORAGE -DHAVE_SIN_LEN -DINET6 -g -O2
-pipe -fno-common -DENABLE_IPV6 conftest.c"
checked program was:
/* begin */
#include <sys/types.h>
#include <sys/socket.h>
/*top*/
int main() { return 0; }
int s = (char *)&((struct msghdr*)0)->msg_control - (char *)0;
/* end */
--------------------
have_struct_member: checking for struct msghdr.msg_accrights...
-------------------- no
"gcc -c -I/Users/rich/build/ruby -I/Users/rich/build/ruby
-DHAVE_SA_LEN -DHAVE_SOCKADDR_STORAGE -DHAVE_SIN_LEN -DINET6 -g -O2
-pipe -fno-common -DENABLE_IPV6 conftest.c"
conftest.c:7: error: structure has no member named `msg_accrights'
checked program was:
/* begin */
#include <sys/types.h>
#include <sys/socket.h>
/*top*/
int main() { return 0; }
int s = (char *)&((struct msghdr*)0)->msg_accrights - (char *)0;
/* end */
--------------------
"gcc -o conftest -I/Users/rich/build/ruby -I/Users/rich/build/ruby
-DHAVE_SA_LEN -DHAVE_SOCKADDR_STORAGE -DHAVE_SIN_LEN -DINET6 -g -O2
-pipe -fno-common -DENABLE_IPV6 conftest.c -L"/Users/rich/build/ruby"
-L"/usr/local/lib" -lruby-static -ldl -lobjc "
checked program was:
/* begin */
#include <sys/types.h>
#include <netdb.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#ifndef AF_LOCAL
#define AF_LOCAL AF_UNIX
#endif
main()
{
int passive, gaierr, inet4 = 0, inet6 = 0;
struct addrinfo hints, *ai, *aitop;
char straddr[INET6_ADDRSTRLEN], strport[16];
for (passive = 0; passive <= 1; passive++) {
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints.ai_protocol = IPPROTO_TCP;
hints.ai_flags = passive ? AI_PASSIVE : 0;
hints.ai_socktype = SOCK_STREAM;
if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
(void)gai_strerror(gaierr);
goto bad;
}
for (ai = aitop; ai; ai = ai->ai_next) {
if (ai->ai_family == AF_LOCAL) continue;
if (ai->ai_addr == NULL ||
ai->ai_addrlen == 0 ||
getnameinfo(ai->ai_addr, ai->ai_addrlen,
straddr, sizeof(straddr), strport,
sizeof(strport),
NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
goto bad;
}
if (strcmp(strport, "54321") != 0) {
goto bad;
}
switch (ai->ai_family) {
case AF_INET:
if (passive) {
if (strcmp(straddr, "0.0.0.0") != 0) {
goto bad;
}
} else {
if (strcmp(straddr, "127.0.0.1") != 0) {
goto bad;
}
}
inet4++;
break;
case AF_INET6:
if (passive) {
if (strcmp(straddr, "::") != 0) {
goto bad;
}
} else {
if (strcmp(straddr, "::1") != 0) {
goto bad;
}
}
inet6++;
break;
case AF_UNSPEC:
goto bad;
break;
default:
/* another family support? */
break;
}
}
}
if (!(inet4 == 0 || inet4 == 2))
goto bad;
if (!(inet6 == 0 || inet6 == 2))
goto bad;
if (aitop)
freeaddrinfo(aitop);
exit(0);
bad:
if (aitop)
freeaddrinfo(aitop);
exit(1);
}
/* end */
./conftest
have_func: checking for getaddrinfo()... -------------------- yes
"gcc -o conftest -I/Users/rich/build/ruby -I/Users/rich/build/ruby
-DHAVE_SA_LEN -DHAVE_SOCKADDR_STORAGE -DHAVE_SIN_LEN -DINET6 -g -O2
-pipe -fno-common -DENABLE_IPV6 conftest.c -L"/Users/rich/build/ruby"
-L"/usr/local/lib" -lruby-static -ldl -lobjc "
conftest.c: In function `t':
conftest.c:5: error: too few arguments to function `getaddrinfo'
checked program was:
/* begin */
#include <netdb.h>
/*top*/
int main() { return 0; }
int t() { getaddrinfo(); return 0; }
/* end */
"gcc -o conftest -I/Users/rich/build/ruby -I/Users/rich/build/ruby
-DHAVE_SA_LEN -DHAVE_SOCKADDR_STORAGE -DHAVE_SIN_LEN -DINET6 -g -O2
-pipe -fno-common -DENABLE_IPV6 conftest.c -L"/Users/rich/build/ruby"
-L"/usr/local/lib" -lruby-static -ldl -lobjc "
checked program was:
/* begin */
#include <netdb.h>
/*top*/
int main() { return 0; }
int t() { void ((*volatile p)()); p = (void ((*)()))getaddrinfo; return
0; }
/* end */
--------------------
have_func: checking for getnameinfo()... -------------------- yes
"gcc -o conftest -I/Users/rich/build/ruby -I/Users/rich/build/ruby
-DHAVE_SA_LEN -DHAVE_SOCKADDR_STORAGE -DHAVE_SIN_LEN -DINET6 -g -O2
-pipe -fno-common -DENABLE_IPV6 conftest.c -L"/Users/rich/build/ruby"
-L"/usr/local/lib" -lruby-static -ldl -lobjc "
conftest.c: In function `t':
conftest.c:5: error: too few arguments to function `getnameinfo'
checked program was:
/* begin */
#include <netdb.h>
/*top*/
int main() { return 0; }
int t() { getnameinfo(); return 0; }
/* end */
"gcc -o conftest -I/Users/rich/build/ruby -I/Users/rich/build/ruby
-DHAVE_SA_LEN -DHAVE_SOCKADDR_STORAGE -DHAVE_SIN_LEN -DINET6 -g -O2
-pipe -fno-common -DENABLE_IPV6 conftest.c -L"/Users/rich/build/ruby"
-L"/usr/local/lib" -lruby-static -ldl -lobjc "
checked program was:
/* begin */
#include <netdb.h>
/*top*/
int main() { return 0; }
int t() { void ((*volatile p)()); p = (void ((*)()))getnameinfo; return
0; }
/* end */
--------------------
"gcc -o conftest -I/Users/rich/build/ruby -I/Users/rich/build/ruby
-DHAVE_GETADDRINFO -DHAVE_SA_LEN -DHAVE_SOCKADDR_STORAGE -DHAVE_SIN_LEN
-DINET6 -g -O2 -pipe -fno-common -DENABLE_IPV6 conftest.c
-L"/Users/rich/build/ruby" -L"/usr/local/lib" -lruby-static -ldl
-lobjc "
checked program was:
/* begin */
#include <sys/types.h>
#include <netdb.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
int
main()
{
socklen_t len;
return 0;
}
/* end */
have_header: checking for sys/un.h... -------------------- yes
"gcc -E -I/Users/rich/build/ruby -I/Users/rich/build/ruby
-DHAVE_GETADDRINFO -DHAVE_SA_LEN -DHAVE_SOCKADDR_STORAGE -DHAVE_SIN_LEN
-DINET6 -g -O2 -pipe -fno-common -DENABLE_IPV6 conftest.c -o
conftest.i"
checked program was:
/* begin */
#include <sys/un.h>
/* end */
--------------------
have_header: checking for sys/uio.h... -------------------- yes
"gcc -E -I/Users/rich/build/ruby -I/Users/rich/build/ruby
-DHAVE_GETADDRINFO -DHAVE_SA_LEN -DHAVE_SOCKADDR_STORAGE -DHAVE_SIN_LEN
-DINET6 -g -O2 -pipe -fno-common -DENABLE_IPV6 conftest.c -o
conftest.i"
checked program was:
/* begin */
#include <sys/uio.h>
/* end */
--------------------
have_func: checking for socket()... -------------------- yes
"gcc -o conftest -I/Users/rich/build/ruby -I/Users/rich/build/ruby
-DHAVE_GETADDRINFO -DHAVE_SA_LEN -DHAVE_SOCKADDR_STORAGE -DHAVE_SIN_LEN
-DINET6 -g -O2 -pipe -fno-common -DENABLE_IPV6 conftest.c
-L"/Users/rich/build/ruby" -L"/usr/local/lib" -lruby-static -ldl
-lobjc "
checked program was:
/* begin */
/*top*/
int main() { return 0; }
int t() { socket(); return 0; }
/* end */
--------------------
have_func: checking for hsterror()... -------------------- no
"gcc -o conftest -I/Users/rich/build/ruby -I/Users/rich/build/ruby
-DHAVE_GETADDRINFO -DHAVE_SA_LEN -DHAVE_SOCKADDR_STORAGE -DHAVE_SIN_LEN
-DINET6 -g -O2 -pipe -fno-common -DENABLE_IPV6 conftest.c
-L"/Users/rich/build/ruby" -L"/usr/local/lib" -lruby-static -ldl
-lobjc "
ld: Undefined symbols:
_hsterror
checked program was:
/* begin */
/*top*/
int main() { return 0; }
int t() { hsterror(); return 0; }
/* end */
"gcc -o conftest -I/Users/rich/build/ruby -I/Users/rich/build/ruby
-DHAVE_GETADDRINFO -DHAVE_SA_LEN -DHAVE_SOCKADDR_STORAGE -DHAVE_SIN_LEN
-DINET6 -g -O2 -pipe -fno-common -DENABLE_IPV6 conftest.c
-L"/Users/rich/build/ruby" -L"/usr/local/lib" -lruby-static -ldl
-lobjc "
conftest.c: In function `t':
conftest.c:5: error: `hsterror' undeclared (first use in this function)
conftest.c:5: error: (Each undeclared identifier is reported only once
conftest.c:5: error: for each function it appears in.)
checked program was:
/* begin */
/*top*/
int main() { return 0; }
int t() { void ((*volatile p)()); p = (void ((*)()))hsterror; return 0;
}
/* end */
--------------------
have_func: checking for getipnodebyname()... -------------------- yes
"gcc -o conftest -I/Users/rich/build/ruby -I/Users/rich/build/ruby
-DHAVE_GETADDRINFO -DHAVE_SA_LEN -DHAVE_SOCKADDR_STORAGE -DHAVE_SIN_LEN
-DINET6 -g -O2 -pipe -fno-common -DENABLE_IPV6 conftest.c
-L"/Users/rich/build/ruby" -L"/usr/local/lib" -lruby-static -ldl
-lobjc "
checked program was:
/* begin */
/*top*/
int main() { return 0; }
int t() { getipnodebyname(); return 0; }
/* end */
--------------------
have_func: checking for gethostname()... -------------------- yes
"gcc -o conftest -I/Users/rich/build/ruby -I/Users/rich/build/ruby
-DHAVE_GETADDRINFO -DHAVE_SA_LEN -DHAVE_SOCKADDR_STORAGE -DHAVE_SIN_LEN
-DINET6 -g -O2 -pipe -fno-common -DENABLE_IPV6 conftest.c
-L"/Users/rich/build/ruby" -L"/usr/local/lib" -lruby-static -ldl
-lobjc "
checked program was:
/* begin */
/*top*/
int main() { return 0; }
int t() { gethostname(); return 0; }
/* end */
--------------------