From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p1NG87U7012968 for ; Wed, 23 Feb 2011 17:08:07 +0100 X-IronPort-AV: E=Sophos;i="4.62,212,1297033200"; d="scan'208";a="76446166" Received: from top.inrialpes.fr ([194.199.25.106]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/AES128-SHA; 23 Feb 2011 17:08:02 +0100 Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=iso-8859-1 From: Alan Schmitt In-Reply-To: Date: Wed, 23 Feb 2011 17:08:01 +0100 Cc: "'caml-list@inria.fr'" Message-Id: <5DAF4549-119D-48BB-871A-29AE03128C00@polytechnique.org> References: <2E007446-C7AD-46D6-8F9C-1377533EF156@polytechnique.org> <6E137EA1-CD63-43E8-B647-911AB57B7090@polytechnique.org> <455E8751-BA9F-47E5-8BAA-ABABE145822A@polytechnique.org> To: David Allsopp X-Mailer: Apple Mail (2.1082) Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id p1NG87U7012968 Subject: Re: [Caml-list] Specifying a framework to link with using ocamlopt? 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