Volker Grabsch <v...@notjusthosting.com> schrieb:
> Or, what about changing the generated code? Why does the generator
> have to determine a number to be written into the generated code?
> Instead, the generated "scmconfig.h" could contain code like this:
> 
>     #include <uniconv.h>
> 
>     ...
> 
>     #define SCM_ICONVEH_ERROR iconveh_error

Okay, I just implemented that approach and it seems to work fine.
There were several other issues I had to fix. Please have a look
at the attached patches (6 in total). All of them seem to be needed
to cross-compile guile for mingw32.

In the end, I'm struck with the following error that I don't
know how to fix.

It would be great if you could have a look at my patches, and if
you could either include them, or tell me what's wrong with them.


-------------------------------------------------------------------
i686-pc-mingw32-gcc -std=gnu99 -DHAVE_CONFIG_H -DBUILDING_LIBGUILE=1 -I.. -I.. 
-I../lib -I../lib -I/.../i686-pc-mingw32/lib/libffi-3.0.9/include 
-I/.../i686-pc-mingw32/include -I/.../i686-pc-mingw32/include -Wall 
-Wmissing-prototypes -Wdeclaration-after-statement -Wundef -Wswitch-enum 
-fvisibility=hidden -I/.../i686-pc-mingw32/include -g -O2 -MT 
libguile_2.0_la-foreign.lo -MD -MP -MF .deps/libguile_2.0_la-foreign.Tpo -c 
foreign.c -o libguile_2.0_la-foreign.o
foreign.c: In function 'scm_foreign_to_bytevector':
foreign.c:252: error: 'SCM_FOREIGN_TYPE_void' undeclared (first use in this 
function)
foreign.c:252: error: (Each undeclared identifier is reported only once
foreign.c:252: error: for each function it appears in.)
foreign.c: In function 'scm_foreign_set_finalizer_x':
foreign.c:371: error: 'SCM_FOREIGN_TYPE_void' undeclared (first use in this 
function)
foreign.c: In function 'scm_make_foreign_function':
foreign.c:678: error: 'SCM_FOREIGN_TYPE_void' undeclared (first use in this 
function)
foreign.c: In function 'scm_i_foreign_call':
foreign.c:993: warning: implicit declaration of function 'alloca'
foreign.c:993: warning: incompatible implicit declaration of built-in function 
'alloca'
make[3]: *** [libguile_2.0_la-foreign.lo] Error 1
make[3]: Leaving directory `/home/vog/mingw-cross-env/Guile/guile/libguile'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/vog/mingw-cross-env/Guile/guile/libguile'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/vog/mingw-cross-env/Guile/guile'
make: *** [all] Error 2
-------------------------------------------------------------------


Greets,

    Volker

-- 
Volker Grabsch
---<<(())>>---
Administrator
NotJustHosting GbR
>From 6a05429f8da76475b7fc03ad42d308b98f6b777b Mon Sep 17 00:00:00 2001
From: Volker Grabsch <v...@notjusthosting.com>
Date: Thu, 15 Apr 2010 00:58:22 +0200
Subject: [PATCH] add pdcurses to the list of termlibs

---
 acinclude.m4 |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 2f1466b..8cfe1d4 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -378,7 +378,7 @@ dnl
 dnl Check all the things needed by `guile-readline', the Readline
 dnl bindings.
 AC_DEFUN([GUILE_READLINE], [
-  for termlib in ncurses curses termcap terminfo termlib ; do
+  for termlib in ncurses curses termcap terminfo termlib pdcurses ; do
      AC_CHECK_LIB(${termlib}, [tgoto],
        [READLINE_LIBS="-l${termlib} $READLINE_LIBS"; break])
   done
-- 
1.5.6.5

>From fc80796464b051294280bba5af8ee4c25bef7c70 Mon Sep 17 00:00:00 2001
From: Volker Grabsch <v...@notjusthosting.com>
Date: Thu, 15 Apr 2010 01:01:23 +0200
Subject: [PATCH] don't run the pthread_att_get_stack check when cross compiling

---
 configure.ac |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index 73a4bd2..c6f480a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1413,6 +1413,7 @@ if test "$with_threads" = pthreads; then
 AC_MSG_CHECKING(whether pthread_attr_getstack works for the main thread)
 old_CFLAGS="$CFLAGS"
 CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
+if test "$cross_compiling" = "no"; then
 AC_RUN_IFELSE([AC_LANG_SOURCE([[
 #if HAVE_PTHREAD_ATTR_GETSTACK
 #include <pthread.h>
@@ -1443,6 +1444,9 @@ int main ()
 AC_DEFINE([PTHREAD_ATTR_GETSTACK_WORKS], [1], [Define when pthread_att_get_stack works for the main thread])],
 [works=no],
 [])
+else
+works=no
+fi
 CFLAGS="$old_CFLAGS"
 AC_MSG_RESULT($works)
 
-- 
1.5.6.5

>From 34323df112197162c2441ec248895814ea911c76 Mon Sep 17 00:00:00 2001
From: Volker Grabsch <v...@notjusthosting.com>
Date: Wed, 21 Apr 2010 18:36:30 +0200
Subject: [PATCH] fix gen-scmconfig for cross compiling

---
 libguile/Makefile.am     |    2 +-
 libguile/gen-scmconfig.c |   10 ++++------
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/libguile/Makefile.am b/libguile/Makefile.am
index a841c9f..5b441ec 100644
--- a/libguile/Makefile.am
+++ b/libguile/Makefile.am
@@ -54,7 +54,7 @@ gen_scmconfig_SOURCES = gen-scmconfig.c
 ## For some reason, OBJEXT does not include the dot
 gen-scmconfig.$(OBJEXT): gen-scmconfig.c
 	if [ "$(cross_compiling)" = "yes" ]; then \
-		$(CC_FOR_BUILD) $(DEFS) $(DEFAULT_INCLUDES) $(AM_CPPFLAGS) -c -o $@ $<; \
+		$(CC_FOR_BUILD) $(DEFS) $(DEFAULT_INCLUDES) -DBUILDING_LIBGUILE=1 -I$(top_srcdir) -I$(top_builddir) -c -o $@ $<; \
 	else \
 		$(COMPILE) -c -o $@ $<; \
 	fi
diff --git a/libguile/gen-scmconfig.c b/libguile/gen-scmconfig.c
index 851578f..5a37c68 100644
--- a/libguile/gen-scmconfig.c
+++ b/libguile/gen-scmconfig.c
@@ -125,7 +125,6 @@
 
 #include <stdio.h>
 #include <string.h>
-#include <uniconv.h>
 
 #define pf printf
 
@@ -145,6 +144,7 @@ main (int argc, char *argv[])
     pf ("#include <stdint.h>\n");
   if (SCM_I_GSC_NEEDS_INTTYPES_H)
     pf ("#include <inttypes.h>\n");
+  pf ("#include <uniconv.h>\n");
 
 #ifdef HAVE_LIMITS_H
   pf ("#include <limits.h>\n");
@@ -423,11 +423,9 @@ 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_ESCAPE_SEQUENCE %d\n",
-      (int) iconveh_escape_sequence);  
+  pf ("#define SCM_ICONVEH_ERROR ((int) iconveh_error)\n");
+  pf ("#define SCM_ICONVEH_QUESTION_MARK ((int) iconveh_question_mark)\n");
+  pf ("#define SCM_ICONVEH_ESCAPE_SEQUENCE ((int) iconveh_escape_sequence)\n");
 
   printf ("#endif\n");
 
-- 
1.5.6.5

>From 6f2b554eb5cf6a5f580689b6418fbb28d7d42c7c Mon Sep 17 00:00:00 2001
From: Volker Grabsch <v...@notjusthosting.com>
Date: Wed, 21 Apr 2010 18:45:49 +0200
Subject: [PATCH] remove an unused and dangling #include directive

---
 libguile/objcodes.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/libguile/objcodes.c b/libguile/objcodes.c
index 2931468..47f6f3a 100644
--- a/libguile/objcodes.c
+++ b/libguile/objcodes.c
@@ -23,7 +23,6 @@
 #include <string.h>
 #include <fcntl.h>
 #include <unistd.h>
-#include <sys/mman.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <assert.h>
-- 
1.5.6.5

>From 2e30b23bd88dd5521ca87c920381999ed4e041c3 Mon Sep 17 00:00:00 2001
From: Volker Grabsch <v...@notjusthosting.com>
Date: Wed, 21 Apr 2010 18:47:51 +0200
Subject: [PATCH] don't fail when HAVE_STAT64 is undefined

---
 libguile/_scm.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libguile/_scm.h b/libguile/_scm.h
index a1884ca..ceca71a 100644
--- a/libguile/_scm.h
+++ b/libguile/_scm.h
@@ -119,7 +119,7 @@
 
 
 
-#if GUILE_USE_64_CALLS && HAVE_STAT64
+#if GUILE_USE_64_CALLS && defined(HAVE_STAT64)
 #define CHOOSE_LARGEFILE(foo,foo64)     foo64
 #else
 #define CHOOSE_LARGEFILE(foo,foo64)     foo
-- 
1.5.6.5

>From a9125a364c838c1bad2f3e2b153f7564b6502fc9 Mon Sep 17 00:00:00 2001
From: Volker Grabsch <v...@notjusthosting.com>
Date: Wed, 21 Apr 2010 19:52:37 +0200
Subject: [PATCH] disable thread redirects of bdw-gc

---
 libguile/bdw-gc.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/libguile/bdw-gc.h b/libguile/bdw-gc.h
index 3adf99e..9780737 100644
--- a/libguile/bdw-gc.h
+++ b/libguile/bdw-gc.h
@@ -34,6 +34,8 @@
 
 #endif
 
+#define GC_NO_THREAD_REDIRECTS
+
 #include <gc/gc.h>
 
 #if (! ((defined GC_VERSION_MAJOR) && (GC_VERSION_MAJOR >= 7)))
-- 
1.5.6.5

Reply via email to