* [Caml-list] Initial port of ocaml for mingw (long)
@ 2001-09-24 23:40 art
2001-09-25 8:59 ` [Caml-list] format types Anton Moscal
2001-10-17 19:07 ` [Caml-list] Ocaml 3.03 alpha MinGW port Dmitry Bely
0 siblings, 2 replies; 10+ messages in thread
From: art @ 2001-09-24 23:40 UTC (permalink / raw)
To: caml-list
Using code from the cvsnt project (just one function really), I was
able to make an ocaml that does not depend on cygwin1.dll for windows.
The bad news is that currently, it still depends on gcc -mno-cygwin,
sh and make to build programs, etc. The good news is that it can
produce programs that don't depend on cygwin1.dll as well (from ocamlc
or ocamlopt). I have tested programs made with both ocamlc and
ocamlopt, and used objdump to verify that they only depend on the
microsoft C runtime.
File needed here:
http://lcc-java.sourceforge.net/ocaml-boot-mingw.tgz
(New boot directory)
http://lcc-java.sourceforge.net/ocaml-mingw-diffs
(patch file for ocaml-3.02 distribution for MinGW.
Assumptions:
(You *must* have the CAMLLIB env variable set to a dos path
containing your caml libraries. You have to have libcamlrun.a
in this directory in order for things to work. You may wish
to premake this directory and copy files as necessary)
Building:
With the files ocaml-3.02.tar.gz, ocaml-mingw-diffs and
ocaml-boot-mingw.tgz in a directory, do the following:
(sorry for breaking the build process)
gzip -d < ocaml-3.02.tar.gz | tar xvf -
cd ocaml-3.02
patch -p 0 < ../ocaml-mingw-diffs
gzip -d < ../ocaml-boot-mingw.tgz | tar xvf -
make
: The build breaks here (access.c) ... builds ok next time
make
: Need some pre-built cmis... not sure why
make otherlibs/num/int_misc.cmi \
otherlibs/num/string_misc.cmi \
otherlibs/num/arith_flags.cmi
make
: Everything except ocamlopt.exe and family made so far
rm byterun/io.h
make -C asmrun depend
make -C byterun depend
: byterun/io.h is replaced by byterun/_io.h due to a name conflict.
make opt
: Everything made
make install
make installopt
: Installed
Hopefully, this is a step in the right direction for a MinGW port.
In any case, it relives the user of ocaml toplevel environments
from having to have cygwin, in addition to allowing one to create
executables that are free from cygwin.
To complete the cycle, someone who is a bit better with mingw than
I will have to change the compile line in bytelink.ml and asmlink.ml
to reflect mingw, and do new makefiles (perhaps Dmitry will help with
this?)
Art
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Caml-list] format types
2001-09-24 23:40 [Caml-list] Initial port of ocaml for mingw (long) art
@ 2001-09-25 8:59 ` Anton Moscal
2001-09-27 0:35 ` Jacques Garrigue
2001-10-17 19:07 ` [Caml-list] Ocaml 3.03 alpha MinGW port Dmitry Bely
1 sibling, 1 reply; 10+ messages in thread
From: Anton Moscal @ 2001-09-25 8:59 UTC (permalink / raw)
To: caml
Hello!
why
let _ = List.map printf (["abc\n"; "def\n"]:('a,'b,'c) format list)
work properly, but:
let _ = List.map printf ["abc\n"; "def\n"]
doesn't compiled with message
This expression has type ('a, out_channel, unit) format -> 'a
but is here used with type string -> 'b
I know, O'Caml format type is a hack, but I can't undertand difference
between thees two expressions for the type inference algorighm.
Regards,
Anton Moscal
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Caml-list] format types
2001-09-25 8:59 ` [Caml-list] format types Anton Moscal
@ 2001-09-27 0:35 ` Jacques Garrigue
0 siblings, 0 replies; 10+ messages in thread
From: Jacques Garrigue @ 2001-09-27 0:35 UTC (permalink / raw)
To: msk; +Cc: caml-list
> why
>
> let _ = List.map printf (["abc\n"; "def\n"]:('a,'b,'c) format list)
>
> work properly, but:
>
> let _ = List.map printf ["abc\n"; "def\n"]
>
> doesn't compiled with message
>
> This expression has type ('a, out_channel, unit) format -> 'a
> but is here used with type string -> 'b
>
> I know, O'Caml format type is a hack, but I can't undertand difference
> between thees two expressions for the type inference algorighm.
You have the answer: this is a hack, and there are no guarantees
anything will type (or have the expected side-effects) if you do not
follow the documentation.
If you understand how the hack works, then you can write the
following (which does not seem very useful):
# let map_printf l = List.map Printf.printf l;;
val map_printf : ('a, out_channel, unit) format list -> 'a list = <fun>
# map_printf ["abc"; "def"];;
abcdef- : unit list = [(); ()]
Jacques Garrigue
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Caml-list] Ocaml 3.03 alpha MinGW port
2001-09-24 23:40 [Caml-list] Initial port of ocaml for mingw (long) art
2001-09-25 8:59 ` [Caml-list] format types Anton Moscal
@ 2001-10-17 19:07 ` Dmitry Bely
2001-10-22 1:46 ` Masakazu Fukuzawa
1 sibling, 1 reply; 10+ messages in thread
From: Dmitry Bely @ 2001-10-17 19:07 UTC (permalink / raw)
To: caml-list
[-- Attachment #1: Type: text/plain, Size: 1301 bytes --]
OK, seems that I've almost completed the native Win32 MinGW port that uses
the same ./configure script and Unix Makefiles (of course updated to
support mingw32 target), so keepeng it in sync should not became the
nigntmare as with MSVC/Mac/... non-unix systems. If it works, maybe to add
it to the stock distribution after some testing? :-)
A special care was taken to not break any existing configuration (no
Gnu make conditional operators etc.), so after applying the patch OCaml
*should* configure and compile on all hosts that were supported before (if
I ocasionally did not break something).
The port supports the same set of libraries as the MSVC one. Both bytecode
and native modes seem to work properly.
Problems
--------
1. Profiling mode (gprof) does not work under MinGW (neither it does under
Cygwin port) - I can enable it in ./configure script, but asmrun/i386.S
does not compile when.
2. I have no idea how to integrate the DLL support. I used Cygwin port as a
template, but it also seems to lack it, although Cygwin/Mingw gcc can build
Win32 DLLs without a problem.
How to use it
-------------
1. Make sure you have the latest Cygwin tools from
http://sources.redhat.com/cygwin. "MinGW runtime" and "w32api" packages are
required.
2. Apply the patch attached to this message.
[-- Attachment #2: diff.bz2 --]
[-- Type: application/octet-stream, Size: 9093 bytes --]
[-- Attachment #3: Type: text/plain, Size: 622 bytes --]
3. Configure OCaml with
bash -c "./configure -cc 'gcc -mno-cygwin' -host 'i586-pc-mingw32' \
-tkdefs '-Ic:/Tcl/include' -tklibs '-Lc:/Tcl/lib'"
Of course paths to tcl/tk may vary. You will also need to create import
libraries from tcl/tk DLLs using impdef/dlltool from the Cygwin
distribution.
If you do not need working labltk, simply omit -tkdefs/-tklibs above.
4. Build and install ocaml as usual:
make world
make opt
make install
It *should* work. At least I was able to rebuld ocaml itself (make bootstrap)
and get working labltk tools (ocamlbrowser etc.)
Hope to hear from you soon,
Dmitry
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Caml-list] Ocaml 3.03 alpha MinGW port
2001-10-17 19:07 ` [Caml-list] Ocaml 3.03 alpha MinGW port Dmitry Bely
@ 2001-10-22 1:46 ` Masakazu Fukuzawa
2001-10-22 14:56 ` Dmitry Bely
0 siblings, 1 reply; 10+ messages in thread
From: Masakazu Fukuzawa @ 2001-10-22 1:46 UTC (permalink / raw)
To: caml-list
After applying the patch, in ocaml-3.03-alpha\asmcomp\i386\emit.mlp,
add '| "mingw32"' to
let emit_align =
match Config.system with
"linux_elf" | "bsd_elf" | "solaris" | "beos" | "cygwin" ->
to read
let emit_align =
match Config.system with
"linux_elf" | "bsd_elf" | "solaris" | "beos" | "cygwin" | "mingw32"
->
and in ocaml-3.03-alpha\asmrun\i386.S, add '|| defined(SYS_mingw32)' to
|| defined(SYS_solaris) || defined(SYS_beos) || defined(SYS_cygwin)
to read
|| defined(SYS_solaris) || defined(SYS_beos) || defined(SYS_cygwin) |
| defined(SYS_mingw32)
Now you can successfully make opt.opt and use ocamlopt.opt.
Thanks, Dmitry!!
Fukuzawa
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Caml-list] Ocaml 3.03 alpha MinGW port
2001-10-22 1:46 ` Masakazu Fukuzawa
@ 2001-10-22 14:56 ` Dmitry Bely
2001-10-22 16:18 ` Masakazu Fukuzawa
0 siblings, 1 reply; 10+ messages in thread
From: Dmitry Bely @ 2001-10-22 14:56 UTC (permalink / raw)
To: caml-list
Masakazu Fukuzawa <fukuzawa@cool.email.ne.jp> writes:
> After applying the patch, in ocaml-3.03-alpha\asmcomp\i386\emit.mlp,
> add '| "mingw32"' to
[...]
> Now you can successfully make opt.opt and use ocamlopt.opt.
Oh, sorry. Didn't checked that.
> Thanks, Dmitry!!
>
> Fukuzawa
You are welcome :-) Everything else works?
Hope to hear from you soon,
Dmitry
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Caml-list] Ocaml 3.03 alpha MinGW port
2001-10-22 14:56 ` Dmitry Bely
@ 2001-10-22 16:18 ` Masakazu Fukuzawa
0 siblings, 0 replies; 10+ messages in thread
From: Masakazu Fukuzawa @ 2001-10-22 16:18 UTC (permalink / raw)
To: caml-list
>
>You are welcome :-) Everything else works?
>
Maybe OK, and I hope so. (You can download
http://caml.inria.fr/Examples/oc/basics/sieve.ml,
ocamlopt it, and sucessfully run 'sieve 50000',
which previously failed.)
I wish your MinGW port to be incorporated into
Ocaml 3.03 or above \^_^/
Fukuzawa
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Caml-list] Initial port of ocaml for mingw (long)
@ 2001-09-26 13:06 CaptnJamesKirk
0 siblings, 0 replies; 10+ messages in thread
From: CaptnJamesKirk @ 2001-09-26 13:06 UTC (permalink / raw)
To: ayerkes; +Cc: caml-list
In a message dated 9/25/2001 3:29:34 PM Central Daylight Time,
ayerkes@gmvnetwork.com writes:
> Actually, my thought was to build with cygwin itself at least in the
> short term. The important thing (to me) is the ability to write nice
> software and distribute it without the cygwin dll. It's a bonus too
> that ocaml.exe works properly without it too, but the main thing was
> the ability to run ocamlopt and get an exe out that you can pass
> around easily. I built with cygwin's gcc (-mno-cygwin), tho. I think
> that it may not be realistic to build ocaml otherwise given that it
> uses unix tools to create the prims list, however it can easily be
> used without cygwin.
>
> I should've made it more clear that you need cygwin gcc as yet to build.
> The important point was that it's possible to get it away from
> dependence on cygwin1.dll...
After I fired off my last message, I started to wonder if that's what you
did, so I tried it myself under cygwin. Copying libncurses.a to libpdcurses.a
still works (though this may need to be changed to use the regular ncurses
which is part of the standard cygwin distro). I ran into some other problems,
and here's what happened.
(first untarring the ocaml source, then patching, then untarring the boot
stuff...)
1) make
First break is at utils/misc.mli, where it says cannot open pervasives.cmi.
The only thing that worked for me here was to...
2) make world
which exits shortly with a cryptic (at least for me) error at [coldstart],
but then
3) make
seems to be happy until it gets to bigarray. It needs bigarray.cmi but
doesn't have it since it doesn't have big_int.cmi. Making the 3 cmis you
mention in otherlibs/num (int_misc.cmi, string_misc.cmi, and arith_flags.cmi)
may be the first step, but it doesn't fix it. The only way I could build
big_int.cmi was to cd to "otherlibs/num" and type "make big_int.cmi" there,
after building nat.cmi as well. Two more tries indicated that "ratio.cmi"
and "num.cmi" also have to be built in the "otherlibs/num" directory. THEN,
we have to cd to "otherlibs/bigarray" and do "make bigarray.cmi" there. Then,
4) make
goes all the way to ocamldebugger where it exits with "Uncaught exception:
Not_found." I can't figure out how to fix it, so I do your next steps of "rm
byterun/io.h", "make -C asmrun depend", and "make -C byterun depend". These
last two have many warnings, most of which seem tied to redefinitions in
fail.h.
5) make opt
then says I need arith_status.cmi in otherlibs/num, but once that's built it
finishes without further error.
However, after doing "make install" and "make installopt" and trying to run
ocaml.exe, I get "Cannot exec /usr/local/ocamlrun". In fact, all of the
executables return that error.
And now I don't know how to fix that...
Oh, and as long as we're working on it, it would be VERY nice if we could get
labltk to build as well.
/John
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Caml-list] Initial port of ocaml for mingw (long)
@ 2001-09-25 20:24 art
0 siblings, 0 replies; 10+ messages in thread
From: art @ 2001-09-25 20:24 UTC (permalink / raw)
To: caml-list
CaptnJamesKirk@aol.com said:
> I could not get it to build completely, see the notes below. Due to the
> number of cygwin tools needed, this will probably have to be a binary
> distribution to use with mingw, not a source distribution to build with
mingw.
>
Actually, my thought was to build with cygwin itself at least in the
short term. The important thing (to me) is the ability to write nice
software and distribute it without the cygwin dll. It's a bonus too
that ocaml.exe works properly without it too, but the main thing was
the ability to run ocamlopt and get an exe out that you can pass
around easily. I built with cygwin's gcc (-mno-cygwin), tho. I think
that it may not be realistic to build ocaml otherwise given that it
uses unix tools to create the prims list, however it can easily be
used without cygwin.
I should've made it more clear that you need cygwin gcc as yet to build.
The important point was that it's possible to get it away from
dependence
on cygwin1.dll...
> In a message dated 9/24/2001 6:47:33 PM Central Daylight Time,
> ayerkes@gmvnetwork.com writes:
> > Assumptions:
> > (You *must* have the CAMLLIB env variable set to a dos path
> > containing your caml libraries. You have to have libcamlrun.a
> > in this directory in order for things to work. You may wish
> > to premake this directory and copy files as necessary)
>
> Ok, I did this. I was able to build through libcamlrun.a (see below), and I
> copied it to the appropriate directory, but not much else worked.
>
Good to know it got that far with the mingw compiler by itself.
> >
> > Building:
> >
> > With the files ocaml-3.02.tar.gz, ocaml-mingw-diffs and
> > ocaml-boot-mingw.tgz in a directory, do the following:
> > (sorry for breaking the build process)
> >
> > gzip -d < ocaml-3.02.tar.gz | tar xvf -
>
> Or just "tar zxvf ocaml-3.02.tar.gz".
>
> gzip and tar are part of the cygwin distro. I created a separate bin
> directory, put it in my path, and copied several things from cygwin to it.
> These included cygwin1.dll (of course), make (for some reason the make that
> comes with mingw has problems), tar, gzip & gunzip, ar, awk & gawk, bash
> (renamed to sh), patch, and lots of text-utils and file-utils. The main
> cygwin bin directory was not in my path, so that only the mingw gcc, as
> (assembler), and libraries were used. I can make a complete list of the
tools
> needed from cygwin, if I can get it all to work.
>
Hmm...
>
> > cd ocaml-3.02
> > patch -p 0 < ../ocaml-mingw-diffs
> > gzip -d < ../ocaml-boot-mingw.tgz | tar xvf -
> > make
> > : The build breaks here (access.c) ... builds ok next time
>
> Umm, not for me. Actually the first break involved building libcamlrun.a,
> when the linker couldn't find libpdcurses.a (which isn't part of mingw). In
> fact, pdcurses isn't part of my cygwin distro either, but I copied the
> regular ncurses library file to the mingw lib directory and renamed it
> libpdcurses.a and that seemed to work. The next break was nowhere near
> access.c, and had to do with finding pervasives.cmi. I tried "make world"
> instead of just "make" and it built through pervasives.cmi but stopped at
> bytecode/emitcode.ml with the error "Unbound value opEQ".
>
Sorry, I should've mentioned that I used a small public domain curses
that
was different from the mingw one. I meant to change that back but
didn't.
(sorry)
> I tried several different things, but could never get it beyond this point.
> ocamlrun.exe, libocamlrun.a and ocamlyacc.exe were built, but nothing else.
>
> >
> > Hopefully, this is a step in the right direction for a MinGW port.
> > In any case, it relives the user of ocaml toplevel environments
> > from having to have cygwin, in addition to allowing one to create
> > executables that are free from cygwin.
> >
> > To complete the cycle, someone who is a bit better with mingw than
> > I will have to change the compile line in bytelink.ml and asmlink.ml
> > to reflect mingw,
>
> I don't think this part will be necessary, since the mingw compiler and
> assembler are gcc and as, just like cygwin, but I'm not completely sure.
>
It at least needs a little I'm sure... Even if just to get rid of the
-mno-cygwin part.
> /John
> -------------------
> Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ:
http://caml.inria.fr/FAQ/
> To unsubscribe, mail caml-list-request@inria.fr Archives:
http://caml.inria.fr
>
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Caml-list] Initial port of ocaml for mingw (long)
@ 2001-09-25 19:34 CaptnJamesKirk
0 siblings, 0 replies; 10+ messages in thread
From: CaptnJamesKirk @ 2001-09-25 19:34 UTC (permalink / raw)
To: ayerkes; +Cc: caml-list
I could not get it to build completely, see the notes below. Due to the
number of cygwin tools needed, this will probably have to be a binary
distribution to use with mingw, not a source distribution to build with mingw.
In a message dated 9/24/2001 6:47:33 PM Central Daylight Time,
ayerkes@gmvnetwork.com writes:
> Assumptions:
> (You *must* have the CAMLLIB env variable set to a dos path
> containing your caml libraries. You have to have libcamlrun.a
> in this directory in order for things to work. You may wish
> to premake this directory and copy files as necessary)
Ok, I did this. I was able to build through libcamlrun.a (see below), and I
copied it to the appropriate directory, but not much else worked.
>
> Building:
>
> With the files ocaml-3.02.tar.gz, ocaml-mingw-diffs and
> ocaml-boot-mingw.tgz in a directory, do the following:
> (sorry for breaking the build process)
>
> gzip -d < ocaml-3.02.tar.gz | tar xvf -
Or just "tar zxvf ocaml-3.02.tar.gz".
gzip and tar are part of the cygwin distro. I created a separate bin
directory, put it in my path, and copied several things from cygwin to it.
These included cygwin1.dll (of course), make (for some reason the make that
comes with mingw has problems), tar, gzip & gunzip, ar, awk & gawk, bash
(renamed to sh), patch, and lots of text-utils and file-utils. The main
cygwin bin directory was not in my path, so that only the mingw gcc, as
(assembler), and libraries were used. I can make a complete list of the tools
needed from cygwin, if I can get it all to work.
> cd ocaml-3.02
> patch -p 0 < ../ocaml-mingw-diffs
> gzip -d < ../ocaml-boot-mingw.tgz | tar xvf -
> make
> : The build breaks here (access.c) ... builds ok next time
Umm, not for me. Actually the first break involved building libcamlrun.a,
when the linker couldn't find libpdcurses.a (which isn't part of mingw). In
fact, pdcurses isn't part of my cygwin distro either, but I copied the
regular ncurses library file to the mingw lib directory and renamed it
libpdcurses.a and that seemed to work. The next break was nowhere near
access.c, and had to do with finding pervasives.cmi. I tried "make world"
instead of just "make" and it built through pervasives.cmi but stopped at
bytecode/emitcode.ml with the error "Unbound value opEQ".
I tried several different things, but could never get it beyond this point.
ocamlrun.exe, libocamlrun.a and ocamlyacc.exe were built, but nothing else.
>
> Hopefully, this is a step in the right direction for a MinGW port.
> In any case, it relives the user of ocaml toplevel environments
> from having to have cygwin, in addition to allowing one to create
> executables that are free from cygwin.
>
> To complete the cycle, someone who is a bit better with mingw than
> I will have to change the compile line in bytelink.ml and asmlink.ml
> to reflect mingw,
I don't think this part will be necessary, since the mingw compiler and
assembler are gcc and as, just like cygwin, but I'm not completely sure.
/John
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2001-10-23 8:39 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-24 23:40 [Caml-list] Initial port of ocaml for mingw (long) art
2001-09-25 8:59 ` [Caml-list] format types Anton Moscal
2001-09-27 0:35 ` Jacques Garrigue
2001-10-17 19:07 ` [Caml-list] Ocaml 3.03 alpha MinGW port Dmitry Bely
2001-10-22 1:46 ` Masakazu Fukuzawa
2001-10-22 14:56 ` Dmitry Bely
2001-10-22 16:18 ` Masakazu Fukuzawa
2001-09-25 19:34 [Caml-list] Initial port of ocaml for mingw (long) CaptnJamesKirk
2001-09-25 20:24 art
2001-09-26 13:06 CaptnJamesKirk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox