On Sun, Jun 19, 2022 at 09:54:29PM +0800, Qian Yun wrote:
>
>
> On 6/18/22 11:35, Qian Yun wrote:
> >
> >>So, in "msys2 shell", we can build sman successfully.
> >>But when building algebra, SBCL encounters strange memory
> >>fault, which I'll look into later. And right now, sman
> >>from msys2 shell does not mix well with FriCASsys from
> >>mingw64 shell.
> >
> >The memory fault happens if FriCASsys loads "libspad.so".
> >Probably the same thing for cygwin.
> >
> >Obviously FFI works for SBCL on Windows. Now I need to
> >find out where went wrong in our build process.
>
> FFI works for SBCL on Windows, I have made GMP support work
> on Windows.
>
> The problem is sbcl will seg fault shortly after it
> "load-foreign-object" with anything that links to "mys-2.0.dll".
No wonder. sbcl is depending on catching signals and a lot
of system features. System-style C code can easily interfer
with this. For example, for some time we had trouble with Ctrl-C
handling in sbcl. It turned out that sbcl used SIGPIPE to
handle Ctrl-C and our code set handler for SIGPIPE, so
sbcl never saw it. This feature of sbcl was completely
undocumented, I solved it comparing traces of system calls
for sbcl without our code and with our code.
One could try to ask sbcl and MingW64 folks about their
system assumptions/dependencies, but I am affraid that
they will be unwilling to give any specification.
> Summary: MingW64 toolchain allows you to build native win32
> programs. Msys2 provides a minimal POSIX environment to assist
> you to do that.
>
> sman is inherent POSIX and not win32. So it is a dead end
> to try to build sman on mingw64/msys2.
I think this is too simplistic point of view. All we need in
FRICASsys is sockets or equivalent like named pipes. We need
some Posix features in sman. Note that there are various
Posix level and with eception of pty-s other things should
be available on Windows. For example, we start programs by
'spawn_of_hell'. 'spawn' is Windows function and should be
sufficient here (ATM we use 'fork' to implement 'spawn'
but we could use different implementation). Similarly
sockets are available on Windows (and we should be able
to do with named pipes). So probably the only real
trouble are pty-s. Currently we need pty-s to collect text
output from Lisp. But once our output routines are abstract
enough we will be able to redirect them to other place like
socket or named pipe. We are not far from this.
> But I am satisfied with current win32 native "FriCASsys.exe".
>
> SBCL on cygwin will probably meet same problem when it
> tries to load cygwin dll.
You could ask sbcl folks. Unless sbcl was ported to Cygwin
it is unlikely to work with it...
--
Waldek Hebisch