From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id DBD017EE25 for ; Wed, 20 Nov 2013 09:23:53 +0100 (CET) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of yallop@gmail.com) identity=pra; client-ip=74.125.82.177; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="yallop@gmail.com"; x-sender="yallop@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of yallop@gmail.com designates 74.125.82.177 as permitted sender) identity=mailfrom; client-ip=74.125.82.177; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="yallop@gmail.com"; x-sender="yallop@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-we0-f177.google.com) identity=helo; client-ip=74.125.82.177; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="yallop@gmail.com"; x-sender="postmaster@mail-we0-f177.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkYDAPVwjFJKfVKxlGdsb2JhbABZgz9HDIJ2u3SBBwgWDgEBAQEHCwsJEiqCJQEBBSMdARsdAQMMBgULDQICJgICIQEBEQEFARwGExuHUwEDDw2iaowEU4MJhCUKGScNZId2EQEFDIEdizqCdAeCa4FHA5YngWuBL4smg0wYKYMVgT48 X-IPAS-Result: AkYDAPVwjFJKfVKxlGdsb2JhbABZgz9HDIJ2u3SBBwgWDgEBAQEHCwsJEiqCJQEBBSMdARsdAQMMBgULDQICJgICIQEBEQEFARwGExuHUwEDDw2iaowEU4MJhCUKGScNZId2EQEFDIEdizqCdAeCa4FHA5YngWuBL4smg0wYKYMVgT48 X-IronPort-AV: E=Sophos;i="4.93,735,1378850400"; d="scan'208";a="36666270" Received: from mail-we0-f177.google.com ([74.125.82.177]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 20 Nov 2013 09:23:53 +0100 Received: by mail-we0-f177.google.com with SMTP id p61so4101861wes.36 for ; Wed, 20 Nov 2013 00:23:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=fELihTv33bxCtIZDb8XBqsyqVd2fSIWfWar8dlk/IeY=; b=kqlSRZQ5lEiY6DMiUcOpZAY7lFlkX0Q1VJE1dclGwqa4O7bA9Wu1oNNkb7LVCShoTs pov0DLR9vfXivxyEpBEqmbDDJmVB+xCCrXIFkKPMi3orkRcSo66AAzCEXPv00sumG15C wGyNjKBTozp3+qUUlIcn5FbX8tf6bMblclAYJBj3FiRIwR790x5QS2Tz+XQH9AmgGtN6 i+w5oaPWa0vPn2JTFghR9utPvEgMN7ZCTcurMUboWg4O7khthRZlj8PTcDbdWij4mdJH vzHccNH7elEaTYaitx0aYFRuymZHN0tMu4ZE+WuGJn3+xN46nJvoW2Y02FXa0qIBUTql M67w== MIME-Version: 1.0 X-Received: by 10.180.94.100 with SMTP id db4mr24445144wib.14.1384935832785; Wed, 20 Nov 2013 00:23:52 -0800 (PST) Received: by 10.216.185.65 with HTTP; Wed, 20 Nov 2013 00:23:52 -0800 (PST) In-Reply-To: References: Date: Wed, 20 Nov 2013 08:23:52 +0000 Message-ID: From: Jeremy Yallop To: Mike McClurg Cc: Caml List Content-Type: text/plain; charset=UTF-8 Subject: Re: [Caml-list] ctypes with -thread: inconsistent assumptions over implementation Foreign On 19 November 2013 22:57, Mike McClurg wrote: > $ ocamlfind ocamlopt -verbose -package ctypes,ctypes.foreign -linkpkg > -thread -o test test.ml [...] > File "test.ml", line 1: > Error: Files test.cmx > and /Users/mike/.opam/system/lib/ctypes/ctypes-foreign-threaded.cmxa > make inconsistent assumptions over implementation Foreign [...] > Am I doing something wrong here? Or is something wrong with the way ctypes > is built and packaged? It's a packaging problem. Ctypes uses a findlib feature[1] that selects the library to link according to whether threads are enabled, as you can see in the META file: archive(native, mt) = "ctypes-foreign-threaded.cmxa" [...] archive(native) = "ctypes-foreign-unthreaded.cmxa" (from [2]) This shows up in your command-line as expected: when you don't pass -thread to ocamlfind it picks the -unthreaded version of the ctypes-foreign library + ocamlopt.opt [...] /Users/mike/.opam/system/lib/ctypes/ctypes-foreign-unthreaded.cmxa test.ml and when you pass -thread you get the -threaded version + ocamlopt.opt [...] /Users/mike/.opam/system/lib/ctypes/ctypes-foreign-threaded.cmxa test.ml So far, so good. However, although there are two cmxa implementations installed for ctypes-foreign there's only one set of cmx files, which happen to match the -unthreaded version of the library. Compiling with the -thread option picks the -threaded library but the -unthreaded cmx, leading to the mismatch that you're seeing. If you simply delete the offending cmx file (as a diagnostic step, not a long-term solution!) you should see the problem disappear: rm /Users/mike/.opam/system/lib/ctypes/foreign.cmx [1] http://projects.camlcity.org/projects/dl/findlib-1.4/doc/guide-html/x261.html [2] https://github.com/ocamllabs/ocaml-ctypes/blob/ocaml-ctypes-0.2.1/META#L39-L43