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 concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 5C6C2BB91 for ; Sat, 23 Jul 2005 14:36:56 +0200 (CEST) Received: from kurims.kurims.kyoto-u.ac.jp (kurims.kurims.kyoto-u.ac.jp [130.54.16.1]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j6NCasxk012648 for ; Sat, 23 Jul 2005 14:36:55 +0200 Received: from localhost (suiren [130.54.16.25]) by kurims.kurims.kyoto-u.ac.jp (8.13.1/8.13.1) with ESMTP id j6NCanpa013215; Sat, 23 Jul 2005 21:36:49 +0900 (JST) Date: Sat, 23 Jul 2005 21:36:44 +0900 (JST) Message-Id: <20050723.213644.28464392.garrigue@math.nagoya-u.ac.jp> To: jonathan.roewen@gmail.com Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Creating nativecode apps From: Jacques Garrigue In-Reply-To: References: <92AD4A03-A3FA-4725-97B7-3355C057401D@m4x.org> X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 42E239E6.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 nativecode:01 rephrase:01 ocaml:01 compilers:01 compiler:01 -output-obj:01 ocaml:01 compilers:01 bytecode:01 bytecomp:01 bytelink:01 asmcomp:01 asmlink:01 compiler: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.4 required=5.0 tests=DNS_FROM_RFC_ABUSE autolearn=disabled version=3.0.3 From: Jonathan Roewen > Let me rephrase. What do the ocaml compilers need a C compiler for? > And, if I use -output-obj, is the object file created solely by the > ocaml compilers, or does this depend on a C compiler? You must distinguish the bytecode and native code cases. As far as I can follow the code in bytecomp/bytelink.ml and asmcomp/asmlink.ml, in the first case a C compiler is needed, as ocamlc generates some glue code written in C. This is not surprising, as ocamlc knows nothing about native objects, so all interaction requires some glue compiled with a C compiler, this is also true for -custom. On the other hand, ocamlopt can generate assembler code, so it doesn't really require a C compiler. However it requires working assembler and linker. In some cases it may even choose to use gcc as front end to either of them, while not feeding it C code. The problem is of course that generally, if you've got a linker and an assembler, you've also got a C compiler. The only exception that comes to mind is commercial Unixes like Solaris, if you really don't want to install gcc. So I'm afraid that the answer is rather that ocamlopt depends on a working compiling environment, even if this might not include a C compiler. The only case nothing is required from the environment is when using ocamlc with shared libraries (i.e. without -custom). This was an important reason to support them. Jacques Garrigue