caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: skaller <skaller@users.sourceforge.net>
To: caml-list@yquem.inria.fr
Subject: caml on win64
Date: Wed, 28 Jun 2006 13:47:50 +1000	[thread overview]
Message-ID: <1151466470.6011.51.camel@rosella.wigram> (raw)

I'm having a problem using the Windows  native build of Ocaml
in a win64 environment. The error occurs running ocamlopt.opt,
attempting to link an executable: the diagnostic seems to be
from CL.exe (copied by hand looking at screen of windows box):

LIBCMT.lib(access.obj) : fatal error LNK1112: module machine
type 'x64' conflicts with target machine type 'x86'.

The problem seems to be ocaml is building 32 bit code using
the assembler, but it is invoking CL.exe to link, and the 
CL.EXE in the PATH is a 64 bit code generator/linker.

Unfortunately perhaps, Microsoft does not supply a compiler
with target switches. Instead they supply 4 distinct compilers
all named 'CL.EXE' but living in different places, to be used
building host->target with host,target in {x32,x64}.

In the particular script I'm using, we HAVE to have CL.EXE
generating 64 bit code for the C/C++ compilation steps.

However Ocaml is not actually using CL.EXE. It is simply cheating,
using CL.EXE to call LINK.EXE, which I believe does support target
switches. 

I'm not sure diddling the PATH before the link step will
be enough to fix this. Has anyone tried that?

Part of the problem is evident from the message: it's still
going to link the wrong C runtime, again because something
in the environment is telling the linker where to find the
runtime, and it is using the wrong one.

Although my build system has a theoretical workaround -- I could
build with --host=win32 --target=win64 that will fail for the same
reason: there's no way to switch the environment around between
the host and target steps (short of actually running the host
building phase in a win32 environment). The latter does work,
but it prevents full automation of the build process. The problem
is it is almost impossible to manually set up the required environment
to fool the MS toolchain.

It would be nice if there were some way to bind Ocaml to use the right
tools on installation.

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net


                 reply	other threads:[~2006-06-28  3:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1151466470.6011.51.camel@rosella.wigram \
    --to=skaller@users.sourceforge.net \
    --cc=caml-list@yquem.inria.fr \
    /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;
as well as URLs for NNTP newsgroup(s).