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 A87EC801DC for ; Sun, 27 Aug 2017 03:12:16 +0200 (CEST) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=kennethadammiller@gmail.com; spf=Pass smtp.mailfrom=kennethadammiller@gmail.com; spf=None smtp.helo=postmaster@mail-lf0-f53.google.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of kennethadammiller@gmail.com) identity=pra; client-ip=209.85.215.53; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="kennethadammiller@gmail.com"; x-sender="kennethadammiller@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of kennethadammiller@gmail.com designates 209.85.215.53 as permitted sender) identity=mailfrom; client-ip=209.85.215.53; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="kennethadammiller@gmail.com"; x-sender="kennethadammiller@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-lf0-f53.google.com) identity=helo; client-ip=209.85.215.53; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="kennethadammiller@gmail.com"; x-sender="postmaster@mail-lf0-f53.google.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3AbwQeAxfKd5qXzAqsJ3tsvRbZlGMj4u6mDksu8pMi?= =?us-ascii?q?zoh2WeGdxc2yYB7h7PlgxGXEQZ/co6odzbGJ4+a9ASQp2tWojjMrSNR0TRgLiM?= =?us-ascii?q?EbzUQLIfWuLgnFFsPsdDEwB89YVVVorDmROElRH9viNRWJ+iXhpW1aJhKqPgNw?= =?us-ascii?q?IqzoAYPIlIzj3Om3/9jXYh5UrDu7e7J7ahus+1b/rM4T1KhvLKA81huBi3dBfq?= =?us-ascii?q?xzxGdsKEjbyxXx4MG94J5q/y1VvvMl88Naear/dqU8C7dfCWJ1YCgO+MT3uEyb?= =?us-ascii?q?HkO07XwGXzBOnw=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0ADBwCFG6JZhjXXVdFcHgYMGQYMgkSBE?= =?us-ascii?q?AE+gRUHg3CBNph9gmiIMoc/h1AOIIUZg14HQxQBAQEBAQEBAQEBARIBAQEICws?= =?us-ascii?q?IKC+CMyKCbR0BGx4DEgMNNwIkAREBBQEiiisBAxUQkwCNVoNFQIwLggUFARyDC?= =?us-ascii?q?QWDVgoZJw1Xg24CBhKDGIICgzGCc4VXgmaCYQEEiXoOhxmBZ41ch1aMcIISWoE?= =?us-ascii?q?Uh3WGc4xZiBsVH4EVNoEuMiEkeIRvH4IPJDaLIAEBAQ?= X-IPAS-Result: =?us-ascii?q?A0ADBwCFG6JZhjXXVdFcHgYMGQYMgkSBEAE+gRUHg3CBNph?= =?us-ascii?q?9gmiIMoc/h1AOIIUZg14HQxQBAQEBAQEBAQEBARIBAQEICwsIKC+CMyKCbR0BG?= =?us-ascii?q?x4DEgMNNwIkAREBBQEiiisBAxUQkwCNVoNFQIwLggUFARyDCQWDVgoZJw1Xg24?= =?us-ascii?q?CBhKDGIICgzGCc4VXgmaCYQEEiXoOhxmBZ41ch1aMcIISWoEUh3WGc4xZiBsVH?= =?us-ascii?q?4EVNoEuMiEkeIRvH4IPJDaLIAEBAQ?= X-IronPort-AV: E=Sophos;i="5.41,433,1498514400"; d="scan'208,217";a="235417102" Received: from mail-lf0-f53.google.com ([209.85.215.53]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 27 Aug 2017 03:12:15 +0200 Received: by mail-lf0-f53.google.com with SMTP id k186so10897419lfe.2 for ; Sat, 26 Aug 2017 18:12:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=gC/wxUG0s0Fm41QbWtWp0x4kXPP1h3llLCHl2tE0W0o=; b=MhTSmeEKnHXZPzOKro7Jdp/uvWtUS7lZ8dRJEnwkifTm2KhT5oc+2fhxHDgPFz4GBT ozjIRUrecMMmBwjk+szaUD8+ijrnHSWHtxUjRpxqsJDEonxpYpXr7fWLWBshJFL1C6LT 6V5CfQX4cbYaHepd6FVyvI/J5ueMKw+RN2fX11ehClGfpLqXn4kixgVhf3O8qxpJCFxy eEQaMdn0sO9yS2xZmFkYwmYdU93N1OdE7WO3EayNZadmT1+EWWxrlr2YavjSv4DJVaxR CjH3+e/PWr9NS1mM6bGDSjFb9akd6ZvU8gcBPBpGMVK13Wh8DTlCvi1Sb4WfLXkpyLaa brng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=gC/wxUG0s0Fm41QbWtWp0x4kXPP1h3llLCHl2tE0W0o=; b=CHAkQ8nxKMjPzf+Al3GeN5IhPUFmoRKvS2/18MBavONFF1Sgoaw9Tt5MC9ZNJdYOrF EIderJpw30Kl+Ny7QQxFORubFjs4JamSb2VpunpudOEdbSpcOIxiPJh4qeK9NRcVUxNx /nSmh4chw+8Z/bTqES2zjD5n28RzKXcIN4ql9zgzyT2bdhtmtqOa9lDyf5o6q0+9/Bwk 3VcMej0hLthsh8Jq4cnkSoLvnTOfuYNEHYPe46Z8QeLzIPUwoce71Y1CsEGL3oSblc/P eS7pGmGkvQ88H8M7gbDQLEBW9kj/MGDGdMVtfhSmJOyRuqrNuFZXC9MMsDAoCO2VmNxg qkdg== X-Gm-Message-State: AHYfb5gE91FeYVs9FXd8dUdjQNXD51sf1ec3QtIi7EHEvfqzifb6MPQF T6jW+KZl+nVaL3dKlCeYqu+P1L3jvupTKjA= X-Received: by 10.46.33.168 with SMTP id h40mr1046756lji.30.1503796334446; Sat, 26 Aug 2017 18:12:14 -0700 (PDT) MIME-Version: 1.0 Received: by 10.46.81.18 with HTTP; Sat, 26 Aug 2017 18:12:13 -0700 (PDT) From: Kenneth Adam Miller Date: Sat, 26 Aug 2017 21:12:13 -0400 Message-ID: To: caml users Content-Type: multipart/alternative; boundary="001a1142bbea544e4a0557b1deba" Subject: [Caml-list] oasis and C wrapper --001a1142bbea544e4a0557b1deba Content-Type: text/plain; charset="UTF-8" Hello, I'm building a pair of companion oasis build spec and opam package setup for a C library. libdai I figured out how to get swig and oasis to build most things I need, but I'm having trouble getting oasis to not generate _stubs targets that aren't found. There is a static C/++ libdai.a file that is the product of the project I'm trying to wrap. I can't convince oasis to use that instead. Here's my _oasis target: Library "dai" Path: ./ Install: false Modules: Swig, Dai CompiledObject: best CSources: dai_wrap.cxx.c CCOpt: -g -xc++ "-I../../include" With a fresh clone of libdai, I get dai_wrap.cxx.c by doing the following in ./swig after building libdai: $(SWIG) -ocaml -c++ dai.i mv dai_wrap.cxx dai_wrap.cxx.c sed -i -e 's/caml_array_length/caml_array_len/g' dai_wrap.cxx.c I got my swig and dai ml files by doing the following: swig2.0 -ocaml -co dai.ml swig2.0 -ocaml -co swig.ml swig2.0 -ocaml -co swig.mli I build by doing the following: ocaml setup.ml -configure ocaml setup.ml -build I get the following error: Solver failed: Ocamlbuild knows of no rules that apply to a target named ./libdai_stubs.a. This can happen if you ask Ocamlbuild to build a target with the wrong extension (e.g. .opt instead of .native) or if the source files live in directories that have not been specified as include directories. Compilation unsuccessful after building 8 targets (8 cached) in 00:00:00. E: Failure("Command ''/usr/bin/ocamlbuild' ./libdai_stubs.a ./dlldai_stubs.so ./dai.cma ./dai.cmxa ./dai.a ./dai.cmxs -j 5 -tag debug' terminated with error code 6") I want to make sure that the actual target shared library that was produced by the libdai build file itself is linked against. But oasis is assuming I have a _stubs target. I read in the documentation here that: "The usual idiom is to append _stubs to the name." https://ocaml.org/learn/tutorials/setting_up_with_oasis.html#Interfacing-with-C-code And I think that that is the source of the error, but it isn't well explained. The ultimate things I originally wanted was to be able to use libdai with both the utop or the bytecode interpreter and with fully compiled targets. I was going to make libdai a library and then publicize it. If anybody needs to replicate my issue, I have a docker container with this already. --001a1142bbea544e4a0557b1deba Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello,


I'm building = a pair of companion oasis build spec and opam package setup for a C library= . libdai I figured out how to get swig and oasis to build most things I nee= d, but I'm having trouble getting oasis to not generate _stubs targets = that aren't found. There is a static C/++ libdai.a file that is the pro= duct of the project I'm trying to wrap. I can't convince oasis to u= se that instead. Here's my _oasis target:


Library "dai"
=C2=A0 Path: =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ./
=C2=A0 Install: =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0false
=C2=A0 Modules: = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Swig, Dai
=C2=A0 = CompiledObject: =C2=A0 =C2=A0 =C2=A0 best
=C2=A0 CSources: =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 dai_wrap.cxx.c
=C2=A0 CCOpt: = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-g -xc++ "-I../= ../include"


With a fresh clone of l= ibdai, I get dai_wrap.cxx.c by doing the following in ./swig after building= libdai:

$(SWIG) -ocaml -c++ =C2=A0dai.i
mv dai_wrap.cxx dai_wrap.cxx.c
sed -i -e 's/caml_array_= length/caml_array_len/g' dai_wrap.cxx.c

= I got my swig and dai ml files by doing the following:

swig2.0 = -ocaml -co dai.ml
swig2.0 -ocaml -c= o swig.ml
swig2.0 -ocaml -co swig.= mli

I build by doing the following:

ocaml setup.ml -configure<= /div>
ocaml setup.ml -build


= I get the following error:


Solver failed:
=C2=A0 = Ocamlbuild knows of no rules that apply to a target named ./libdai_stubs.a.= This can happen if you ask Ocamlbuild to build a target with the wrong ext= ension (e.g. .opt instead of .native) or if the source files live in direct= ories that have not been specified as include directories.
Compil= ation unsuccessful after building 8 targets (8 cached) in 00:00:00.
E: Failure("Command ''/usr/bin/ocamlbuild' ./libdai_stu= bs.a ./dlldai_stubs.so ./dai.cma ./dai.cmxa ./dai.a ./dai.cmxs -j 5 -tag de= bug' terminated with error code 6")

I want to = make sure that the actual target shared library that was produced by the li= bdai build file itself is linked against. But oasis is assuming I have a _s= tubs target. I read in the documentation here that: "The usual idiom is = to append=C2=A0_stubs=C2=A0to the name."=C2=A0
https://ocaml.org/learn/tutorials/setting= _up_with_oasis.html#Interfacing-with-C-code

And I = think that that is the source of the error, but it isn't well explained= . The ultimate things I originally wanted was to be able to use libdai with= both the utop or the bytecode interpreter and with fully compiled targets.= I was going to make libdai a library and then publicize it.

=
If anybody needs to replicate my issue, I have a docker containe= r with this already.
--001a1142bbea544e4a0557b1deba--