GNU bug report logs - #10474
Building guile 2.x under mingw + msys

Previous Next

Package: guile;

Reported by: Andy Wingo <wingo <at> pobox.com>

Date: Tue, 10 Jan 2012 21:59:02 UTC

Severity: normal

Done: Andy Wingo <wingo <at> pobox.com>

Bug is archived. No further changes may be made.

Full log


Message #32 received at 10474 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 10474 <at> debbugs.gnu.org, commander.sirow <at> googlemail.com
Subject: Re: bug#10474: Building guile 2.x under mingw + msys
Date: Wed, 25 Jan 2012 22:12:04 +0100
Hi Eli,

Thanks for doing all the hard work!

I’m willing to apply your changes, but could you send them in ‘git
format-patch’ format, with a log in GNU ChangeLog style, to make it
easier?

In prevision of the of an increased contribution rate ;-), could you
assign copyright to the FSF?  At first sight, these patches may be
applicable without copyright assignment, but that’s the limit, I think.

Eli Zaretskii <eliz <at> gnu.org> skribis:

> 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.

Strangely enough, the cross-build to MinGW32 at
<http://hydra.nixos.org/jobset/gnu/guile-2-0/> is not showing any of
these.  Any idea why?  That’s with MinGW 3.18.

> 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.

I’ll try Gnulib’s setenv module.

> 5. Compilation error in net_db.c:

[...]

> 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 <winsock2.h>
>      # if HAVE_WS2TCPIP_H
>      #  include <ws2tcpip.h>
>      # endif
>      #else
>      #include <sys/socket.h>
>      #include <netdb.h>
>      #include <netinet/in.h>
>      #include <arpa/inet.h>
>      #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.

This seems to be the right thing, according to gnulib-common.m4:

--8<---------------cut here---------------start------------->8---
# gl_MODULE_INDICATOR_FOR_TESTS([modulename])
# defines a C macro indicating the presence of the given module
# in lib or tests. This is useful to determine whether the module
# should be tested.
#                                             |  Value  |   Value   |
#                                             | in lib/ | in tests/ |
# --------------------------------------------+---------+-----------+
# Module present among main modules:          |    1    |     1     |
# --------------------------------------------+---------+-----------+
# Module present among tests-related modules: |    1    |     1     |
# --------------------------------------------+---------+-----------+
# Module not present at all:                  |    0    |     0     |
# --------------------------------------------+---------+-----------+
AC_DEFUN([gl_MODULE_INDICATOR_FOR_TESTS],
[
  AC_DEFINE([GNULIB_TEST_]m4_translit([[$1]],
      [abcdefghijklmnopqrstuvwxyz./-],
      [ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), [1],
    [Define to 1 when the gnulib module $1 should be tested.])
])
--8<---------------cut here---------------end--------------->8---

Thanks!

Ludo’.




This bug report was last modified 12 years and 93 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.