From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p1NFrJoM012151 for ; Wed, 23 Feb 2011 16:53:19 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjwCAO+7ZE1RZ90xkWdsb2JhbACmGRUBAQEBCQsKBxEDIbxHhV4EjBY X-IronPort-AV: E=Sophos;i="4.62,212,1297033200"; d="scan'208";a="91888950" Received: from mtaout03-winn.ispmail.ntl.com ([81.103.221.49]) by mail2-smtp-roc.national.inria.fr with ESMTP; 23 Feb 2011 16:53:14 +0100 Received: from aamtaout02-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout03-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20110223155314.JOLF23441.mtaout03-winn.ispmail.ntl.com@aamtaout02-winn.ispmail.ntl.com>; Wed, 23 Feb 2011 15:53:14 +0000 Received: from romulus.metastack.com ([81.102.132.77]) by aamtaout02-winn.ispmail.ntl.com (InterMail vG.3.00.04.00 201-2196-133-20080908) with ESMTP id <20110223155314.OKDA25842.aamtaout02-winn.ispmail.ntl.com@romulus.metastack.com>; Wed, 23 Feb 2011 15:53:14 +0000 Received: from remus.metastack.local ([172.16.0.1]) by romulus.metastack.com (8.14.2/8.14.2) with ESMTP id p1NFrA0o014611 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Wed, 23 Feb 2011 15:53:10 GMT Received: from Remus.metastack.local ([fe80::547c:3c42:e1da:eda2]) by Remus.metastack.local ([fe80::547c:3c42:e1da:eda2%11]) with mapi; Wed, 23 Feb 2011 15:48:30 +0000 From: David Allsopp To: "'Alan Schmitt'" CC: "'caml-list@inria.fr'" Thread-Topic: [Caml-list] Specifying a framework to link with using ocamlopt? Thread-Index: AQHL01qCYpWJmFu99k29At0YXZiK7ZQPHCUwgAAHIID///78MIAAEcWAgAAEhbA= Date: Wed, 23 Feb 2011 15:48:29 +0000 Message-ID: References: <2E007446-C7AD-46D6-8F9C-1377533EF156@polytechnique.org> <6E137EA1-CD63-43E8-B647-911AB57B7090@polytechnique.org> <455E8751-BA9F-47E5-8BAA-ABABE145822A@polytechnique.org> In-Reply-To: <455E8751-BA9F-47E5-8BAA-ABABE145822A@polytechnique.org> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: Content-Type: text/plain; charset="iso-8859-1" MIME-Version: 1.0 Organization: MetaStack Solutions Ltd. X-Scanned-By: MIMEDefang 2.65 on 81.102.132.77 X-Cloudmark-Analysis: v=1.1 cv=JvdXmxIgLJv2/GthKqHpGJEEHukvLcvELVXUanXFreg= c=1 sm=0 a=cdUUi1lex48A:10 a=8nJEP1OIZ-IA:10 a=xqWC_Br6kY4A:10 a=9j3CAKlNTfbMsFAjSXwA:9 a=Hyzz7kXEUWlICeML7YwA:7 a=XXtC2v06fuW9h4kmErk9SsoV-o0A:4 a=wPNLvfGTeEIA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id p1NFrJoM012151 Subject: RE: [Caml-list] Specifying a framework to link with using ocamlopt? 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