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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 265317EEF6 for ; Fri, 5 Jun 2015 12:29:59 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of christiano.fh@gmail.com) identity=pra; client-ip=209.85.160.170; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="christiano.fh@gmail.com"; x-sender="christiano.fh@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of christiano.fh@gmail.com designates 209.85.160.170 as permitted sender) identity=mailfrom; client-ip=209.85.160.170; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="christiano.fh@gmail.com"; x-sender="christiano.fh@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-yk0-f170.google.com) identity=helo; client-ip=209.85.160.170; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="christiano.fh@gmail.com"; x-sender="postmaster@mail-yk0-f170.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0AUAgDVeHFVnKqgVdFbg2ReBoMYu06BXYcmBzoSAQEBAQEBAREBAQEBAQYNCQkhLoQ7EQQZATkDDQUQBwgCJgIkEgEFAQ5Jh3YDEg2nW4MxPjGLP4RkmW8nDYVBAQUOgROPRYJSgUUFhlSMS4Q/YYYHgS8+gzqLLoU2EiOBFV2BDgELATUcgVQ8MQGCRgEBAQ X-IPAS-Result: A0AUAgDVeHFVnKqgVdFbg2ReBoMYu06BXYcmBzoSAQEBAQEBAREBAQEBAQYNCQkhLoQ7EQQZATkDDQUQBwgCJgIkEgEFAQ5Jh3YDEg2nW4MxPjGLP4RkmW8nDYVBAQUOgROPRYJSgUUFhlSMS4Q/YYYHgS8+gzqLLoU2EiOBFV2BDgELATUcgVQ8MQGCRgEBAQ X-IronPort-AV: E=Sophos;i="5.13,558,1427752800"; d="scan'208";a="163317065" Received: from mail-yk0-f170.google.com ([209.85.160.170]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 05 Jun 2015 12:29:58 +0200 Received: by yken206 with SMTP id n206so23138512yke.2 for ; Fri, 05 Jun 2015 03:29:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:content-type; bh=jhiy16yBH2TTV3ymD1wpfy1NK4Vf4embn2nr6FO59OA=; b=b3FviRhQD4j8/mIJidjK/ADiTYMCxO6nSv0X4Qk7Zzs7zJTGOf6cKD8FCkc/FQfS/q 1rV2G6Xt+lp+BCdR2ZXgNJLvwJsKXGtnxkYWjdr1KthtOE7yGFWb/cJYW4swNatv0U4I GVFdXso3MXzlFynE4nFZzjYzH737PucuUtR9DAzJyNmcftHw40Rgm/wi9u/6lWkjupe+ iZ+ZY4Wz+GBfD05X4PygEmiDXt39ZTh2hMvMtkMPZ395a2+g6j0KT+3ur4MVL9Jg24tD e4sG2K5e4YbcmeB7uBEdFApyW9UTKNOucQSNjkeNeqaE1HO3OxlqH/ptzlI2ch18HZM+ ANzQ== MIME-Version: 1.0 X-Received: by 10.236.209.195 with SMTP id s43mr2496382yho.131.1433500197107; Fri, 05 Jun 2015 03:29:57 -0700 (PDT) Sender: christiano.fh@gmail.com Received: by 10.129.90.85 with HTTP; Fri, 5 Jun 2015 03:29:57 -0700 (PDT) Date: Fri, 5 Jun 2015 12:29:57 +0200 X-Google-Sender-Auth: X3OvcBKJiyvfVxXmwcgq4xs4GDY Message-ID: From: "Christiano F. Haesbaert" To: caml-list@inria.fr Content-Type: text/plain; charset=UTF-8 X-Validation-by: haesbaert@haesbaert.org Subject: [Caml-list] Can't build a target with C stubs using ocamlbuild Hi there, I can't seem to be able to use a C stub in my project, I was following this: http://l-lang.blogspot.de/2012/08/incorporating-c-code-in-ocaml-project.html After I've failed to follow the original documentation, if this is not the correct list for such inquiries please inform me the correct one I'm using OS X 10.10 with opam and compiler 4.02.1 from opam. These are the contents of the files and the attempt at building it, they can also be found at http://haesbaert.org/toto.tar.gz ### toto_c.c ### #include void toto(void) { printf("Hello from C\n"); } ### toto_c.ml ### external toto_a: unit -> unit = "toto";; let toto_b () = toto_a(); toto_a();; ### main.ml ### Toto_c.toto_a();; Toto_c.toto_b();; ## build.sh ## #!/bin/sh ocamlbuild -classic-display toto_c.o ocamlbuild -classic-display -lflags toto_c.o main.native ### building... ### /Users/haesbaert/.opam/4.02.1/bin/ocamldep.opt -modules toto_c.ml > toto_c.ml.depends /Users/haesbaert/.opam/4.02.1/bin/ocamlc.opt -c -o toto_c.cmo toto_c.ml /Users/haesbaert/.opam/4.02.1/bin/ocamlopt.opt -c -o toto_c.cmx toto_c.ml /Users/haesbaert/.opam/4.02.1/bin/ocamldep.opt -modules main.ml > main.ml.depends /Users/haesbaert/.opam/4.02.1/bin/ocamlc.opt -c -o main.cmo main.ml /Users/haesbaert/.opam/4.02.1/bin/ocamlopt.opt -c -o main.cmx main.ml /Users/haesbaert/.opam/4.02.1/bin/ocamlopt.opt toto_c.o toto_c.cmx main.cmx -o main.native + /Users/haesbaert/.opam/4.02.1/bin/ocamlopt.opt toto_c.o toto_c.cmx main.cmx -o main.native Undefined symbols for architecture x86_64: "_toto", referenced from: .L100 in main.o .L100 in toto_c.o .L101 in toto_c.o _camlToto_c__1 in toto_c.o .L100 in toto_c.o .L101 in toto_c.o _camlToto_c__1 in toto_c.o ... (maybe you meant: _camlToto_c__toto_b_1009) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) File "caml_startup", line 1: Error: Error during linking Command exited with code 2.