Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: David Allsopp <dra-news@metastack.com>
To: "'Jean Krivine'" <jean.krivine@gmail.com>
Cc: "'caml-list@yquem.inria.fr'" <caml-list@yquem.inria.fr>
Subject: RE: [Caml-list] Compiling Windows native code
Date: Mon, 21 Feb 2011 09:59:43 +0000	[thread overview]
Message-ID: <E51C5B015DBD1348A1D85763337FB6D9490EFA7F@Remus.metastack.local> (raw)
In-Reply-To: <AANLkTim0R8e67GrsNoJyPbEEAwP5gow0O+ZcYsqFWn7v@mail.gmail.com>

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 <insert-huge-number-here>" 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


  reply	other threads:[~2011-02-21 10:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-20 10:40 Jean Krivine
2011-02-20 22:13 ` David Allsopp
2011-02-21  9:21   ` Jean Krivine
2011-02-21  9:59     ` David Allsopp [this message]
2011-02-21 10:47       ` Vũ Ngọc San
2011-02-21 11:08         ` jean.krivine
2011-02-24 13:43         ` Jean Krivine

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E51C5B015DBD1348A1D85763337FB6D9490EFA7F@Remus.metastack.local \
    --to=dra-news@metastack.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=jean.krivine@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox