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 15:48:29 +0000 [thread overview]
Message-ID: <E51C5B015DBD1348A1D85763337FB6D9490F7E11@Remus.metastack.local> (raw)
In-Reply-To: <455E8751-BA9F-47E5-8BAA-ABABE145822A@polytechnique.org>
Alan Schmitt wrote:
> > On 23 févr. 2011, at 15:19, David Allsopp wrote:
> > It certainly is an invaluable platform debugging aid!
> > ocamlmklib also supports it - perhaps using it with
> > the command which generates the library may help further?
>
> Duh, I should have thought of this!
>
> The problem does not seem to come from gl_stubs:
>
> [:)][top] % ocamlmklib -verbose -oc gl_stubs gl.wrap.o
> -framework OpenGL
> + gcc -bundle -flat_namespace -undefined suppress -read_only_relocs
> suppress -o ./dllgl_stubs.so gl.wrap.o -L/Users/schmitta/godi/lib
> -framework OpenGL
> ld: warning: -read_only_relocs cannot be used with x86_64
> + ar rc ./libgl_stubs.a gl.wrap.o; ranlib ./libgl_stubs.a
> but from GL.cmxa:
> [:)][top] % ocamlmklib -verbose -o GL GL.cmx -framework OpenGL
> -lgl_stubs
> + /Users/schmitta/godi/bin/ocamlopt -a -o GL.cmxa GL.cmx -cclib
> -lGL -ccopt
> -L/Users/schmitta/godi/lib -ccopt -framework -ccopt OpenGL -cclib
> -lgl_stubs
>
> I don't understand why ocamlmklib adds the "-lGL" here. (It does the same thing with the Glut archive.)
>
> Is this a bug?
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?
David
next prev parent reply other threads:[~2011-02-23 15:53 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 [this message]
2011-02-23 16:08 ` Alan Schmitt
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=E51C5B015DBD1348A1D85763337FB6D9490F7E11@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