Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Alan Schmitt" <alan.schmitt@polytechnique.org>
To: caml-list@inria.fr
Subject: Re: [Caml-list] ocamlmklib OSX/OpenGL weirdness
Date: Fri, 13 Jan 2012 21:48:49 +0100	[thread overview]
Message-ID: <4758C5C2-5444-4C24-99CB-7AD010D06C6E@polytechnique.org> (raw)
In-Reply-To: <A3392D38-35EB-47B8-9212-9FFE8AAA536F@philou.ch>

[-- Attachment #1: Type: text/plain, Size: 1278 bytes --]

On 13 Jan 2012, at 20:41, Philippe Strauss wrote:

> I'm running 3.12.1 plus Jérémie Dimino gprint patch, and an up to 
> date godi setup.
> Trying to build Florent Monnier glMlite, I'm finding this singularity:
>
> ocamlopt.opt -verbose -g -c GL.ml
> 	+ as -arch x86_64 -o 'GL.o' 
> '/var/folders/Yj/YjSPq8kWEbucqe1B6qhw4E+++TI/-Tmp-/camlasm11ff8f.s'
>
> ocamlmklib -verbose  -o  GL  GL.cmx  -framework OpenGL -lgl_stubs
> 	+ /opt/godi312/bin/ocamlopt -a -o GL.cmxa  GL.cmx -cclib -lGL -ccopt 
> -L/opt/godi312/lib -ccopt -framework -ccopt OpenGL -cclib -lgl_stubs
>
> it seems (or I missed something) that ocamlmklib add -lGL when it 
> invokes ocamlopt, it should not on OSX, which requires "-framework 
> OpenGL".
>
> BTW, the two -ccopt -framework -ccopt OpenGL is a trickery for 
> whitespace containing linker arguments ?

Yes.

About the main question, I asked this a while back. This thread should 
explain what is going on.
https://sympa-roc.inria.fr/wws/arc/caml-list/2011-02/msg00144.html

This lead me to write a small patch to glMlite, which I attach. As this 
patch is OS X specific (the current build system is targeted for Linux), 
it has not been incorporated upstream. I have not have found the time to 
do a "universal" patch yet.

Hope this helps,

Alan


[-- Attachment #2: patch_commit_2737d71a16b7.patch --]
[-- Type: text/plain, Size: 1762 bytes --]

diff --git a/SRC/Makefile b/SRC/Makefile
index 010f77661bfe37767259cb3f64e2262a678de457..cf06e20b7d97dfe2e1073adaf63509b393f87b22 100644
--- a/SRC/Makefile
+++ b/SRC/Makefile
@@ -184,8 +184,8 @@ dllgl_stubs.so libgl_stubs.a: gl.wrap.o
 	$(OCAMLMKLIB)  -oc  gl_stubs  $<  $(GL_LIBS)
 endif
 
-GL.cmxa GL.a:  GL.cmx  dllgl_stubs.so
-	$(OCAMLMKLIB)  -o  GL  $<  $(GL_LIBS) -lgl_stubs
+GL.cmxa GL.a:  GL.cmx
+	$(OCAMLMKLIB)  -o  GL -oc gl_stubs  $^  $(GL_LIBS)
 
 GL.cma:  GL.cmo  dllgl_stubs.so
 	$(OCAMLC) -a -o $@ -ccopt "$(GL_LIBS)" -dllib -lgl_stubs $<
@@ -229,8 +229,11 @@ glu.wrap.o: glu.wrap.c  $(C_GLU_INCS)
 dllGlu.so libGlu.a: glu.wrap.o
 	$(OCAMLMKLIB) -o Glu  $<  $(GLU_LIBS)
 
-Glu.cmxa Glu.a:  Glu.cmx  dllGlu.so
-	$(OCAMLMKLIB) -o Glu  $<  $(GLU_LIBS)
+libglu_stubs.a: glu.wrap.o
+	$(OCAMLMKLIB) -oc  glu_stubs  $<  $(GLU_LIBS)
+
+Glu.cmxa Glu.a:  Glu.cmx  glu.wrap.o
+	$(OCAMLMKLIB) -o Glu -oc glu_stubs  $^  $(GLU_LIBS)
 
 Glu.cma:  Glu.cmo  dllGlu.so
 	$(OCAMLMKLIB) -o Glu  $<  $(GLU_LIBS)
@@ -279,8 +282,8 @@ glut.wrap.o: glut.wrap.c  $(C_GLUT_INCS)
 dllGlut.so libGlut.a: glut.wrap.o
 	$(OCAMLMKLIB)  -o  Glut  $<  $(GLUT_LIBS)
 
-Glut.cmxa Glut.a:  Glut.cmx  dllGlut.so
-	$(OCAMLMKLIB)  -o  Glut  $<  $(GLUT_LIBS)
+Glut.cmxa Glut.a:  Glut.cmx  glut.wrap.o
+	$(OCAMLMKLIB)  -o  Glut $^  $(GLUT_LIBS)
 
 Glut.cma:  Glut.cmo  dllGlut.so
 	$(OCAMLMKLIB)  -o  Glut  $<  $(GLUT_LIBS)
@@ -484,7 +487,7 @@ DIST_FILES_CORE=\
     GL.a   GL.cmi   GL.cmxa   GL.cmx    \
     Glu.a  Glu.cmi  Glu.cmxa  Glu.cmx   \
     Glut.a Glut.cmi Glut.cmxa Glut.cmx  \
-    libgl_stubs.a     \
+    libgl_stubs.a  libglu_stubs.a   \
     libGlu.a          \
     libGlut.a         \
     GL.o    Glu.o    Glut.o     \

  reply	other threads:[~2012-01-13 20:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-13 19:41 Philippe Strauss
2012-01-13 20:48 ` Alan Schmitt [this message]
2012-01-13 21:26   ` Philippe Strauss

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=4758C5C2-5444-4C24-99CB-7AD010D06C6E@polytechnique.org \
    --to=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