From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.bugs,gmane.lisp.guile.devel Subject: Re: Guile with win32 cross compiling Date: Tue, 12 Apr 2011 13:14:14 +0200 Message-ID: References: <20110326220651.GA8300@flap> <20110401185020.GC13643@flap> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1302608471 13364 80.91.229.12 (12 Apr 2011 11:41:11 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 12 Apr 2011 11:41:11 +0000 (UTC) Cc: bug-guile@gnu.org, guile-devel@gnu.org, Mike Gran To: Volker Grabsch Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Tue Apr 12 13:41:06 2011 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from [140.186.70.17] (helo=lists.gnu.org) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q9bxx-0001rp-Fu for guile-bugs@m.gmane.org; Tue, 12 Apr 2011 13:41:05 +0200 Original-Received: from localhost ([::1]:53995 helo=lists2.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q9bxx-0006OF-3G for guile-bugs@m.gmane.org; Tue, 12 Apr 2011 07:41:05 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:49853) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q9bxs-0006No-Ul for bug-guile@gnu.org; Tue, 12 Apr 2011 07:41:02 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q9bxq-00073G-W0 for bug-guile@gnu.org; Tue, 12 Apr 2011 07:41:00 -0400 Original-Received: from a-pb-sasl-sd.pobox.com ([64.74.157.62]:54440 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q9bxq-000739-Pj; Tue, 12 Apr 2011 07:40:58 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 26E743E31; Tue, 12 Apr 2011 07:42:57 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=VKo6xh9bCmmz2RJCZjzrBxiSCrk=; b=qfwlWq qNxOnGoOJs2KE939guPvI2fMHI3qE+iN9M/ceQqrhFx5Cbt7wd/i8ptDEfEV/nkq +XouJMK086TW0VE36sbNXn2gW6bfJvTjLWmJNBAP/1P8Eg3Nklxx1aA9vC3haizZ C1GcK6RfKQP5UFvPft2huXSzLvMHAGUDZxvlQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=P5jzZ/A338HHjZGZMMuVkCHaLm4GQPsc Ba4E/IfXQXrtD+1bpIVraoKcqiGi6LlGp63df8sqLPczchRX5d+qLNH8oBXJc3mO +jzDyNGNWeP1UMs79XvkJn5BqkG+pdciZjQYwL2YTay4NiL9MwePfXVOfbLh3Xrg oVJzwU9Zkd4= Original-Received: from a-pb-sasl-sd.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id E82A03E30; Tue, 12 Apr 2011 07:42:52 -0400 (EDT) Original-Received: from unquote.localdomain (unknown [90.164.198.39]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTPSA id AF0733E2C; Tue, 12 Apr 2011 07:42:48 -0400 (EDT) In-Reply-To: <20110401185020.GC13643@flap> (Volker Grabsch's message of "Fri, 1 Apr 2011 20:50:20 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-Pobox-Relay-ID: 002A87BC-64FA-11E0-896F-E8AB60295C12-02397024!a-pb-sasl-sd.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 64.74.157.62 X-BeenThere: bug-guile@gnu.org X-Mailman-Version: 2.1.14 Precedence: list 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 X-Broken-Reverse-DNS: no host name found for IP address 140.186.70.17 Xref: news.gmane.org gmane.lisp.guile.bugs:5460 gmane.lisp.guile.devel:12221 Archived-At: --=-=-= Hi Volker, On Fri 01 Apr 2011 20:50, Volker Grabsch writes: > "Portability fixes for win32 cross compiling" > http://www.mail-archive.com/guile-devel@gnu.org/msg05308.html Ah yes. Thanks for that link. And thank you for your ongoing patience :-) > Gen-scmconfig is a code generator, so it has to be built using > the native toolchain. However, it is supposed to write take its > values from the of the cross tool chain. Thus, the > "/usr/include" equivalent of the cross tool chain is added to > the include path when compiling gen-scmconfig. And here the > trouble starts, because mixing headers of various toolchains > is never a good idea. Among others, basic headers like > are now taken from the cross toolchain, referring to objects that > don't even exist in the native toolchain, causing the build to > fail with all kinds of strange error messages. 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? Regards, Andy --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-check-for-iconveh-values-at-configure-time.patch >From b03f8337ea62091208680fab901606c9af360a5d Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Tue, 12 Apr 2011 13:12:56 +0200 Subject: [PATCH] check for iconveh values at configure-time * configure.ac: Check for the iconveh values here, instead of relying on gen-scmconfig to know them. That doesn't work in general because gen-scmconfig runs on the build machine, not the target machine. * libguile/Makefile.am (gen-scmconfig.$(OBJEXT)): Revert rule to the revision before 533d8212. * libguile/gen-scmconfig.h.in (SCM_I_GSC_ICONVEH_ERROR): (SCM_I_GSC_ICONVEH_QUESTION_MARK): (SCM_I_GSC_ICONVEH_ESCAPE_SEQUENCE): * libguile/gen-scmconfig.c: Use configure-time substitutions to set SCM_ICONVEH_ERROR_HANDLER et al. --- configure.ac | 64 +++++++++++++++++++++++++++++++++++++++++++ libguile/Makefile.am | 12 +++----- libguile/gen-scmconfig.c | 9 +++--- libguile/gen-scmconfig.h.in | 3 ++ 4 files changed, 76 insertions(+), 12 deletions(-) diff --git a/configure.ac b/configure.ac index 45438c8..1f68e0f 100644 --- a/configure.ac +++ b/configure.ac @@ -1188,6 +1188,70 @@ GUILE_STRUCT_UTIMBUF #-------------------------------------------------------------------- # +# What values do the iconv error handlers have? +# +# The only place that we need iconv in our public interfaces is for +# the error handlers, which are just ints. So we weaken our +# dependency by looking up those values at configure-time. +#-------------------------------------------------------------------- +SCM_I_GSC_ICONVEH_ERROR=0 +SCM_I_GSC_ICONVEH_QUESTION_MARK=1 +SCM_I_GSC_ICONVEH_ESCAPE_SEQUENCE=2 +AC_MSG_CHECKING([for iconveh_error]) +AC_RUN_IFELSE([AC_LANG_SOURCE( +[AC_INCLUDES_DEFAULT +#include +int +main (int argc, char *argv[]) +{ + if (argc > 1) + printf ("%d\n", (int)iconveh_error); + return 0; +}])], + [SCM_I_GSC_ICONVEH_ERROR=`./conftest$EXEEXT pretty-please` + AC_MSG_RESULT([$SCM_I_GSC_ICONVEH_ERROR])], + [AC_MSG_FAILURE([failed to get iconveh_error])], + [AC_MSG_WARN([assuming $SCM_I_GSC_ICONVEH_ERROR for cross-compilation])]) + +AC_MSG_CHECKING([for iconveh_question_mark]) +AC_RUN_IFELSE([AC_LANG_SOURCE( +[AC_INCLUDES_DEFAULT +#include +int +main (int argc, char *argv[]) +{ + if (argc > 1) + printf ("%d\n", (int)iconveh_question_mark); + return 0; +}])], + [SCM_I_GSC_ICONVEH_QUESTION_MARK=`./conftest$EXEEXT pretty-please` + AC_MSG_RESULT([$SCM_I_GSC_ICONVEH_QUESTION_MARK])], + [AC_MSG_FAILURE([failed to get iconveh_question_mark])], + [AC_MSG_WARN([assuming $SCM_I_GSC_ICONVEH_QUESTION_MARK for cross-compilation])]) + +AC_MSG_CHECKING([for iconveh_escape_sequence]) +AC_RUN_IFELSE([AC_LANG_SOURCE( +[AC_INCLUDES_DEFAULT +#include +int +main (int argc, char *argv[]) +{ + if (argc > 1) + printf ("%d\n", (int)iconveh_escape_sequence); + return 0; +}])], + [SCM_I_GSC_ICONVEH_ESCAPE_SEQUENCE=`./conftest$EXEEXT pretty-please` + AC_MSG_RESULT([$SCM_I_GSC_ICONVEH_ESCAPE_SEQUENCE])], + [AC_MSG_FAILURE([failed to get iconveh_escape_sequence])], + [AC_MSG_WARN([assuming $SCM_I_GSC_ICONVEH_ESCAPE_SEQUENCE for cross-compilation])]) + +AC_SUBST([SCM_I_GSC_ICONVEH_ERROR]) +AC_SUBST([SCM_I_GSC_ICONVEH_QUESTION_MARK]) +AC_SUBST([SCM_I_GSC_ICONVEH_ESCAPE_SEQUENCE]) + + +#-------------------------------------------------------------------- +# # Which way does the stack grow? # # Following code comes from Autoconf 2.61's internal _AC_LIBOBJ_ALLOCA diff --git a/libguile/Makefile.am b/libguile/Makefile.am index ac27eb8..ffb4059 100644 --- a/libguile/Makefile.am +++ b/libguile/Makefile.am @@ -55,13 +55,11 @@ gen_scmconfig_SOURCES = gen-scmconfig.c ## Override default rule; this should be compiled for BUILD host. ## For some reason, OBJEXT does not include the dot gen-scmconfig.$(OBJEXT): gen-scmconfig.c - $(AM_V_GEN) \ - if [ "$(cross_compiling)" = "yes" ]; then \ - $(CC_FOR_BUILD) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) \ - -c -o $@ $<; \ - else \ - $(COMPILE) -c -o $@ $<; \ + $(AM_V_GEN) \ + if [ "$(cross_compiling)" = "yes" ]; then \ + $(CC_FOR_BUILD) $(DEFS) $(DEFAULT_INCLUDES) $(AM_CPPFLAGS) -c -o $@ $<; \ + else \ + $(COMPILE) -c -o $@ $<; \ fi ## Override default rule; this should run on BUILD host. diff --git a/libguile/gen-scmconfig.c b/libguile/gen-scmconfig.c index 5834346..176f25c 100644 --- a/libguile/gen-scmconfig.c +++ b/libguile/gen-scmconfig.c @@ -123,7 +123,6 @@ #include #include -#include #define pf printf @@ -397,11 +396,11 @@ main (int argc, char *argv[]) pf ("\n"); pf ("/* Constants from uniconv.h. */\n"); - pf ("#define SCM_ICONVEH_ERROR %d\n", (int) iconveh_error); - pf ("#define SCM_ICONVEH_QUESTION_MARK %d\n", - (int) iconveh_question_mark); + pf ("#define SCM_ICONVEH_ERROR %d\n", SCM_I_GSC_ICONVEH_ERROR); + pf ("#define SCM_ICONVEH_QUESTION_MARK %d\n", + SCM_I_GSC_ICONVEH_QUESTION_MARK); pf ("#define SCM_ICONVEH_ESCAPE_SEQUENCE %d\n", - (int) iconveh_escape_sequence); + SCM_I_GSC_ICONVEH_ESCAPE_SEQUENCE); printf ("#endif\n"); diff --git a/libguile/gen-scmconfig.h.in b/libguile/gen-scmconfig.h.in index 125720a..30f43d7 100644 --- a/libguile/gen-scmconfig.h.in +++ b/libguile/gen-scmconfig.h.in @@ -31,6 +31,9 @@ #define SCM_I_GSC_NEED_BRACES_ON_PTHREAD_MUTEX_INITIALIZER @SCM_I_GSC_NEED_BRACES_ON_PTHREAD_MUTEX_INITIALIZER@ #define SCM_I_GSC_HAVE_THREAD_STORAGE_CLASS @SCM_I_GSC_HAVE_THREAD_STORAGE_CLASS@ #define SCM_I_GSC_HAVE_STRUCT_DIRENT64 @SCM_I_GSC_HAVE_STRUCT_DIRENT64@ +#define SCM_I_GSC_ICONVEH_ERROR @SCM_I_GSC_ICONVEH_ERROR@ +#define SCM_I_GSC_ICONVEH_QUESTION_MARK @SCM_I_GSC_ICONVEH_QUESTION_MARK@ +#define SCM_I_GSC_ICONVEH_ESCAPE_SEQUENCE @SCM_I_GSC_ICONVEH_ESCAPE_SEQUENCE@ /* Local Variables: -- 1.7.3.4 --=-=-= -- http://wingolog.org/ --=-=-=--