bug#10474: Building guile 2.x under mingw + msys
> Date: Thu, 19 Jan 2012 19:35:04 +0200 > From: Eli Zaretskii > Cc: 10...@debbugs.gnu.org, commander.si...@googlemail.com > > > (The rest of your investigation is interesting!) > > Here's some more ;-) As promised, still more issues below. 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. 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. 5. Compilation error in net_db.c: CC net_db.lo net_db.c:460: error: `AI_ALL' undeclared here (not in a function) net_db.c:460: error: bit-field `_gl_verify_error_if_negative' width not an integer constant net_db.c:482: warning: "struct addrinfo" declared inside parameter list net_db.c:482: warning: its scope is only this definition or declaration, which is probably not what you want net_db.c: In function `scm_from_addrinfo': net_db.c:490: error: dereferencing pointer to incomplete type net_db.c:491: error: dereferencing pointer to incomplete type net_db.c:492: error: dereferencing pointer to incomplete type net_db.c:493: error: dereferencing pointer to incomplete type net_db.c:494: error: dereferencing pointer to incomplete type net_db.c:494: error: dereferencing pointer to incomplete type net_db.c:496: error: dereferencing pointer to incomplete type net_db.c:496: error: dereferencing pointer to incomplete type net_db.c: In function `scm_getaddrinfo': net_db.c:614: error: storage size of 'c_hints' isn't known net_db.c:657: warning: implicit declaration of function `getaddrinfo' net_db.c:665: error: dereferencing pointer to incomplete type net_db.c:665: warning: left-hand operand of comma expression has no effect net_db.c:668: warning: implicit declaration of function `
bug#10520: [platform-testers] Guile 2.0.4 release imminent
Hi Bruno, Bruno Haible skribis: > 8) On Linux/hppa and Linux/SPARC32 and Linux/IA-64, build failure in the > libguile directory: > > SNARF socket.doc > SNARF regex-posix.doc > GENguile-procedures.texi > /bin/sh: line 1: 1022 Broken pipe cat alist.doc arbiters.doc > array-handle.doc array-map.doc arrays.doc async.doc backtrace.doc boolean.doc > bitvectors.doc bytevectors.doc chars.doc control.doc continuations.doc > debug.doc deprecated.doc deprecation.doc dynl.doc dynwind.doc eq.doc > error.doc eval.doc evalext.doc expand.doc extensions.doc feature.doc > filesys.doc fluids.doc foreign.doc fports.doc gc-malloc.doc gc.doc > gettext.doc generalized-arrays.doc generalized-vectors.doc goops.doc > gsubr.doc guardians.doc hash.doc hashtab.doc hooks.doc i18n.doc init.doc > ioext.doc keywords.doc list.doc load.doc macros.doc mallocs.doc memoize.doc > modules.doc numbers.doc objprop.doc options.doc pairs.doc ports.doc print.doc > procprop.doc procs.doc promises.doc r6rs-ports.doc random.doc rdelim.doc > read.doc root.doc rw.doc scmsigs.doc script.doc simpos.doc smob.doc sort.doc > srcprop.doc srfi-1.doc srfi-4.doc srfi-13.doc srfi-14.doc srfi-60.doc > stackchk.doc stacks.doc stime.doc strings.doc strorder.doc strports.doc > struct.doc symbols.doc threads.doc throw.doc trees.doc uniform.doc values.doc > variable.doc vectors.doc version.doc vports.doc weaks.doc dynl.doc posix.doc > net_db.doc socket.doc regex-posix.doc > 1023 Segmentation fault | GUILE_AUTO_COMPILE=0 > ../meta/uninstalled-env guild snarf-check-and-output-texi > > guile-procedures.texi > make[3]: *** [guile-procedures.texi] Error 1 I bisected this and found this harmless-looking patch to be the culprit: http://git.savannah.gnu.org/cgit/guile.git/commit/?id=3e54fdfc217969abb50a46ec9c9c5c02a2c7d369 The segfault would occur in vm-i-system.c:1281, in the ‘CACHE_PROGRAM’ macro, while trying to access ‘SCM_PROGRAM_DATA’, because of a bogus value for ‘program’, stemming from a bogus ‘fp’. After a long and tiring period of investigation, I found that reverting just the definitions SCM_FRAME_DYNAMIC_LINK and SCM_FRAME_SET_DYNAMIC_LINK would solve the problem. Eventually, I found that, keeping frames.h unchanged, adding a compiler barrier after each ‘fp’ assignment would solve the problem: diff --git a/libguile/vm-i-system.c b/libguile/vm-i-system.c index 474fe78..a47ac38 100644 --- a/libguile/vm-i-system.c +++ b/libguile/vm-i-system.c @@ -55,6 +55,7 @@ VM_DEFINE_INSTRUCTION (1, halt, "halt", 0, 0, 0) stack */ ip = SCM_FRAME_RETURN_ADDRESS (fp); fp = SCM_FRAME_DYNAMIC_LINK (fp); +asm volatile (""); NULLSTACK (old_sp - sp); } @@ -1267,6 +1268,7 @@ VM_DEFINE_INSTRUCTION (67, return, "return", 0, 1, 1) sp = SCM_FRAME_LOWER_ADDRESS (fp); ip = SCM_FRAME_RETURN_ADDRESS (fp); fp = SCM_FRAME_DYNAMIC_LINK (fp); +asm volatile (""); #ifdef VM_ENABLE_STACK_NULLING NULLSTACK (old_sp - sp); @@ -1302,6 +1304,7 @@ VM_DEFINE_INSTRUCTION (68, return_values, "return/values", 1, -1, -1) sp = SCM_FRAME_LOWER_ADDRESS (fp) - 1; ip = SCM_FRAME_MV_RETURN_ADDRESS (fp); fp = SCM_FRAME_DYNAMIC_LINK (fp); + asm volatile (""); /* Push return values, and the number of values */ for (i = 0; i < nvalues; i++) @@ -1322,6 +1325,7 @@ VM_DEFINE_INSTRUCTION (68, return_values, "return/values", 1, -1, -1) sp = SCM_FRAME_LOWER_ADDRESS (fp) - 1; ip = SCM_FRAME_RETURN_ADDRESS (fp); fp = SCM_FRAME_DYNAMIC_LINK (fp); + asm volatile (""); /* Push first value */ *++sp = vals[1]; This is not entirely satisfactory either, because I don’t see why this barrier would be needed. It could be a GCC bug, as this file is a real stress test. Ideas? Unless someone comes up with a better idea, I’ll commit a portable version of the above patch. (Tested on sparc64-unknown-linux-gnu and hppa2.0-unknown-linux-gnu.) Thanks, Ludo’.
bug#10520: Status: [platform-testers] Guile 2.0.4 release imminent
retitle 10520 2.0.3+ portability issues thanks