-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chibi-scheme on Windows with msys2's mingw-w64 fails to build #393
Comments
I could make this change but not test it, not having access to a windows machine. Could you test? Or send a patch? |
@ashinn I don't think I can fix it, that's the thing. I could test if it works on my machine by building from source if you direct me to the branch I need to pull. There's no substitution for that function on MinGW-w64 so I'm a bit stuck... |
You don't need the unistd.h or fcntl.h headers on Windows - in fact they should already be conditionally compiled out. These are only needed for the green threads, which are disabled on Windows. If they're getting included somewhere it's a recent bug and I can remove it. The only change that should be needed is the one you already proposed. |
@ashinn I'm interested in helping to get an MSYS2 build working out of the box. So far, I've made this commit, which makes There are two issues:
This is pretty weird – any ideas? Running with
|
@ashinn Let me post what happens with MinGW:
There appears to be 2 parts to this:
|
@mkeeter, thanks! I've applied your changes. -q means it can load init-7.scm fine. If you can (import (srfi 1)) the module system and path handling are working as well. From the error you get it sounds like it's trying to load a binary file as source code. I'll try to provide you with a path to trace loading. Not all C libraries are expected to work - I simply haven't had time to port everything. As a simple fix we can condition out code that doesn't currently compile on Windows. @VermillionAzure, try the changes I pushed from @mkeeter. |
@ashinn I've done an alternative build on MSYS2 instead of MSYS2 MinGW-w64. It works fine. So with POSIX emulation, Chibi will compile without much errors. However, when you remove POSIX compatibility (since MinGW-w64 will not support POSIX signals, Additionally, some additional warnings and errors are triggered. I have submitted a patch that move around two lines of macro definitions and includes an error log file for the rest of the errors. |
Yes, it's known much of the POSIX stuff won't work on Windows. These are all optional libraries - they would be nice to have, but I don't have time (or a Windows machine) to make this work. |
@ashinn agreed that those libraries are optional, and they should be turned off for MinGW-w64 (at compile-time) so that a plain |
If I change the Makefile at those line numbers to the content you see above, the build is successful, with the following command outputting the entire stdout/stderr output to
As you can see, I essentially removed all of the compiled libraries. But when I try to run it from the MSYS2 MinGW-w64 command line, I get:
I don't exactly understand this error message and why the compiled-library-less version of Chibi requires a SFRI DLL, but the core of I hope this has helped, |
Hash tables are used by equal? in (scheme base), to check for cyclic structures. You don't want to disable all compiled libs, only the ones that use posix. Definitely keep SRFIs 27, 33, 69, 95. You can move the definition of COMPILED_LIBS to Makefile.detect, conditionally defining for windows. |
Hi,
Thank You |
It seems Chibi-scheme does assume (I tried some https://github.com/okuoku/chibi-scheme/tree/win32 but it seems we have way too many things to stub-out because standard libraries depends heavily on POSIX and it depends 128bits arithmetic which is not supported on MSVC so I gave up..) |
Uh, it seems I found one: @@ -1860,10 +1860,10 @@ sexp sexp_apply_writer(sexp ctx, sexp writer, sexp obj, sexp out) {
sexp sexp_write_one (sexp ctx, sexp obj, sexp out) {
#if SEXP_USE_HUFF_SYMS
- unsigned long res;
+ sexp_uint_t res;
#endif
- unsigned long len, c;
- long i=0;
+ sexp_uint_t len, c;
+ sexp_sint_t i=0;
#if SEXP_USE_FLONUMS
double f, ftmp;
#endif It is not enough though -- it seems
|
Anyway, anyhow, finally ended up 3 series of pull-reqests #439 #438 #437 . I haven't ported Makefiles to MinGW64 environment yet as I use CMake for my purpose https://github.com/okuoku/chibi-scheme-cmake ... (I'm not sure it would worthwhile tackle with it -- even visual studio now bundles CMake..) |
@sbjaver : I think the undefined-variable-issue is caused by two problems:
Unfortunately, I have no time to seriously adopt Makefile for Win32/Win64... I guess we could borrow the same strategy with Emscripten, or, just port |
@okuoku thanks for the suggestions on this. I tried your patches, but in my awful mingw32-make environment. I also tried using your cmakelists with vs 2017 and had some issues. Would you mind giving me any tips you can on how you perform the static cmake build using visual studio? |
@sbjaver : I prepared a bit more sorted tree: https://github.com/okuoku/chibi-scheme/tree/for-issue393 I don't expect To build the branch,
I only tried with 64bit version of Git for windows SDK https://github.com/git-for-windows/build-extra/releases ( ... It seems to doesn't work on Win32. I'm investigating why. |
Thanks again @okuoku - I'll give this a try. I enabled SEXP_USE_DL (made some additional changes in gc_heap.c) to not call unavailable dlxxx functions) and was able to proceed futher. But then I eventually bumped back into needing to port filesystem to mingw. |
(Fixed 32bit build issue on okuoku@d8b2ba8 I will update pull request too. It's now compatible with VS2017's "open with visual studio")
Ah, yeah, it seems Chibi-scheme will try to autoload DLLs as a script file.. That should make sense enabling
#439 includes patch against filesystem.stub 735719d but it just stub-out APIs/fields that not exists in MSVCRT; I found procedures in |
Awesome! I'm able to build and run! Thanks! |
The flags for
__MINGW32__
and_WIN32
are not necessarily disjoint. On msys2's mingw-w64, you cannot correctly compile sincelcmpstri
will be defined twice. Therefore, one possible idea is to change that line (chibi/features.h , line 760):Finally, including the headers for
<unistd.h>
and<fcntl.h>
formain.c
does nothing. This is becausefcntl()
is not provided on Windows and withmingw-w64
.The text was updated successfully, but these errors were encountered: