From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id BAC33BB84 for ; Fri, 2 Jun 2006 23:07:53 +0200 (CEST) Received: from orion.metastack.com (no-dns-yet.demon.co.uk [80.177.38.218] (may be forged)) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k52L7qec023733 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Fri, 2 Jun 2006 23:07:53 +0200 Received: from treble (cpc1-cmbg6-0-0-cust230.cmbg.cable.ntl.com [81.101.136.231]) (authenticated bits=0) by orion.metastack.com (8.13.4/8.13.3) with ESMTP id k52KnGKf015954 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Fri, 2 Jun 2006 21:49:17 +0100 From: "David Allsopp" To: "OCaml List" Subject: ocamlopt problem Date: Fri, 2 Jun 2006 21:58:13 +0100 Organization: MetaStack Solutions Ltd. Message-ID: <001601c68687$43df6a60$6a7ba8c0@treble> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 Thread-Index: AcaGh0M/wTVDBWn0RjW4cIBCvegoxQ== X-Miltered: at nez-perce with ID 4480A8A8.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; ocamlopt:01 ocamlodbc:01 cygwin:01 mingw:01 ocamlopt:01 mingw:01 gcc:01 -mno-cygwin:01 ocamllib:01 usr:01 api:01 ocaml:01 gcc:01 -mno-cygwin:01 -shared:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.3 I'm trying to build the ocamlodbc package under Windows using Cygwin/MinGW. It's all built and working except that I'm having one problem with the native library. My question, I think, relates to a misunderstanding with ocamlopt so I'm hoping someone can point out my error! I've adapted the INSTALL_mingw.sh script to issue the following commands: $ gcc -mno-cygwin -c -DODBC2 -DWIN32 -I $OCAMLLIB/caml -I /usr/include/w32api ocaml_odbc_c.c $ gcc -mno-cygwin -shared -L $OCAMLLIB -L $OCAMLLIB/../bin -o dllocamlodbc.dll ocaml_odbc_c.o -lodbc32 -locamlrun $ ocamlopt -a -o ocamlodbc.cmxa ocaml_odbc_c.o ocaml_odbc.ml ocamlodbc.mli ocamlodbc.ml -cclib -lodbc32 $ cp ocamlodbc.cmxa ocamlodbc.a ocamlodbc.cmi $OCAMLLIB $ ocamlc -a -o ocamlodbc.cma ocaml_odbc.ml ocamlodbc.mli ocamlodbc.ml -dllib -locamlodbc $ cp ocamlodbc.cmi ocamlodbc.cma $OCAMLLIB $ cp dllocamlodbc.dll $OCAMLLIB/stublibs The top-level library ocamlodbc.cma is working exactly as I'd expect. I then attempt to compile a program that uses the native library (in this case Exemples/monitor.ml) with the command ocamlopt -o monitor.exe ocamlodbc.cmxa monitor.ml but get the response gcc: ocaml_odbc_c.o: No such file or directory Error during linking Despite trying various -ccopt flags, the only way I can make it compile is to copy ocaml_odbc_c.o to the current directory. My understanding is that the ocamlopt statement that built ocamlodbc.cmxa should have included ocaml_odbc_c.o so why is gcc getting a linker problem when referencing the library? Sorry if it's a blindingly obvious mistake... David