From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Volker Grabsch Newsgroups: gmane.lisp.guile.devel,gmane.lisp.guile.bugs Subject: Re: Guile with win32 cross compiling Date: Tue, 17 May 2011 01:01:01 +0200 Message-ID: <20110516230101.GB3311@flap> References: <20110326220651.GA8300@flap> <20110401185020.GC13643@flap> <20110423161003.GB20479@flap> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="oyUTqETQ0mS9luUI" X-Trace: dough.gmane.org 1305586888 19547 80.91.229.12 (16 May 2011 23:01:28 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 16 May 2011 23:01:28 +0000 (UTC) Cc: bug-guile@gnu.org, guile-devel@gnu.org To: Andy Wingo Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue May 17 01:01:23 2011 Return-path: Envelope-to: guile-devel@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 1QM6mv-0006NI-AY for guile-devel@m.gmane.org; Tue, 17 May 2011 01:01:21 +0200 Original-Received: from localhost ([::1]:54814 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QM6mv-00015Y-0O for guile-devel@m.gmane.org; Mon, 16 May 2011 19:01:21 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:51096) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QM6mo-00011u-K4 for guile-devel@gnu.org; Mon, 16 May 2011 19:01:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QM6mk-0002Z8-6f for guile-devel@gnu.org; Mon, 16 May 2011 19:01:14 -0400 Original-Received: from mail.notjusthosting.com ([78.47.75.226]:41426) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QM6mj-0002Yx-S2; Mon, 16 May 2011 19:01:10 -0400 Original-Received: from p5df13bd7.dip.t-dialin.net ([93.241.59.215] helo=flap) by mail.notjusthosting.com with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1QM6mc-0002BV-7X; Mon, 16 May 2011 23:01:02 +0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 78.47.75.226 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:12499 gmane.lisp.guile.bugs:5575 Archived-At: --oyUTqETQ0mS9luUI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Andy Wingo schrieb: > On Sat 23 Apr 2011 18:10, Volker Grabsch writes: > > > Andy Wingo schrieb: > >> Hmmm. Well. We have other code generators in Guile's build system; > >> notably the configure script (via config.h and other output files). > >> What do folks think about the attached patch? > > > > Please drop me a note when you want me to check your patch, > > confirming that your work really solves the win32 cross issues. > > Hmm, it should have applied to stable-2.0. I can commit it if there are > no objections, as there do not appear to be. It should fix the > gen-scmconfig issue. Okay, so I give it another try. git clone http://git.savannah.gnu.org/r/guile.git -b stable-2.0 cd guile It seems that your patch is already in there, so no "patch" command is needed after "git clone". Next steps are autogen/configure/make. The whole configure command is a bit longer, because unfortunately we have to tweak some stuff to make it really cross-compile: ./autogen.sh ./configure --host=i686-pc-mingw32 --disable-shared --without-threads scm_cv_struct_timespec=no LIBS='-lunistring -lintl -liconv' make Explanation: "--without-threads" is needed because threading is a difficult issue that I'd like to deal later with. "scm_cv_struct_timespec=no" is needed to ensure that libguile/threads.c won't try to use the "struct timespec" from , which would fail because we don't use pthreads (yet). I think this should better be fixed in the source, but this workaround does the trick for now. "LIBS='-lunistring -lintl -liconv'" is needed because otherwise, the detection of libunistring fails. I think this should better be fixed in configure.ac, but this workaround does the trick for now. In addition, I had to fix two other things in the source. The patches are attached to this email: "fix-include-error-in-gen-scmconfig.patch" The patch re-introduces a change which I already proposed in my last patch: You can't use $(AM_CPPFLAGS) for the native build, because it adds "-I../lib" which means that is taken from the local GNU-lib installation. The problem is that the GNU-lib in "lib/" has been configured for MinGW, not for the native system. So it performs some fixes which don't work on non-MinGW systems, leading to strange, unhelpful error messages. It took me quite some time to figure this out, mostly because I thought that this should have already been fixed. "remove-mingw-ifsock.patch" This patch fixes an issue that also appears on native MinGW build, because _S_IFSOCK simply isn't defined there. Note that this issue was already reported, but hasn't been fixed up to now, at least not in the stable-2.0 branch: http://lists.gnu.org/archive/html/guile-devel/2011-01/msg00183.html After those changes, the build continues quite far, but ultimately fails at the following position: -------------------------------------------------------------------------- CC net_db.lo net_db.c:460:1: error: 'AI_ALL' undeclared here (not in a function) net_db.c:460:1: error: expression in static assertion is not an integer net_db.c:482:33: warning: 'struct addrinfo' declared inside parameter list [enabled by default] net_db.c:482:33: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default] net_db.c: In function 'scm_from_addrinfo': net_db.c:490:3: error: dereferencing pointer to incomplete type net_db.c:491:3: error: dereferencing pointer to incomplete type net_db.c:492:3: error: dereferencing pointer to incomplete type net_db.c:493:3: error: dereferencing pointer to incomplete type net_db.c:494:3: error: dereferencing pointer to incomplete type net_db.c:494:3: error: dereferencing pointer to incomplete type net_db.c:496:3: error: dereferencing pointer to incomplete type net_db.c:496:3: error: dereferencing pointer to incomplete type net_db.c: In function 'scm_getaddrinfo': net_db.c:614:19: error: storage size of 'c_hints' isn't known net_db.c:657:3: warning: implicit declaration of function 'getaddrinfo' [-Wimplicit-function-declaration] net_db.c:665:10: error: dereferencing pointer to incomplete type net_db.c:665:19: warning: left-hand operand of comma expression has no effect [-Wunused-value] net_db.c:666:2: warning: passing argument 1 of 'scm_from_addrinfo' from incompatible pointer type [enabled by default] net_db.c:482:1: note: expected 'const struct addrinfo *' but argument is of type 'struct addrinfo *' net_db.c:668:7: warning: implicit declaration of function 'freeaddrinfo' [-Wimplicit-function-declaration] net_db.c:614:19: warning: unused variable 'c_hints' [-Wunused-variable] net_db.c: At top level: net_db.c:680:1: error: 'EAI_BADFLAGS' undeclared here (not in a function) net_db.c:680:1: error: expression in static assertion is not an integer net_db.c: In function 'scm_gai_strerror': net_db.c:744:3: warning: implicit declaration of function 'gai_strerror' [-Wimplicit-function-declaration] net_db.c:744:3: warning: passing argument 1 of 'scm_from_locale_string' makes pointer from integer without a cast [enabled by default] ../libguile/strings.h:134:13: note: expected 'const char *' but argument is of type 'int' In file included from net_db.c:755:0: ../libguile/net_db.x: In function 'scm_init_net_db': ../libguile/net_db.x:17:78: error: 'AI_PASSIVE' undeclared (first use in this function) ../libguile/net_db.x:17:78: note: each undeclared identifier is reported only once for each function it appears in ../libguile/net_db.x:18:82: error: 'AI_CANONNAME' undeclared (first use in this function) ../libguile/net_db.x:19:86: error: 'AI_NUMERICHOST' undeclared (first use in this function) ../libguile/net_db.x:20:86: error: 'AI_NUMERICSERV' undeclared (first use in this function) ../libguile/net_db.x:21:80: error: 'AI_V4MAPPED' undeclared (first use in this function) ../libguile/net_db.x:23:84: error: 'AI_ADDRCONFIG' undeclared (first use in this function) ../libguile/net_db.x:27:78: error: 'EAI_NONAME' undeclared (first use in this function) ../libguile/net_db.x:28:76: error: 'EAI_AGAIN' undeclared (first use in this function) ../libguile/net_db.x:29:74: error: 'EAI_FAIL' undeclared (first use in this function) ../libguile/net_db.x:30:78: error: 'EAI_FAMILY' undeclared (first use in this function) ../libguile/net_db.x:31:82: error: 'EAI_SOCKTYPE' undeclared (first use in this function) ../libguile/net_db.x:32:80: error: 'EAI_SERVICE' undeclared (first use in this function) ../libguile/net_db.x:33:78: error: 'EAI_MEMORY' undeclared (first use in this function) ../libguile/net_db.x:34:78: error: 'EAI_SYSTEM' undeclared (first use in this function) ../libguile/net_db.x:35:82: error: 'EAI_OVERFLOW' undeclared (first use in this function) make[3]: *** [net_db.lo] Error 1 -------------------------------------------------------------------------- Greets, Volker -- Volker Grabsch ---<<(())>>--- --oyUTqETQ0mS9luUI Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="fix-include-error-in-gen-scmconfig.patch" --- a/libguile/Makefile.am +++ b/libguile/Makefile.am @@ -57,7 +57,7 @@ gen_scmconfig_SOURCES = gen-scmconfig.c gen-scmconfig.$(OBJEXT): gen-scmconfig.c $(AM_V_GEN) \ if [ "$(cross_compiling)" = "yes" ]; then \ - $(CC_FOR_BUILD) $(DEFS) $(DEFAULT_INCLUDES) $(AM_CPPFLAGS) -c -o $@ $<; \ + $(CC_FOR_BUILD) $(DEFS) $(DEFAULT_INCLUDES) -I$(top_srcdir) -I$(top_builddir) -c -o $@ $<; \ else \ $(COMPILE) -c -o $@ $<; \ fi --oyUTqETQ0mS9luUI Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="remove-mingw-ifsock.patch" --- a/libguile/filesys.c +++ b/libguile/filesys.c @@ -473,7 +473,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; buf->st_nlink = 1; buf->st_atime = buf->st_ctime = buf->st_mtime = time (NULL); return 0; --oyUTqETQ0mS9luUI--