guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cross building 1.9.14 for mingw


From: Ludovic Courtès
Subject: Re: cross building 1.9.14 for mingw
Date: Sat, 29 Jan 2011 22:34:12 +0100
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.2 (gnu/linux)

Hi Jan,

Thanks for the report and patches!

Jan Nieuwenhuizen <address@hidden> writes:

> To get guile-1.9.14 cross built for mingw, I re-updated gnulib
> to include socket-related modules (starting with accept here)
>
>     gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 
> --doc-base=doc --tests-base=tests --aux-dir=build-aux --libtool 
> --macro-prefix=gl --no-vc-files alignof alloca-opt announce-gen autobuild 
> byteswap canonicalize-lgpl duplocale environ extensions flock fpieee 
> full-read full-write func gendocs getaddrinfo git-version-gen 
> gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf 
> inet_ntop inet_pton isinf isnan lib-symbol-versions lib-symbol-visibility 
> libunistring locale maintainer-makefile nproc putenv stat-time stdlib strcase 
> strftime striconveh string sys_stat verify version-etc-fsf vsnprintf warnings 
>     accept bind close connect getpeername getsockname getsockopt listen 
> malloc malloca recv recv recvfrom send sendto setsockopt shutdown socket 
> sockets

OK, I’ll add them on the next Gnulib update (soon).

> and used the attached patches.  Without this update you get things
> like
>
>     .libs/socket.o:socket.c:(.text+0xc72): undefined reference to 
> `_accept_used_without_requesting_gnulib_module_accept'

OK but all the modules listed after ‘accept’ above are needed too,
right?

> Another small gripe, this handy thing in configure.ac
>
>     m4_esyscmd([build-aux/git-version-gen\
>         .tarball-version\
>         
> 's/^release_\([0-9][0-9]*\)-\([0-9][0-9]*\)-\([0-9][0-9]*\)/v\1.\2\.\3/g']),
>
> makes it tricky to patch configure.ac when working from a tarball
> release, I got 
>
>     $ autoreconf
>     Usage: build-aux/git-version-gen $srcdir/.tarball-version

Hmm could it be that there was a typo?  Here running ‘git-version-gen’
outside of a Git tree works fine:

  $ guile/build-aux/git-version-gen .tarball-version s/foo/bar/
  UNKNOWN

> From ed1507425da819363cc6592ee033076838c82051 Mon Sep 17 00:00:00 2001
> From: Jan Nieuwenhuizen <address@hidden>
> Date: Sat, 29 Jan 2011 17:31:17 +0100
> Subject: [PATCH 1/4] Add dynamic relocation support, default off.

I’ll write about it separately.

> From 4aeb4bb48423d87001b598030afed0a2dc03e747 Mon Sep 17 00:00:00 2001
> From: Jan Nieuwenhuizen <address@hidden>
> Date: Sat, 29 Jan 2011 19:42:46 +0100
> Subject: [PATCH 2/4] Use AC_CHECK_LIB rather than AC_LIB_HAVE_LINKFLAGS.  
> Fixes cross configuring.
>
> AC_LIB_HAVE_LINKFLAGS blondly looks in $prefix etc. for libraries.
> Not only is that unnecessary, it also breaks cross building.
>
> Here's what config.log says:
>
>     configure:33053: i686-mingw32-gcc -mms-bitfields -std=gnu99 -o 
> conftest.exe -O2 -DHAVE_CONFIG_H=1 
> -I/home/janneke/vc/gub/target/mingw/build/guile-1.9.14 
> -I/home/janneke/vc/gub/target/mingw/root/usr/include 
> -L/home/janneke/vc/gub/target/mingw/root/usr/lib 
> -L/home/janneke/vc/gub/target/mingw/root/usr/bin 
> -L/home/janneke/vc/gub/target/mingw/root/usr/lib/w32api conftest.c 
> /usr/lib/libltdl.a /usr/lib/libdl.a  >&5
>     /tmp/cc5v8vq5.o:conftest.c:(.text+0x1e): undefined reference to 
> `_lt_dlopenext'
>
> note that using -lltdl -ldl instead of /usr/lib/libltdl.a
> /usr/lib/libdl.la works fine.

Ouch.  May I suggest reporting it to address@hidden  :-)  I think
people there would be happy to provide an appropriate fix and we
wouldn’t even have to worry.  ;-)

> From 90631baf616303e1a8983b3b1eca101f5c5ac0ac Mon Sep 17 00:00:00 2001
> From: Jan Nieuwenhuizen <address@hidden>
> Date: Sat, 29 Jan 2011 19:51:37 +0100
> Subject: [PATCH 3/4] When cross building, run GUILE_FOR_BUILD instead of 
> just-built guile.

Applied.

> From a597cd2edd0ebe3341e435ad08af4450b43beb31 Mon Sep 17 00:00:00 2001
> From: Jan Nieuwenhuizen <address@hidden>
> Date: Sat, 29 Jan 2011 19:52:39 +0100
> Subject: [PATCH 4/4] Mingw compile fixes.

[...]

> --- a/libguile/bdw-gc.h
> +++ b/libguile/bdw-gc.h
> @@ -30,7 +30,9 @@
>     allocation.  */
>  
>  # define GC_THREADS 1
> +#ifndef __MINGW32__
>  # define GC_REDIRECT_TO_LOCAL 1
> +#endif /* __MINGW32__ */

Why?

> --- a/libguile/deprecated.c
> +++ b/libguile/deprecated.c
> @@ -1639,7 +1639,7 @@ scm_i_fluidp (SCM x)
>  
>  /* Networking.  */
>  
> -#ifdef HAVE_NETWORKING
> +#ifdef HAVE_IPV6
>  
>  SCM_DEFINE (scm_inet_aton, "inet-aton", 1, 0, 0,
>              (SCM address),
> @@ -1674,7 +1674,7 @@ SCM_DEFINE (scm_inet_ntoa, "inet-ntoa", 1, 0, 0,
>  }
>  #undef FUNC_NAME
>  
> -#endif /* HAVE_NETWORKING */
> +#endif /* HAVE_IPV6 */

Commit e91f21dc1093dc7be139f99d211edee01a64705f should fix it,
differently.

> --- a/libguile/filesys.c
> +++ b/libguile/filesys.c
> @@ -523,7 +523,7 @@ static int fstat_Win32 (int fdes, struct stat *buf)
>    /* Is this a socket ? */
>    if (getsockopt (fdes, SOL_SOCKET, SO_ERROR, (void *) &error, &optlen) >= 0)
>      {
> -      buf->st_mode = _S_IFSOCK | _S_IREAD | _S_IWRITE | _S_IEXEC;
> +      buf->st_mode = _S_IREAD | _S_IWRITE | _S_IEXEC;

Why?  Isn’t ‘_S_IFSOCK’ defined on all MinGW?

> --- a/libguile/net_db.c
> +++ b/libguile/net_db.c
> @@ -456,6 +456,7 @@ SCM_DEFINE (scm_setserv, "setserv", 0, 1, 0,
>  
>  SCM_SYMBOL (sym_getaddrinfo_error, "getaddrinfo-error");
>  
> +#ifndef __MINGW32__
>  /* Make sure the `AI_*' flags can be stored as INUMs.  */
>  verify (SCM_I_INUM (SCM_I_MAKINUM (AI_ALL)) == AI_ALL);

Does MinGW lack getaddrinfo?

Gnulib’s ‘getaddrinfo’ module, which we use, is supposed to take care of
this, i.e., it should fall back to ‘gethostbyname’ if needed.

> --- a/libguile/ports.h
> +++ b/libguile/ports.h
> @@ -26,6 +26,7 @@
>  
>  #include "libguile/__scm.h"
>  
> +#include <unistd.h>

Applied.

> --- a/libguile/socket.c
> +++ b/libguile/socket.c
> @@ -40,6 +40,7 @@
>  
>  #ifdef __MINGW32__
>  #include "win32-socket.h"
> +#include <netdb.h>
>  #endif
>  
>  #ifdef HAVE_STDINT_H

Applied.

Thanks!

Ludo’.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]