From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.lisp.guile.bugs Subject: bug#10474: Building guile 2.x under mingw + msys Date: Sat, 21 Jan 2012 13:09:08 +0200 Message-ID: <83r4yt2tyj.fsf@gnu.org> References: <87pqerdxq4.fsf@pobox.com> <83ehuy698u.fsf@gnu.org> <8362ga5h7h.fsf@gnu.org> <87r4ywpnv0.fsf@gnu.org> <83obtz4muv.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1327144211 12024 80.91.229.12 (21 Jan 2012 11:10:11 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 21 Jan 2012 11:10:11 +0000 (UTC) Cc: 10474@debbugs.gnu.org, commander.sirow@googlemail.com To: ludo@gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sat Jan 21 12:10:07 2012 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RoYpi-0002NU-7j for guile-bugs@m.gmane.org; Sat, 21 Jan 2012 12:10:06 +0100 Original-Received: from localhost ([::1]:40543 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RoYph-0006W3-Kp for guile-bugs@m.gmane.org; Sat, 21 Jan 2012 06:10:05 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:44723) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RoYpd-0006Un-R2 for bug-guile@gnu.org; Sat, 21 Jan 2012 06:10:03 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RoYpc-0003cs-Ha for bug-guile@gnu.org; Sat, 21 Jan 2012 06:10:01 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:33173) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RoYpc-0003co-Aq for bug-guile@gnu.org; Sat, 21 Jan 2012 06:10:00 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1RoYpe-000675-CB for bug-guile@gnu.org; Sat, 21 Jan 2012 06:10:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Sat, 21 Jan 2012 11:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10474 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 10474-submit@debbugs.gnu.org id=B10474.132714415923423 (code B ref 10474); Sat, 21 Jan 2012 11:10:02 +0000 Original-Received: (at 10474) by debbugs.gnu.org; 21 Jan 2012 11:09:19 +0000 Original-Received: from localhost ([127.0.0.1]:38560 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RoYow-00065h-Pj for submit@debbugs.gnu.org; Sat, 21 Jan 2012 06:09:19 -0500 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:33668) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RoYou-00065Q-B5 for 10474@debbugs.gnu.org; Sat, 21 Jan 2012 06:09:18 -0500 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0LY500200APCBD00@a-mtaout22.012.net.il> for 10474@debbugs.gnu.org; Sat, 21 Jan 2012 13:09:08 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([77.124.116.75]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LY5001XXAZ6KE90@a-mtaout22.012.net.il>; Sat, 21 Jan 2012 13:09:08 +0200 (IST) In-reply-to: <83obtz4muv.fsf@gnu.org> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:6071 Archived-At: > Date: Thu, 19 Jan 2012 19:35:04 +0200 > From: Eli Zaretskii > Cc: 10474@debbugs.gnu.org, commander.sirow@googlemail.com > > > (The rest of your investigation is interesting!) > > Here's some more ;-) As promised, still more issues below. 1. Compilation warnings in deprecation.c: SNARF deprecation.x deprecation.c:40:1: warning: "vsnprintf" redefined In file included from deprecation.c:25: ../lib/stdio.h:1605:1: warning: this is the location of the previous definition This is because deprecation.c does this: /* Windows defines. */ #ifdef __MINGW32__ #define vsnprintf _vsnprintf #endif but lib/stdio.h already did the same. My solution was to add an "#ifdef vsnprintf" condition to deprecation.c to avoid redefinition. 2. Compilation warning in expand.c: SNARF expand.x expand.c:52:1: warning: "VOID" redefined In file included from d:/usr/include/windef.h:253, from d:/usr/include/windows.h:48, from d:/usr/include/winsock2.h:22, from ../libguile/iselect.h:36, from ../libguile/threads.h:30, from ../libguile/gc.h:29, from ../libguile/_scm.h:75, from expand.c:27: d:/usr/include/winnt.h:75:1: warning: this is the location of the previous definition expand.c:54:1: warning: "CONST" redefined In file included from d:/usr/include/windows.h:48, from d:/usr/include/winsock2.h:22, from ../libguile/iselect.h:36, from ../libguile/threads.h:30, from ../libguile/gc.h:29, from ../libguile/_scm.h:75, from expand.c:27: d:/usr/include/windef.h:39:1: warning: this is the location of the previous definition This is because expand.c does: #define VOID(src) \ SCM_MAKE_EXPANDED_VOID(src) #define CONST(src, exp) \ SCM_MAKE_EXPANDED_CONST(src, exp) and Windows headers have their own definitions for VOID and CONST. My solution was to add this to expand.c: #ifdef VOID #undef VOID #endif #ifdef CONST #undef CONST #endif However, I really suggest that expand.c uses some less ubiquitous symbol names, like SCM_CONST and SCM_VOID. 3. Compilation warning in filesys.c: SNARF filesys.x filesys.c:119:1: warning: "mkdir" redefined In file included from ../lib/sys/stat.h:47, from filesys.c:92: ../lib/sys/stat.h:808:1: warning: this is the location of the previous definition This is because filesys.c does this: /* Some more definitions for the native Windows port. */ #ifdef __MINGW32__ # define mkdir(path, mode) mkdir (path) But gnulib already redirected `mkdir' to its replacement function. My solution: don't define if already redirected. To that end, I added the following condition before the above #define: /* When configured to use the gnulib replacement, don't redefine mkdir, as it is already redirected to the replacement, see lib/sys/stat.h. */ # if !GNULIB_defined_rpl_mkdir I'm not sure using GNULIB_defined_rpl_mkdir is TRT here, but I didn't find a better way. 4. Missing setenv needed by dynl.c: CC dynl.lo dynl.c: In function `augment_env': dynl.c:141: warning: implicit declaration of function `setenv' Solution: add a setenv implementation. However, I think Guile would be better off using a more portable putenv instead. 5. Compilation error in net_db.c: CC net_db.lo net_db.c:460: error: `AI_ALL' undeclared here (not in a function) net_db.c:460: error: bit-field `_gl_verify_error_if_negative' width not an integer constant net_db.c:482: warning: "struct addrinfo" declared inside parameter list net_db.c:482: warning: its scope is only this definition or declaration, which is probably not what you want net_db.c: In function `scm_from_addrinfo': net_db.c:490: error: dereferencing pointer to incomplete type net_db.c:491: error: dereferencing pointer to incomplete type net_db.c:492: error: dereferencing pointer to incomplete type net_db.c:493: error: dereferencing pointer to incomplete type net_db.c:494: error: dereferencing pointer to incomplete type net_db.c:494: error: dereferencing pointer to incomplete type net_db.c:496: error: dereferencing pointer to incomplete type net_db.c:496: error: dereferencing pointer to incomplete type net_db.c: In function `scm_getaddrinfo': net_db.c:614: error: storage size of 'c_hints' isn't known net_db.c:657: warning: implicit declaration of function `getaddrinfo' net_db.c:665: error: dereferencing pointer to incomplete type net_db.c:665: warning: left-hand operand of comma expression has no effect net_db.c:668: warning: implicit declaration of function `freeaddrinfo' net_db.c:614: warning: unused variable `c_hints' net_db.c: At top level: net_db.c:680: error: `EAI_BADFLAGS' undeclared here (not in a function) net_db.c:680: error: bit-field `_gl_verify_error_if_negative' width not an integer constant net_db.c: In function `scm_gai_strerror': net_db.c:744: warning: implicit declaration of function `gai_strerror' net_db.c:744: warning: passing arg 1 of `scm_from_locale_string' makes pointer from integer without a cast In file included from net_db.c:755: ../libguile/net_db.x: In function `scm_init_net_db': ../libguile/net_db.x:17: error: `AI_PASSIVE' undeclared (first use in this function) ../libguile/net_db.x:17: error: (Each undeclared identifier is reported only once ../libguile/net_db.x:17: error: for each function it appears in.) ../libguile/net_db.x:18: error: `AI_CANONNAME' undeclared (first use in this function) ../libguile/net_db.x:19: error: `AI_NUMERICHOST' undeclared (first use in this function) ../libguile/net_db.x:20: error: `AI_NUMERICSERV' undeclared (first use in this function) ../libguile/net_db.x:21: error: `AI_V4MAPPED' undeclared (first use in this function) ../libguile/net_db.x:23: error: `AI_ADDRCONFIG' undeclared (first use in this function) ../libguile/net_db.x:27: error: `EAI_NONAME' undeclared (first use in this function) ../libguile/net_db.x:28: error: `EAI_AGAIN' undeclared (first use in this function) ../libguile/net_db.x:29: error: `EAI_FAIL' undeclared (first use in this function) ../libguile/net_db.x:30: error: `EAI_FAMILY' undeclared (first use in this function) ../libguile/net_db.x:31: error: `EAI_SOCKTYPE' undeclared (first use in this function) ../libguile/net_db.x:32: error: `EAI_SERVICE' undeclared (first use in this function) ../libguile/net_db.x:33: error: `EAI_MEMORY' undeclared (first use in this function) ../libguile/net_db.x:34: error: `EAI_SYSTEM' undeclared (first use in this function) ../libguile/net_db.x:35: error: `EAI_OVERFLOW' undeclared (first use in this function) net_db.c: In function `scm_getaddrinfo': net_db.c:663: warning: value computed is not used make[3]: *** [net_db.lo] Error 1 The reason is that this condition in net_db.c: #ifdef HAVE_WINSOCK2_H #include #else #include #include #include #include #endif is inappropriate when gnulib was used to wrap Windows socket functions. When gnulib _is_ used, the missing macros are already defined by lib/sys/socket.h. Therefore, I modified the condition to: #if HAVE_WINSOCK2_H && !GNULIB_TEST_SOCKET #include # if HAVE_WS2TCPIP_H # include # endif #else #include #include #include #include #endif using GNULIB_TEST_SOCKET as evidence that gnulib is being used. I'm not sure GNULIB_TEST_SOCKET is TRT, but I saw no better candidate. Maybe gnulib should provide us with a better macro. 6. Compilation warnings in socket.c: CC socket.lo socket.c: In function `scm_inet_ntop': socket.c:349: warning: implicit declaration of function `inet_ntop' socket.c:349: warning: assignment makes pointer from integer without a cast socket.c:357: warning: assignment makes pointer from integer without a cast socket.c: In function `scm_inet_pton': socket.c:397: warning: implicit declaration of function `inet_pton' This is again because gnulib headers are not included although available, due to exclusive test of HAVE_WINSOCK2_H. Solution: change this in socket.c: #ifdef HAVE_WINSOCK2_H to say this: #if HAVE_WINSOCK2_H && !GNULIB_TEST_SOCKET The same caveat about GNULIB_TEST_SOCKET applies here. This completes the description of problems I needed to overcome for building Guile with MinGW+MSYS. You may notice that my report is slightly different from Commander Sirow's report that started this bug report, where we cover the same turf: . I didn't need to define a `struct timespec', probably because I don't have Pthreads-w32 installed, and so pthread.h did not get included in my build. . I solved the problems in net_db.c differently (see above), and I believe more correctly.