From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p1NGD4OK013918 for ; Wed, 23 Feb 2011 17:13:04 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjwCABbBZE1RZ90xkWdsb2JhbACmGRUBAQEBCQsKBxEDIbxahV4EjBY X-IronPort-AV: E=Sophos;i="4.62,212,1297033200"; d="scan'208";a="100509612" Received: from mtaout03-winn.ispmail.ntl.com ([81.103.221.49]) by mail1-smtp-roc.national.inria.fr with ESMTP; 23 Feb 2011 17:12:59 +0100 Received: from aamtaout04-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 <20110223161258.KQSK23441.mtaout03-winn.ispmail.ntl.com@aamtaout04-winn.ispmail.ntl.com>; Wed, 23 Feb 2011 16:12:58 +0000 Received: from romulus.metastack.com ([81.102.132.77]) by aamtaout04-winn.ispmail.ntl.com (InterMail vG.3.00.04.00 201-2196-133-20080908) with ESMTP id <20110223161258.JXQF25656.aamtaout04-winn.ispmail.ntl.com@romulus.metastack.com>; Wed, 23 Feb 2011 16:12:58 +0000 Received: from remus.metastack.local ([172.16.0.1]) by romulus.metastack.com (8.14.2/8.14.2) with ESMTP id p1NGCtHR014748 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Wed, 23 Feb 2011 16:12:55 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 16:08:14 +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///78MIAAEcWAgAAEhbCAAAhwgP///wng Date: Wed, 23 Feb 2011 16:08:13 +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> <5DAF4549-119D-48BB-871A-29AE03128C00@polytechnique.org> In-Reply-To: <5DAF4549-119D-48BB-871A-29AE03128C00@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=R50lirqlHffDPPkwUlkuVa99MrvKdVWo//yz83qex8g= c=1 sm=0 a=cdUUi1lex48A:10 a=8nJEP1OIZ-IA:10 a=xqWC_Br6kY4A:10 a=EpTZ1ZD3s3MhMYCf2rsA:9 a=kEmPE4aCkqkGeWJ8HLwA:7 a=h7eXaHzDSQJ1XWUFcSbaYqDQ_c4A:4 a=wPNLvfGTeEIA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id p1NGD4OK013918 Subject: RE: [Caml-list] Specifying a framework to link with using ocamlopt? Alan Schmitt wrote: > 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. No - it's now correct that the -lGL is there now. You should also have libGL.a as a result of that command - note those extra calls to ar and ranlib which I don't think you were getting before. Of course, if you want it to be called libgl_stubs.a then that's another matter but the library GL.cmxa built from this command should work (where you previous one did not). > With you other command line (removing the duplicated instance of > "GL.cmx"), Oops! > 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! No probs. David