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 p1LA4gNI002526 for ; Mon, 21 Feb 2011 11:04:42 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuYBANfHYU1RZ90wkWdsb2JhbAClWVMVAQEBAQkLCgcRAyG5MoIdg0EEjBM X-IronPort-AV: E=Sophos;i="4.62,199,1297033200"; d="scan'208";a="91716158" Received: from mtaout02-winn.ispmail.ntl.com ([81.103.221.48]) by mail2-smtp-roc.national.inria.fr with ESMTP; 21 Feb 2011 11:04:37 +0100 Received: from aamtaout03-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout02-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20110221100436.FUYY19887.mtaout02-winn.ispmail.ntl.com@aamtaout03-winn.ispmail.ntl.com>; Mon, 21 Feb 2011 10:04:36 +0000 Received: from romulus.metastack.com ([81.102.132.77]) by aamtaout03-winn.ispmail.ntl.com (InterMail vG.3.00.04.00 201-2196-133-20080908) with ESMTP id <20110221100435.MLOH28282.aamtaout03-winn.ispmail.ntl.com@romulus.metastack.com>; Mon, 21 Feb 2011 10:04:35 +0000 Received: from remus.metastack.local ([172.16.0.1]) by romulus.metastack.com (8.14.2/8.14.2) with ESMTP id p1LA4MwP017344 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Mon, 21 Feb 2011 10:04:22 GMT Received: from Remus.metastack.local ([fe80::547c:3c42:e1da:eda2]) by Remus.metastack.local ([fe80::547c:3c42:e1da:eda2%11]) with mapi; Mon, 21 Feb 2011 09:59:44 +0000 From: David Allsopp To: "'Jean Krivine'" CC: "'caml-list@yquem.inria.fr'" Thread-Topic: [Caml-list] Compiling Windows native code Thread-Index: AQHL0OoNuxCVeFb6bk2quzR4B/jyxZQK85WigAC8AQCAAAQzwA== Date: Mon, 21 Feb 2011 09:59:43 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: Content-Type: text/plain; charset="us-ascii" 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=QB_D34dBbOkA:10 a=kj9zAlcOel0A:10 a=xqWC_Br6kY4A:10 a=yMhMjlubAAAA:8 a=-z_vsuqgAAAA:20 a=ewkdJVqfYDz6mHiTRiEA:9 a=C-l-pDqlALYc6PgJ-O4A:7 a=kHl9C9z7I8GGB4BIiLH4CEs-J_IA:4 a=CjuIK1q_8ugA:10 a=J4xYML5aYhkA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id p1LA4gNI002526 Subject: RE: [Caml-list] Compiling Windows native code Jean Krivine wrote: > Sorry I wasn't being precise. > The error is code independent, I tested ocamlopt on a "helloworld program". > I am not using cygwin because I am trying to produce binaries which do not > require cygwin to launch and I understand that there is a particular dll > that is required to execute cygwin based compilation (correct?). That is correct - but *all* Windows versions of OCaml (including the MSVC[64] ports) are compiled using Cygwin to provide the build system (even the MSVC use GNU make but invoked on the MS compiler chain, the MinGW port uses gcc -mno-cygwin which compiles for MS C runtime, rather than Cygwin1.dll). But: that's not relevant here if you're installing OCaml from a pre-packaged binary. > I am using ocaml-3.11.0-win-msvc.exe that I downloaded from the web site (the gui > and byte code generator work just fine). That's consistent - those should work "out of the box" > Stuff I did (probably wrongly): > - install ocaml-3.11 using the installer > - install MinGW Shell Not necessary unless you need to build third party libraries which need a real build system > - MASM32 editor (for ml.exe) Should be unnecessary if using a later version of the WinSDK. > - flexdll (for flexlib) Isn't this packaged with the binary packages (I haven't used the binary packages for years because, for quite understandable reasons, they lag behind the current release - 3.12.0 is current, for example, and 3.11.2 was the last release in the 3.11.x series)? > - and microsoft SDK (for uuid.lib) My old instructions for 3.11.2 compilation note installing the "Windows SDK for Windows 7 and .NET Framework 3.5 Service Pack 1" (ISO available at http://www.microsoft.com/downloads/en/details.aspx?familyid=71DEB800-C591-4F97-A900-BEA146E4FAE1). I ran a default install but skipped installing Documentation, Samples and IA64 Libraries. You should expect to have to run OCaml from one of the SDK command prompts for ocamlopt to work (or manually add the required PATH, LIB and INCLUDE settings to your default environment). You should, however, find ml.exe in the VC\bin subdirectory after installation (if you choose to copy it, you'll need 1033\clui.dll - in that directory, ml.exe, cl.exe, c1.dll, c2.dll, link.exe, mspdb80.dll and mt.exe from the main Bin directory). > The result is a code that compiles just fine until the linking step where I get this weird error. Are you doing something like: ocamlopt -o hello.exe hello.ml or ocamlopt -c hello.ml ocamlopt -o hello.exe hello.cmx In other words, is the problem only with linking or with general invocation of ocamlopt? Another thing to check is the version of "link" that you're using - especially if you've installed MinGW then the wrong "link" may be being picked up by flexlink. Try typing link on its own from a command prompt - C:\Users\DRA> link link: missing operand Try `link --help' for more information. ... is a problem and means you need to mess around with your PATH to get the full path to MSVC's link correctly in place. If it's the right one then it'll something along the lines of "Microsoft Linker Version " followed by several screens of utterly unintelligible switches! > These steps I got from an old thread (2004) here: > http://groups.google.com/group/fa.caml/browse_thread/thread/fddaa68b3f497ec2 I'm afraid Microsoft mess around with the SDK structure so wildly between versions that older threads are less likely to be helpful! > I was not able to find more recent instructions. I fully intend one of these days to move my build-from-source instructions for the three relevant Windows ports (MSVC, MSVC64 and MinGW - and MinGW64 if I can ever find enough time to get it to work!) to a Wiki but that may require the invention of the 36 hour working day... :( David