Msys2 で Guile をビルドする時にビルドする人がしなければいけないこと
ビルドする際、以下のようなコンパイルエラーが出る::
net_db.c: In function 'scm_gethost':
net_db.c:144:18: error: storage size of 'inad' isn't known
144 | struct in_addr inad;
| ^~~~
net_db.c:174:21: warning: implicit declaration of function 'htonl' [-Wimplicit-function-declaration]
174 | inad.s_addr = htonl (scm_to_ulong (host));
| ^~~~~
net_db.c:185:15: error: invalid application of 'sizeof' to incomplete type 'struct in_addr'
185 | if (sizeof (struct in_addr) != entry->h_length)
| ^~~~~~
net_db.c:193:14: error: dereferencing pointer to incomplete type 'struct in_addr'
193 | inad = *(struct in_addr *) argv[i];
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
net_db.c:194:39: warning: implicit declaration of function 'ntohl' [-Wimplicit-function-declaration]
194 | lst = scm_cons (scm_from_ulong (ntohl (inad.s_addr)), lst);
| ^~~~~
net_db.c:144:18: warning: unused variable 'inad' [-Wunused-variable]
144 | struct in_addr inad;
| ^~~~
In file included from net_db.c:60:
net_db.c: In function 'scm_return_entry':
net_db.c:325:53: warning: implicit declaration of function 'ntohs' [-Wimplicit-function-declaration]
325 | SCM_SIMPLE_VECTOR_SET(result, 2, scm_from_uint16 (ntohs (entry->s_port)));
| ^~~~~
vectors.h:72:73: note: in definition of macro 'SCM_SIMPLE_VECTOR_SET'
72 | #define SCM_SIMPLE_VECTOR_SET(x,idx,val) ((SCM_I_VECTOR_WELTS(x))[idx]=(val))
| ^~~
net_db.c: In function 'scm_getserv':
net_db.c:374:30: warning: implicit declaration of function 'htons' [-Wimplicit-function-declaration]
374 | entry = getservbyport (htons (scm_to_int (name)), protoname);
| ^~~~~
make[3]: *** [Makefile:3446: libguile_3.0_la-net_db.lo] Error 1
なぜかというと、よくわからないんだけど guile
では、中に標準?ヘッダーファイルを生成してそれを使っているため、
msys2 では netinet/in.h
でインクルードされている cygwin/in.h
がインクルードされていないという問題が起こる。
なので、 $(top_srcdir)/lib/netinet/in.h
に以下のように書いておく必要がある::
#ifdef __CYGWIN__ #include <cygwin/in.h> #endif
こうすると、すんなりビルドできる。
それで、この $(top_srcdir)/lib/netinet/in.h
は、 ./configure
を実行すると、元に戻る気がするので注意。