Welcome to the CHICKEN Scheme pasting service

cross-linux-mingw build fail (with possibly working patch) added by klm` on Tue Apr 21 08:34:15 2026

;; Following this guide:
;; https://wiki.call-cc.org/man/5/Cross%20development#special-notes-for-linux-to-windows-cross-development

$ aunpack ~/Downloads/chicken-5.4.0.tar.gz
$ make PREFIX=$PWD/build/target PLATFORM=cross-linux-mingw HOSTSYSTEM=x86_64-w64-mingw32

... 

;; Then I get this error:


posixwin.c:188:74: error: passing argument 3 of ‘spawnvp’ from incompatible pointer type [-Wincompatible-pointer-types]
  188 | #define C_u_i_spawnvp(m,f,a)    C_fix(spawnvp(C_unfix(m), C_c_string(f), (const char *const *)C_c_pointer_vector_or_null(a)))
      |                                                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                          |
      |                                                                          const char * const*
chicken.h:1046:56: note: in definition of macro ‘C_fix’
 1046 | #define C_fix(n)                   ((C_word)((C_uword)(n) << C_FIXNUM_SHIFT) | C_FIXNUM_BIT)
      |                                                        ^
posixwin.c:9768:59: note: in expansion of macro ‘C_u_i_spawnvp’
 9768 | t6=(C_truep(t4)?C_u_i_spawnvpe(((C_word*)t0)[2],t2,t3,t4):C_u_i_spawnvp(((C_word*)t0)[2],t2,t3));
      |                                                           ^~~~~~~~~~~~~
/gnu/store/m8d70irpglnvqbbgp09bnfyg173dlz07-profile/include/process.h:198:74: note: expected ‘char * const*’ but argument is of type ‘const char * const*’
  198 |   _CRTIMP intptr_t __cdecl spawnvp(int,const char *_Filename,char *const _ArgList[]) __MINGW_ATTRIB_DEPRECATED_MSVC2005;


;; This patch seems to fix the build (basically just s/const char *const/char *const):

modified   posixwin.c
@@ -181,12 +181,12 @@ static C_TLS TCHAR C_username[255 + 1] = "";
 
 #define C_u_i_lstat(fn)     C_u_i_stat(fn)
 
-#define C_u_i_execvp(f,a)   C_fix(execvp(C_c_string(f), (const char *const *)C_c_pointer_vector_or_null(a)))
-#define C_u_i_execve(f,a,e) C_fix(execve(C_c_string(f), (const char *const *)C_c_pointer_vector_or_null(a), (const char *const *)C_c_pointer_vector_or_null(e)))
+#define C_u_i_execvp(f,a)   C_fix(execvp(C_c_string(f), (char *const *)C_c_pointer_vector_or_null(a)))
+#define C_u_i_execve(f,a,e) C_fix(execve(C_c_string(f), (char *const *)C_c_pointer_vector_or_null(a), (char *const *)C_c_pointer_vector_or_null(e)))
 
 /* MS replacement for the fork-exec pair */
-#define C_u_i_spawnvp(m,f,a)    C_fix(spawnvp(C_unfix(m), C_c_string(f), (const char *const *)C_c_pointer_vector_or_null(a)))
-#define C_u_i_spawnvpe(m,f,a,e) C_fix(spawnvpe(C_unfix(m), C_c_string(f), (const char *const *)C_c_pointer_vector_or_null(a), (const char *const *)C_c_pointer_vector_or_null(e)))
+#define C_u_i_spawnvp(m,f,a)    C_fix(spawnvp(C_unfix(m), C_c_string(f), (char *const *)C_c_pointer_vector_or_null(a)))
+#define C_u_i_spawnvpe(m,f,a,e) C_fix(spawnvpe(C_unfix(m), C_c_string(f), (char *const *)C_c_pointer_vector_or_null(a), (char *const *)C_c_pointer_vector_or_null(e)))
 
 #define C_open(fn, fl, m)   C_fix(open(C_c_string(fn), C_unfix(fl), C_unfix(m)))
 #define C_read(fd, b, n)    C_fix(read(C_unfix(fd), C_data_pointer(b), C_unfix(n)))


;; Is this a proper fix or would this break other versions of mingw? I'm on GUIX, running
;; > x86_64-w64-mingw32-gcc --version
;; x86_64-w64-mingw32-gcc (GCC) 14.3.0

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
What is the operator to construct pairs?
Visually impaired? Let me spell it for you (wav file) download WAV