From: David Allsopp <dra-news@metastack.com>
To: "'Alan Schmitt'" <alan.schmitt@polytechnique.org>
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 16:08:13 +0000 [thread overview]
Message-ID: <E51C5B015DBD1348A1D85763337FB6D9490F804B@Remus.metastack.local> (raw)
In-Reply-To: <5DAF4549-119D-48BB-871A-29AE03128C00@polytechnique.org>
Alan Schmitt wrote:
> 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.
No - it's now correct that the -lGL is there now. You should also have libGL.a as a result of that command - note those extra calls to ar and ranlib which I don't think you were getting before. Of course, if you want it to be called libgl_stubs.a then that's another matter but the library GL.cmxa built from this command should work (where you previous one did not).
> With you other command line (removing the duplicated instance of
> "GL.cmx"),
Oops!
> 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!
No probs.
David
prev parent reply other threads:[~2011-02-23 16:13 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
2011-02-23 16:08 ` David Allsopp [this message]
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=E51C5B015DBD1348A1D85763337FB6D9490F804B@Remus.metastack.local \
--to=dra-news@metastack.com \
--cc=alan.schmitt@polytechnique.org \
--cc=caml-list@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