caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Compiling Windows native code
@ 2011-02-20 10:40 Jean Krivine
  2011-02-20 22:13 ` David Allsopp
  0 siblings, 1 reply; 7+ messages in thread
From: Jean Krivine @ 2011-02-20 10:40 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 455 bytes --]

Dear all,

I am trying to produce windows native code for windows, to do so I have
followed the instructions I found on different sources I am almost done but
I get one last error during linking:


** Fatal error: cannot find file "OLDNAMES"
File "caml_startup", Line 1, character 0-1
Error: Error during linking

I am using windows 7 and MinGW +  Windows SDK 6.2 (to get uuid.lib) + masm32
(to have ml.exe)

Any idea what might be going wrong?

Thanks!!

[-- Attachment #2: Type: text/html, Size: 527 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [Caml-list] Compiling Windows native code
  2011-02-20 10:40 [Caml-list] Compiling Windows native code Jean Krivine
@ 2011-02-20 22:13 ` David Allsopp
  2011-02-21  9:21   ` Jean Krivine
  0 siblings, 1 reply; 7+ messages in thread
From: David Allsopp @ 2011-02-20 22:13 UTC (permalink / raw)
  To: Jean Krivine, caml-list

Jean Krivine wrote:

> I am trying to produce windows native code for windows, to do so I
> have followed the instructions I found on different sources I am almost
> done but I get one last error during linking:

Which sources?

> ** Fatal error: cannot find file "OLDNAMES"
> 
> File "caml_startup", Line 1, character 0-1
> 
> Error: Error during linking

What command have you run to get this error?

> I am using windows 7 and MinGW +  Windows SDK 6.2 (to get uuid.lib)
> + masm32 (to have ml.exe)

Are you compiling OCaml from sources or using a pre-packaged version (and if so, which version of OCaml and which port). It's odd that you're referring to Windows 7 + MinGW - if you're building for the MS toolchain, then you should be using Cygwin but I wonder if that's just that you've called it by the wrong name (equally, I've got a feeling that building with MSYS now works, but I think that compiling under Cygwin is still the "official" method).

I haven't done an MS toolchain build of OCaml for a while, but I'm reasonably sure that when I last used it, the Windows Server 2008 SDK contains both the 32 and 64 bit assembler (no need to download masm separately any more for 32 bit builds).


David

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] Compiling Windows native code
  2011-02-20 22:13 ` David Allsopp
@ 2011-02-21  9:21   ` Jean Krivine
  2011-02-21  9:59     ` David Allsopp
  0 siblings, 1 reply; 7+ messages in thread
From: Jean Krivine @ 2011-02-21  9:21 UTC (permalink / raw)
  To: David Allsopp; +Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 2253 bytes --]

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?).

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).

Stuff I did (probably wrongly):

- install ocaml-3.11 using the installer
- install MinGW Shell
- MASM32 editor (for ml.exe)
- flexdll (for flexlib)
- and microsoft SDK (for uuid.lib)

The result is a code that compiles just fine until the linking step where I
get this weird error.

These steps I got from an old thread (2004) here:
http://groups.google.com/group/fa.caml/browse_thread/thread/fddaa68b3f497ec2

I was not able to find more recent instructions.


On Sun, Feb 20, 2011 at 11:13 PM, David Allsopp <dra-news@metastack.com>wrote:

> Jean Krivine wrote:
>
> > I am trying to produce windows native code for windows, to do so I
> > have followed the instructions I found on different sources I am almost
> > done but I get one last error during linking:
>
> Which sources?
>
> > ** Fatal error: cannot find file "OLDNAMES"
> >
> > File "caml_startup", Line 1, character 0-1
> >
> > Error: Error during linking
>
> What command have you run to get this error?
>
> > I am using windows 7 and MinGW +  Windows SDK 6.2 (to get uuid.lib)
> > + masm32 (to have ml.exe)
>
> Are you compiling OCaml from sources or using a pre-packaged version (and
> if so, which version of OCaml and which port). It's odd that you're
> referring to Windows 7 + MinGW - if you're building for the MS toolchain,
> then you should be using Cygwin but I wonder if that's just that you've
> called it by the wrong name (equally, I've got a feeling that building with
> MSYS now works, but I think that compiling under Cygwin is still the
> "official" method).
>
> I haven't done an MS toolchain build of OCaml for a while, but I'm
> reasonably sure that when I last used it, the Windows Server 2008 SDK
> contains both the 32 and 64 bit assembler (no need to download masm
> separately any more for 32 bit builds).
>
>
> David

[-- Attachment #2: Type: text/html, Size: 2954 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [Caml-list] Compiling Windows native code
  2011-02-21  9:21   ` Jean Krivine
@ 2011-02-21  9:59     ` David Allsopp
  2011-02-21 10:47       ` Vũ Ngọc San
  0 siblings, 1 reply; 7+ messages in thread
From: David Allsopp @ 2011-02-21  9:59 UTC (permalink / raw)
  To: 'Jean Krivine'; +Cc: 'caml-list@yquem.inria.fr'

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] Compiling Windows native code
  2011-02-21  9:59     ` David Allsopp
@ 2011-02-21 10:47       ` Vũ Ngọc San
  2011-02-21 11:08         ` jean.krivine
  2011-02-24 13:43         ` Jean Krivine
  0 siblings, 2 replies; 7+ messages in thread
From: Vũ Ngọc San @ 2011-02-21 10:47 UTC (permalink / raw)
  To: caml-list

incidentally, I've just installed ocaml+SDL on windows Vista and XP,
using Mingw and flexlink, and I can compile both bytecode and nativecode.

I put up a blog post for this, maybe it can help you (?)

http://blogperso.univ-rennes1.fr/san.vu-ngoc/index.php/post/2011/02/20/Ocaml-
and-SDL-on-windows

San


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Re: [Caml-list] Compiling Windows native code
  2011-02-21 10:47       ` Vũ Ngọc San
@ 2011-02-21 11:08         ` jean.krivine
  2011-02-24 13:43         ` Jean Krivine
  1 sibling, 0 replies; 7+ messages in thread
From: jean.krivine @ 2011-02-21 11:08 UTC (permalink / raw)
  To: Vũ Ngọc San, caml users

[-- Attachment #1: Type: text/plain, Size: 776 bytes --]

Fantastic that should be of great help.
I'll keep you posted.

J

Le , Vũ Ngọc San <san.vu-ngoc@univ-rennes1.fr> a écrit :
> incidentally, I've just installed ocaml+SDL on windows Vista and XP,

> using Mingw and flexlink, and I can compile both bytecode and nativecode.



> I put up a blog post for this, maybe it can help you (?)



> and-SDL-on-windows"  
> target="_blank">http://blogperso.univ-rennes1.fr/san.vu-ngoc/index.php/post/2011/02/20/Ocaml-

> and-SDL-on-windows



> San





> --

> Caml-list mailing list. Subscription management and archives:

> https://sympa-roc.inria.fr/wws/info/caml-list

> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners

> Bug reports: http://caml.inria.fr/bin/caml-bugs




[-- Attachment #2: Type: text/html, Size: 1112 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] Compiling Windows native code
  2011-02-21 10:47       ` Vũ Ngọc San
  2011-02-21 11:08         ` jean.krivine
@ 2011-02-24 13:43         ` Jean Krivine
  1 sibling, 0 replies; 7+ messages in thread
From: Jean Krivine @ 2011-02-24 13:43 UTC (permalink / raw)
  To: Vũ Ngọc San; +Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 1202 bytes --]

Fantastic, this procedure works like a charm (tested on a XP virutal machine
installed on my mac OS X) ! I can now produce ocaml binaires for windows.
Thank you very much for the tutorial!

For some reason ocamlopt cannot find ocaml libraires though... but it works
if you give the link to the libraires explicitely using
ocamlopt -I /c/mingw/lib -I /c/ocamlmgw/lib (respecting the name of the
procedure).

Cheers!

J

On Mon, Feb 21, 2011 at 11:47 AM, Vũ Ngọc San
<san.vu-ngoc@univ-rennes1.fr>wrote:

> incidentally, I've just installed ocaml+SDL on windows Vista and XP,
> using Mingw and flexlink, and I can compile both bytecode and nativecode.
>
> I put up a blog post for this, maybe it can help you (?)
>
>
> http://blogperso.univ-rennes1.fr/san.vu-ngoc/index.php/post/2011/02/20/Ocaml-
> and-SDL-on-windows<http://blogperso.univ-rennes1.fr/san.vu-ngoc/index.php/post/2011/02/20/Ocaml-%0Aand-SDL-on-windows>
>
> San
>
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa-roc.inria.fr/wws/info/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
>

[-- Attachment #2: Type: text/html, Size: 1803 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-02-24 13:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-20 10:40 [Caml-list] Compiling Windows native code Jean Krivine
2011-02-20 22:13 ` David Allsopp
2011-02-21  9:21   ` Jean Krivine
2011-02-21  9:59     ` David Allsopp
2011-02-21 10:47       ` Vũ Ngọc San
2011-02-21 11:08         ` jean.krivine
2011-02-24 13:43         ` Jean Krivine

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).