caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Alan Schmitt <alan.schmitt@polytechnique.org>
To: David Allsopp <dra-news@metastack.com>
Cc: "'caml-list@inria.fr'" <caml-list@inria.fr>
Subject: Re: [Caml-list] Specifying a framework to link with using ocamlopt?
Date: Wed, 23 Feb 2011 17:08:01 +0100	[thread overview]
Message-ID: <5DAF4549-119D-48BB-871A-29AE03128C00@polytechnique.org> (raw)
In-Reply-To: <E51C5B015DBD1348A1D85763337FB6D9490F7E11@Remus.metastack.local>

On 23 févr. 2011, at 16:48, David Allsopp wrote:

> Yes and no. I think there's a warning missing in ocamlmklib. Essentially, you're meant to pass some C object files (the stubs) whenever you use ocamlmklib - I think that what's going on is that because there are no .o files passed, it's not compiling libGL.a and so the linking instruction included is failing. ocamlmklib probably should warn that you passed no c objects and libGL.a doesn't seem to exist either. 
> 
> That said, I think it's that you're using ocamlmklib in a weird way by compiling the stubs separately and renaming the library that's causing the problems. The -lGL is added because of the -o GL. Try passing -oc gl_stubs to your second ocamlmklib call as well or alternatively do it as one:
> 
> ocamlmklib -verbose -o GL -oc gl_stubs GL.cmx -framework OpenGL GL.cmx gl.wrap.o
> 
> but you can safely omit the -oc gl_stubs if you're happy for the stub library to be libGL.a instead. Does that work?

It seems that using the gl_stubs bit is necessary. Otherwise I get:
[:)][top] % ocamlmklib -verbose -o GL -framework OpenGL GL.cmx gl.wrap.o
+ gcc -bundle -flat_namespace -undefined suppress -o ./dllGL.so gl.wrap.o -L/Users/schmitta/godi/lib -framework OpenGL   
+ ar rc ./libGL.a  gl.wrap.o; ranlib ./libGL.a
+ /Users/schmitta/godi/bin/ocamlopt -a -o GL.cmxa  GL.cmx -cclib -lGL -ccopt -L/Users/schmitta/godi/lib -ccopt -framework -ccopt OpenGL   

where the -lGL is still there.

With you other command line (removing the duplicated instance of "GL.cmx"), it works much better:

[:)][top] % ocamlmklib -verbose -o GL -oc gl_stubs GL.cmx -framework OpenGL gl.wrap.o
+ gcc -bundle -flat_namespace -undefined suppress -o ./dllgl_stubs.so gl.wrap.o -L/Users/schmitta/godi/lib -framework OpenGL   
+ ar rc ./libgl_stubs.a  gl.wrap.o; ranlib ./libgl_stubs.a
+ /Users/schmitta/godi/bin/ocamlopt -a -o GL.cmxa  GL.cmx -cclib -lgl_stubs -ccopt -L/Users/schmitta/godi/lib -ccopt -framework -ccopt OpenGL   

Applying the same recipe to the other libraries solved the issue. Thanks a bunch!

Alan

  reply	other threads:[~2011-02-23 16:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-23 13:10 Alan Schmitt
2011-02-23 13:33 ` Daniel Bünzli
2011-02-23 13:40   ` Daniel Bünzli
2011-02-23 14:12   ` Alan Schmitt
2011-02-23 13:59 ` David Allsopp
2011-02-23 14:21   ` Alan Schmitt
2011-02-23 14:19     ` David Allsopp
2011-02-23 15:21       ` Alan Schmitt
2011-02-23 15:48         ` David Allsopp
2011-02-23 16:08           ` Alan Schmitt [this message]
2011-02-23 16:08             ` David Allsopp

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=5DAF4549-119D-48BB-871A-29AE03128C00@polytechnique.org \
    --to=alan.schmitt@polytechnique.org \
    --cc=caml-list@inria.fr \
    --cc=dra-news@metastack.com \
    /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).