* ocamlbuild, ocamlmklib (MinGW port)
@ 2007-09-05 17:40 Dawid Toton
0 siblings, 0 replies; only message in thread
From: Dawid Toton @ 2007-09-05 17:40 UTC (permalink / raw)
To: caml-list
I use Cygwin+mingw port of OCaml 3.10.0 .
1. Trying to use ocamlbuild with plugin I get:
Failure: Cannot found "ocamlbuildlib.cmxa" in ocamlbuild -where directory.
The problem presumably lies here:
$ ocamlbuild -where
/ocamlbuildFiles\Objective Caml\lib
The path shown above doesn't make much sense. I have ocamlbuild
libraries in C:\OCaml\lib\ocamlbuild .
How can I ask ocamlbuild to change the path? Where is it stored?
I can see false path "C:\Program Files\Objective Caml\lib" hardcoded in
ocamlbuild.exe. It's probably then supplemented by "/ocamlbuid", but the
routine is not careful enough.
I've also observed that ocamlbuild has some other problems with paths.
It mixes '\' and '/' separators randomly and I suppose it's the origin
of some of my problems. I've flattened all my workspace (put all files
in one dir) and then ocamlbuild works (if no plugin present).
I might be good idea to use '/' as separator everywhere - since it's
recognized on all platforms. ocamlbuild could translate all '\' produced
by executed commands to '/' consistently.
Did anybody succeed in using plugins for ocamlbuild with mingw?
Also, found minor bug: ocamlbuild produces sanitize.sh which contains
CRLF line endings, while Cygwin/MinGW tools (bash, at least) require LF
only.
2. Some libraries (as e.g. LablGTK) are not easy for me to build by
hand, so I try to use existing configure scripts and makefiles. But they
usually require ocamlmklib, which is not available on mingw platform.
Is there any version of ocamlmklib tuned to perform its tasks on
Cygwin+mingw?
I've taken sources of ocamlmklib and deprived it of external dependecies
(in order to compile it).
It would go if only the following functions (and some constants) are
defined:
let mkdll out implib files opts =...
let mklib out files opts =...
I found in
http://stuff.mit.edu/afs/sipb/project/ocaml/src/current/config/Makefile.mingw
the following:
lte bytecc="gcc -mno-cygwin";;
let mkdll out implib files opts = Printf.sprintf "%s -shared -o %s
-Wl,--out-implib,%s %s %s" bytecc out implib files opts;;
let mklib out files opts = Printf.sprintf "rm -f %s && ar rcs %s %s %s"
out opts out files;;
If I set
supports_shared_libraries=true
it doesn't work: I'v got strange message from gcc:
+ gcc -mno-cygwin -shared -o .\dlllablgtk2.dll -Wl,--out-implib,
ml_gtktree.o ml_gtktext.o ml_gtkstock.o ml_gtkrange.o ml_gtkpack.o
ml_gtkmisc.o ml_gtkmenu.o ml_gtklist.o ml_gtkfile.o ml_gtkedit.o
ml_gtkassistant.o ml_gtkbutton.o ml_gtkbroken.o ml_gtkbin.o
ml_gtkaction.o ml_pango.o ml_gtk.o wrappers.o ml_gvaluecaml.o
ml_gpointer.o ml_gobject.o ml_glib.o ml_gdk.o ml_gdkpixbuf.o
-LC:/cygwin/lib -LC:/cygwin/lib -lgtk-win32-2.0 -lgdk-win32-2.0
-latk-1.0 -lgdk_pixbuf-2.0 -lpangowin32-1.0 -lpangocairo-1.0 -lpango-1.0
-lcairo -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl -liconv
Can't open .lib file:
ml_gtktree.o:ml_gtktree.c:(.text+0x11d): undefined reference to
`_caml_alloc_custom'
ml_gtktree.o:ml_gtktree.c:(.text+0x12e): undefined reference to
`_caml_initialize'
ml_gtktree.o:ml_gtktree.c:(.text+0x192): undefined reference to
`_caml_alloc_custom'
...........and so on.
But when I put:
supports_shared_libraries=false
it seem to work!
The make process couldn't succeess for first time, since I had to rename
lib file manually: "liblablgtk2.lib" to "lablgtk2.lib"
But generally it proves that ocamlmklib on mingw *is* possible :).
Dawid Toton
P.S. Here is the beginning of my version of ocamlmklib.ml:
(* $Id: ocamlmklib.mlp,v 1.13 2007/02/07 10:31:36 ertai Exp $ *)
open Printf
let supports_shared_libraries = false;;
let bindir = "c:/OCaml/bin";;
let bytecc = "gcc -mno-cygwin";;
let mkdll out implib files opts = Printf.sprintf "%s -shared -o %s
-Wl,--out-implib,%s %s %s" bytecc out implib files opts;;
let mklib out files opts = Printf.sprintf "rm -f %s && ar rcs %s %s %s"
out opts out files;;
let ext_dll=".dll";;
let ext_lib=".lib";;
let mksharedlibrpath="-L"(*"" seems to be empty in
http://stuff.mit.edu/afs/sipb/project/ocaml/src/current/config/Makefile.mingw*)
let byteccrpath="" ;;
let nativeccrpath="";;
...and the rest of code exactly as in
http://stuff.mit.edu/afs/sipb/project/ocaml/src/current/tools/ocamlmklib.mlp
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-09-05 17:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-05 17:40 ocamlbuild, ocamlmklib (MinGW port) Dawid Toton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox