caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "David Allsopp" <dra-news@metastack.com>
To: "OCaml List" <caml-list@yquem.inria.fr>
Subject: ocamlopt problem
Date: Fri, 2 Jun 2006 21:58:13 +0100	[thread overview]
Message-ID: <001601c68687$43df6a60$6a7ba8c0@treble> (raw)

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


             reply	other threads:[~2006-06-02 21:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-02 20:58 David Allsopp [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-10-06  6:55 Rasool Karimi
2005-10-06  7:07 ` Rasool Karimi

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='001601c68687$43df6a60$6a7ba8c0@treble' \
    --to=dra-news@metastack.com \
    --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;
as well as URLs for NNTP newsgroup(s).