Re: MinGW compilation on Windows and proposed improvements

Anoq of the Sun <[email protected]>
Newsgroups gmane.comp.lang.ml.mlton.user
Organization Hardcore Processing
Message-ID <[email protected]>
Matthew Fluet wrote:
> The 'all-no-docs' target of the top-level Makefile should build all
> the binaries, while not building any of the documentation.

Thanks, it works! Now, however, it's the installation (see below)...

> Another user identified the issue:
>   https://github.com/MLton/mlton/issues/40
> Looks like a simple fix, but I didn't have access to a Windows/MinGW
> machine to check.

I tried this and indeed, just adding the #define MLTON_UTIL line
made everything compile just fine.

I have tried installing the built binaries, as I typically do
on Linux, i.e.: make install, then go to the install directory
and sudo copy -R usr/* /usr/
but it complains about missing files under /mingw/, so
I tried copying to /mingw/ in addition to /usr/ but it still
complained that it is not able to run MLton and that a
lib variable must be set. It seems that the installation
for MinGW is thus different and I haven't found any
description of this. Any hints? :-)

> I've never heard of this issue.  'run.x86-linux' is the name of the
> actual SML/NJ executable; if you need to kill such a process, then it
> looks like you are attempting to bootstrap MLton via SML/NJ.  This
> isn't recommended.  Also, are you certain that the call hangs forever?
>  A SML/NJ-built MLton is quite a bit slower than a MLton-built MLton,
> especially in the front-end (scanning, parsing, type checking), which
> is required for the build-constants.

I have SML/NJ version 110.0.7 on the machines where this
problem occurs, so I don't know if it uses that for
bootstrapping merely due to its presence on the system?

I haven't tried waiting forever, of course, but I literally
left it a few hours a couple of times and the file tmp.c
that it pipes into is empty (size 0) and I really have to
use kill -9 (not just CTRL+C) to kill it, so I'm convinced
that it wouldn't ever get any further :-)

> Posix.Process.kill should raise a SysErr exception, based on the errno
> value when kill returns ~1.

I looked into this again and verified that yes, indeed it
raises an exception when kill returns -1. It seems that
I had a bad assumption for my previous statement that
kill returned -1. It didn't, it returned 0. Why?
Well, it seems that when I remove the call to
waitpid_nh, the return value from the kill calls keep
being 0 (also in C in the file runtime/basis/posix/process/kill.c,
which I verified it with a printf call), but they are actually
-1 after waitpid_nh having returned -1 at least once
(with the patch from the previous mail of removing
the call to reap in the function MLton.Process.kill).
Hence, it is not enough to just repeatedly call kill
until it raises an exception in order to check when
a child process has been killed. I can also verify this
behaviour in a small plain C program (my "killer app"
in C that is not possible to write with MLton without
the suggested patches ;-) ), so this is apparently
Linux' POSIX behaviour.


> Seems quite reasonable to be able to get the pid of a
> MLton.Process.create-ed process.

Yes, though my only possible concern would be that
the processes created by MLton.Process are then
forced to be equivalent to the processes of
Posix.Process. This seems to be the case for
MinGW, since e.g. Posix.Process.kill for MinGW
is implemented with TerminateProcess, as is
MLton.Process.kill (so maybe e.g. the special-casing
of kill into killForFork and killForCreate in
basis-library/mlton/process.sml is not even necessary?).

I will try to make the patches for waitpid_nh and chmod.


Cheers,
Johnny Andersen
-- 
http://www.cex3d.net/inverse/ - 3D models from images automatically
http://www.hardcoreprocessing.com
http://www.anoq.net/music/ - creative instrumental electronic music

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.