From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: ** X-Spam-Status: No, score=2.8 required=5.0 tests=DNS_FROM_RFC_POST,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 260ABBBAF for ; Mon, 20 Jul 2009 16:28:18 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArsCAJMbZErRVdSzmGdsb2JhbACZHD8BAQEBAQYLDAcTpzczhSmISgEDAgSECAWBP2KFag X-IronPort-AV: E=Sophos;i="4.43,234,1246831200"; d="scan'208";a="43685993" Received: from mail-vw0-f179.google.com ([209.85.212.179]) by mail4-smtp-sop.national.inria.fr with ESMTP; 20 Jul 2009 16:28:16 +0200 Received: by vwj9 with SMTP id 9so2355682vwj.1 for ; Mon, 20 Jul 2009 07:28:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; bh=OrZ62DD4L37Ho5fxPaWs2+KIgTU+P3pr7vVsjSXG46k=; b=dQQH7+ck+7cb3gpduMupEs3VamemGOZ+M2XKv/Pz4i3ONOQ4w5Ky1tm2pliJjRskoZ WAUTXFEmqNy0jYxCcMYrLfh+JT39N7k1bKbumUC4luZleO00P7jZj+oavyyy96jYhqGk YX0uWJG3A4Aq/NCLZdSR7r2F/QxKm5PqwtHMk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type:content-transfer-encoding; b=trzEhG74atg2wojEeEnpXdrwI/XhVim4KW4kgJBayGHLF2NCQJ5VNc83nxgqoS1eba bjgsnN9O3g0k6kn5o301+jRa3z3+deYzRgx56NrY0TuVZ+mp05q9kKqzdBZ0IYvUpajc gDhfz7Gfxk8n2+94Zu4BwgNC7PRQAuKofPyJM= MIME-Version: 1.0 Sender: aaron678@gmail.com Received: by 10.220.95.129 with SMTP id d1mr4852148vcn.51.1248100095866; Mon, 20 Jul 2009 07:28:15 -0700 (PDT) Date: Mon, 20 Jul 2009 10:28:15 -0400 X-Google-Sender-Auth: 14e5ada541da72b9 Message-ID: Subject: how to use c wrapper files in libraries From: Aaron Bohannon To: caml-list@yquem.inria.fr Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; contrib:01 ocaml:01 compile-time:01 ocaml:01 ocamlc:01 -custom:01 stub:01 cmo:01 usr:01 lib:01 -cclib:01 ocamlc:01 stub:01 runtime:01 wrappers:01 Hello, I am trying to use the wrapper for libsndfile contributed by Erik de Castro Lopo (http://caml.inria.fr/cgi-bin/hump.en.cgi?contrib=556). The wrapper code compiles just fine. And the tests that use the OCaml library it builds work just fine. However, I am having a frustrating compile-time error when I try to compile my program in a different directory. The wrapper code is being packaged into an OCaml library using the following command: ocamlc -a -o sndfile.cma -custom sndfile_stub.o sndfile.cmo \ -ccopt -L/usr/local/lib -cclib -lsndfile Within the same directory, the test program can be successfully compiled with: ocamlc -o test_sndfile sndfile.cma test_sndfile.ml Within a different directory, I used: ocamlc -o mytest -I /path/to/libsndfile-ocaml/files/ sndfile.cma mytest.ml And I get: powerpc-apple-darwin8-gcc-4.0.1: sndfile_stub.o: No such file or directory Error while building custom runtime system I have tried setting every path-related option I could find, and nothing helped. I tried reading everything I could find about compiling and using c wrappers for OCaml, but there is a severe lack of documentation on the topic. In particular, I could find no example of a c object file being given as an argument to an "ocamlc -a" command, so I am not sure what that is supposed to do, which makes it impossible for me to understand this error message. I am using OCaml 3.10.1 on OS X 10.4. Any help would be appreciated. - Aaron