From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.0 required=5.0 tests=AWL,SPF_FAIL autolearn=disabled version=3.1.3 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id ACDFCBC6B for ; Wed, 5 Sep 2007 19:40:46 +0200 (CEST) Received: from mx1.wp.pl (mx1.wp.pl [212.77.101.5]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l85Heh4f001364 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=FAIL) for ; Wed, 5 Sep 2007 19:40:46 +0200 Received: (wp-smtpd smtp.wp.pl 3181 invoked from network); 5 Sep 2007 19:40:27 +0200 Received: from lan.2-0.pl (HELO [91.189.18.163]) (d0@[91.189.16.22]) (envelope-sender ) by smtp.wp.pl (WP-SMTPD) with SMTP for ; 5 Sep 2007 19:40:27 +0200 X-Nat-Received: from [91.189.18.163]:2191 [ident-empty] by smtp-proxy.2-0.pl with TPROXY id 1189014026.4525 Message-ID: <46DEE9F8.1060409@wp.pl> Date: Wed, 05 Sep 2007 19:40:08 +0200 From: Dawid Toton User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: ocamlbuild, ocamlmklib (MinGW port) Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-WP-AV: skaner antywirusowy poczty Wirtualnej Polski S. A. X-WP-SPAM: NO 0U00000 X-Miltered: at concorde with ID 46DEEA1B.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocamlmklib:01 mingw:01 cygwin:01 mingw:01 ocaml:01 cmxa:01 -where:01 -where:01 lib:01 ocaml:01 lib:01 separators:01 bug:01 crlf:01 cygwin:01 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