caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] ocamlmklib OSX/OpenGL weirdness
@ 2012-01-13 19:41 Philippe Strauss
  2012-01-13 20:48 ` Alan Schmitt
  0 siblings, 1 reply; 3+ messages in thread
From: Philippe Strauss @ 2012-01-13 19:41 UTC (permalink / raw)
  To: caml-list

Hello,

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 ?


Regards

--
Philippe Strauss
Why OCaml : http://www.philou.ch/






^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] ocamlmklib OSX/OpenGL weirdness
  2012-01-13 19:41 [Caml-list] ocamlmklib OSX/OpenGL weirdness Philippe Strauss
@ 2012-01-13 20:48 ` Alan Schmitt
  2012-01-13 21:26   ` Philippe Strauss
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Schmitt @ 2012-01-13 20:48 UTC (permalink / raw)
  To: caml-list

[-- 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     \

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] ocamlmklib OSX/OpenGL weirdness
  2012-01-13 20:48 ` Alan Schmitt
@ 2012-01-13 21:26   ` Philippe Strauss
  0 siblings, 0 replies; 3+ messages in thread
From: Philippe Strauss @ 2012-01-13 21:26 UTC (permalink / raw)
  To: caml-list

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

Thanks Alan, it does works fine now !

I attach another patch, very straight to the point, but not of the most refineds aesthetics, still to the same makefile, about paths to libjpeg and it's headers files.

(so in one thread on the ML archive we have all patches to build glMlite on OSX)

sorry, I was mixing the GL.o of glMlite and some kind of /usr/lib/libGL.so in my previous email.

would have spent half a day on it or more without yours. Thanks !

Le 13 janv. 2012 à 21:48, Alan Schmitt a écrit :

> 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
> 
> 
> -- 
> Caml-list mailing list.  Subscription management and archives:
> https://sympa-roc.inria.fr/wws/info/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
> 
> <patch_commit_2737d71a16b7.patch>


[-- Attachment #2: glmlite-make-libjpeg-paths.diff --]
[-- Type: application/octet-stream, Size: 1224 bytes --]

--- Makefile.orig	2012-01-13 15:23:23.000000000 +0100
+++ Makefile	2012-01-13 22:07:20.000000000 +0100
@@ -425,6 +425,9 @@
 jpeg_opt: jpeg_loader.cmxa
 jpeg: jpeg_byte jpeg_opt
 
+LDPATH=/opt/local/lib
+CCOPTS=-ccopt "-I/opt/local/include" -ccopt "-L$(LDPATH)"
+
 jpeg_loader.cmi jpeg_loader.cmo: jpeg_loader.ml  GL.cmi
 	$(OCAMLC) -c $<
 
@@ -432,16 +435,16 @@
 	$(OCAMLOPT) -c $<
 
 loader-libjpeg.o: loader-libjpeg.c  loader-libjpeg-mem.c  loader-texure.h
-	$(OCAMLC)  -c  $<
+	$(OCAMLC) $(CCOPTS) -c  $<
 
 dlljpeg_loader.so libjpeg_loader.a: loader-libjpeg.o
-	$(OCAMLMKLIB) -o jpeg_loader $< $(GL_LIBS) -L"$(OCAML_PATH)" -lbigarray -ljpeg
+	$(OCAMLMKLIB) -L$(LDPATH) -o jpeg_loader $< $(GL_LIBS) -L"$(OCAML_PATH)" -lbigarray -ljpeg
 
 jpeg_loader.cmxa jpeg_loader.a:  jpeg_loader.cmx  dlljpeg_loader.so
-	$(OCAMLMKLIB) -o jpeg_loader $< $(GL_LIBS) -L"$(OCAML_PATH)" -lbigarray -ljpeg
+	$(OCAMLMKLIB) -L$(LDPATH) -o jpeg_loader $< $(GL_LIBS) -L"$(OCAML_PATH)" -lbigarray -ljpeg
 
 jpeg_loader.cma:  jpeg_loader.cmo  dlljpeg_loader.so
-	$(OCAMLMKLIB) -o jpeg_loader $< $(GL_LIBS) -L"$(OCAML_PATH)" -lbigarray -ljpeg
+	$(OCAMLMKLIB) -L$(LDPATH) -o jpeg_loader $< $(GL_LIBS) -L"$(OCAML_PATH)" -lbigarray -ljpeg
 
 # }}}
 

[-- Attachment #3: Type: text/plain, Size: 48 bytes --]



--
Philippe Strauss
http://www.philou.ch/





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-01-13 21:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-13 19:41 [Caml-list] ocamlmklib OSX/OpenGL weirdness Philippe Strauss
2012-01-13 20:48 ` Alan Schmitt
2012-01-13 21:26   ` Philippe Strauss

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).