From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 05EC1BB84 for ; Wed, 28 Jun 2006 05:48:02 +0200 (CEST) Received: from ash25e.internode.on.net (ash25e.internode.on.net [203.16.214.182]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k5S3m0oG030290 for ; Wed, 28 Jun 2006 05:48:01 +0200 Received: from rosella (ppp28-237.lns1.syd2.internode.on.net [59.167.28.237] (may be forged)) by ash25e.internode.on.net (8.13.6/8.13.5) with ESMTP id k5S3lojg063603 for ; Wed, 28 Jun 2006 13:17:52 +0930 (CST) (envelope-from skaller@users.sourceforge.net) Subject: caml on win64 From: skaller To: caml-list@yquem.inria.fr Content-Type: text/plain Date: Wed, 28 Jun 2006 13:47:50 +1000 Message-Id: <1151466470.6011.51.camel@rosella.wigram> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 44A1FBF0.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; ocaml:01 ocamlopt:01 libcmt:01 lib:01 ocaml:01 compiler:01 compilers:01 compilation:01 runtime:01 runtime:01 toolchain:01 sourceforge:01 workaround:01 conflicts:01 short:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 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 Felix, successor to C++: http://felix.sf.net