From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 1A999BB91 for ; Fri, 31 Dec 2004 16:08:10 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id iBVF89Dg032144 for ; Fri, 31 Dec 2004 16:08:09 +0100 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id QAA24560 for ; Fri, 31 Dec 2004 16:08:06 +0100 (MET) Received: from mail-white.research.att.com (mail-red.research.att.com [192.20.225.110]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id iBVF86x3001767 for ; Fri, 31 Dec 2004 16:08:06 +0100 Received: from [192.168.1.103] (vpn-11.research.att.com [135.207.240.11]) by bigmail.research.att.com (8.11.6+Sun/8.11.6) with ESMTP id iBVF84N25144; Fri, 31 Dec 2004 10:08:05 -0500 (EST) Subject: Re: [Caml-list] MacOS port and file formats From: Mary Fernandez To: Jacques Garrigue Cc: caml-list@inria.fr In-Reply-To: <20041231.182319.04680184.garrigue@math.nagoya-u.ac.jp> References: <1104458557.8834.37.camel@localhost.localdomain> <20041231.182319.04680184.garrigue@math.nagoya-u.ac.jp> Content-Type: text/plain Organization: AT&T Labs - Research Message-Id: <1104505684.8834.851.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 (1.4.5-7) Date: Fri, 31 Dec 2004 10:08:04 -0500 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 41D56B59.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 41D56B56.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 macos:01 o'caml:01 apis:01 o'caml:01 native-code:01 runtime:01 pcre:01 ocamlopt:01 ocamlmklib:01 ocamlmklib:01 lib:01 ocaml:01 stublibs:01 libstr:01 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.0 X-Spam-Level: Hi Jacques, Thanks for your message. Here is what I am trying to do. My O'Caml application is an XQuery engine. It has three APIs: one for O'Caml, one for C, and one for Java applications. We create a native-code, dynamically linked C library that includes our O'Caml library, the O'Caml runtime, and several other C libraries that our application depends upon the unix, nums, str libraries plus an external PCRE library. We actually do this by hand with ocamlopt (not ocamlmklib) because in the past, we found ocamlmklib did not work consistently on all platforms. What I have found is that if the dll*.so libraries are Mac bundle files, then I get a linking error of the form "...ld: /Users/mff/ocaml-3.08.2/lib/ocaml/stublibs/libstr.dylib is input for the dynamic link editor, is not relocatable by the static link editor again..." (Note that the default name of dllstr.so is not recognized by the Darwin linker). If I re-compile the otherlibs/ in stublibs/ to be dynamically linked libraries, then I have no problems. Also, if I just use the archive files, that works too -- but I typically use O'Caml with dynamic libs enabled which is how I tripped over this problem. We only create a dynamically linked library, because our Java library call the C library, and the Java JNI requires dynamically linked C libraries. So, in short, I have something that works, but still dont' understand why bundles and dynamically linked libraries caused me trouble. Thanks,Mary On Fri, 2004-12-31 at 04:23, Jacques Garrigue wrote: > From: Mary Fernandez > > > I have a question regarding the ./configure options for MacOS/Darwin. > > > > ./configure selects the -bundle option for MKSHAREDLIB, which > > has the effect of creating MacOS bundle type files for the dynamically > > linked libraries in lib/ocaml/stublibs. I have had trouble linking > > these bundle files with the standard dynamically linked libraries > > created with the -dynamiclib option. As an experiment, I replaced > > -bundle by -dynamiclib and attempted to rebuild the O'Caml compiler, > > but got an error deep in compilation of the compiler. Ultimately, > > I just made the otherlibs/* libraries by hand with -dynamiclib and was > > able > > to link my application. > > > > I will admit that I am overwhelmed by the Darwin documentation > > that explains how to port a Linux application to MacOS. > > Can someone explain why the -bundle option is necessary to the compiler > > compilation? > > Is it because the O'Caml compiler a full-fledged Mac application? > > Could you explain exactly what you are trying to do? > The dlls in stublibs are only intended to be dynamically loaded by an > ocaml application. The reason bundles are used rather than dynamic > libraries is that the API for bundles is simpler, and that their > explicit intent (plugins) seems close enough to the use of dlls in > ocaml. > Note that a bundle can depend on dynamic libraries, so this should not > induce other limitations. > > Jacques Garrigue -- Mary Fernandez AT&T Labs - Research