Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Dawid Toton <d0@wp.pl>
To: caml-list@yquem.inria.fr
Subject: ocamlbuild, ocamlmklib (MinGW port)
Date: Wed, 05 Sep 2007 19:40:08 +0200	[thread overview]
Message-ID: <46DEE9F8.1060409@wp.pl> (raw)

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


                 reply	other threads:[~2007-09-05 17:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46DEE9F8.1060409@wp.pl \
    --to=d0@wp.pl \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox