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 8CD1380125 for ; Tue, 2 May 2017 22:40:12 +0200 (CEST) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=aziem@chawdhary.co.uk; spf=Neutral smtp.mailfrom=aziem@chawdhary.co.uk; spf=None smtp.helo=postmaster@mail-wr0-f176.google.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of aziem@chawdhary.co.uk) identity=pra; client-ip=209.85.128.176; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="aziem@chawdhary.co.uk"; x-sender="aziem@chawdhary.co.uk"; x-conformance=sidf_compatible Received-SPF: Neutral (mail3-smtp-sop.national.inria.fr: domain of aziem@chawdhary.co.uk does not assert whether or not 209.85.128.176 is permitted sender) identity=mailfrom; client-ip=209.85.128.176; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="aziem@chawdhary.co.uk"; x-sender="aziem@chawdhary.co.uk"; 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-wr0-f176.google.com) identity=helo; client-ip=209.85.128.176; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="aziem@chawdhary.co.uk"; x-sender="postmaster@mail-wr0-f176.google.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3ARckwEhT7L5avTDy2F3OPc/U1XNpsv+yvbD5Q0YIu?= =?us-ascii?q?jvd0So/mwa6yZBSN2/xhgRfzUJnB7Loc0qyN4vymATRIyK3CmUhKSIZLWR4BhJ?= =?us-ascii?q?detC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TW94jEIBxrwKxd+?= =?us-ascii?q?KPjrFY7OlcS30P2594HObwlSijewZbx/IA+qoQnNq8IbnZZsJqEtxxXTv3BGYf?= =?us-ascii?q?5WxWRmJVKSmxbz+MK994N9/ipTpvws6ddOXb31cKokQ7NYCi8mM30u683wqRbD?= =?us-ascii?q?VwqP6WACXWgQjxFFHhLK7BD+Xpf2ryv6qu9w0zSUMMHqUbw5Xymp4qF2QxHqlS?= =?us-ascii?q?gHLSY08G/ZhcJwkqxVvRCuqRJ8zYHbfI6bO+Fzfr/ecN4AWWZNQtxcWi5HD4ih?= =?us-ascii?q?b4UPFe0BPeNAooThploOrAWxBQyxD+7xyj9HnHH30rA60+s7CwHH3BErEtUUv3?= =?us-ascii?q?XVrdX6KqISXPupw6nI1zrCYe5Z2Tfn54jSchEtu+2DXbVqfcrMykkiDgXIhUie?= =?us-ascii?q?p4ziOjOazOUNs26D4upvVOKvl24nqxxqrTS12sgsjYzJi4QIwV7H7SV02Jg5Kc?= =?us-ascii?q?G8RUJhYtOpEIFcuzyEO4Z1WM8uXmNltScixrAFpZK3ZjYGxIojyhLFdfCKfYuF?= =?us-ascii?q?7gjjWeqPJzpzmWhrd6ilhxmo9Eit0u38Wdew0FZNtidFl8PDtnEJ1xDK5MmHUO?= =?us-ascii?q?dx8l6v2TqS1Q3e6/tIIU8zlarcJJ4hxqA/moAPvkTEGy/6gET2jKmIeUU44uWk?= =?us-ascii?q?9fjrb7H8qpKfN4J4kBzyProtl8ClHOg1MAkDU3Ce+eum1b3j+UP5QK9Njv0ziq?= =?us-ascii?q?TWqpHbJcUFqa68GAJazoYj5AyxDji70NQXh2MHLVJfdB2biIjlIUzOIPPgAfel?= =?us-ascii?q?n1usiCtrx+zBPrD5HprCNH3DkLP4cbZ56k5c0xYzwMtE55NUD7EBOOj8VlXwtN?= =?us-ascii?q?zeFB85Mha7z/zpCNVnhcsiXjemBqKJPbKanFCP/OUxa72BYIIepCzwJNAh5uXy?= =?us-ascii?q?y2UkzwwzZ66siLIFaX29Vt9mKlqVYXP2k59VGHULsw8WR+zjl1GCWCRCIX21Gb?= =?us-ascii?q?8/sGJoQLm6BJvOE9j+yIeK2z22S8Vb?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0AWAgAJ7ghZf7CAVdFcHAEBBAEBCgEBF?= =?us-ascii?q?wEBBAEBCgEBhAyBDINoihhzkFyVboIPLoUsSgKEUD8YAQEBAQEBAQEBAQESAQE?= =?us-ascii?q?JCwsIJjFCDgGBYiCCQwECAgEjDwENAQE3AQQLCQIODAIFIQICDwEkAQUBHAYTi?= =?us-ascii?q?gYDDQgECpI9kRo/ix1rgiaDCQEBBYgSAQEBAQEBAQEBAQEBAQEBARoDBQkBCHm?= =?us-ascii?q?DRIcJh2mCX51ZhxuDMokwiX+Gc5JpM4EVH4FCTjIERIRigg91AQR4iAwBAQE?= X-IPAS-Result: =?us-ascii?q?A0AWAgAJ7ghZf7CAVdFcHAEBBAEBCgEBFwEBBAEBCgEBhAy?= =?us-ascii?q?BDINoihhzkFyVboIPLoUsSgKEUD8YAQEBAQEBAQEBAQESAQEJCwsIJjFCDgGBY?= =?us-ascii?q?iCCQwECAgEjDwENAQE3AQQLCQIODAIFIQICDwEkAQUBHAYTigYDDQgECpI9kRo?= =?us-ascii?q?/ix1rgiaDCQEBBYgSAQEBAQEBAQEBAQEBAQEBARoDBQkBCHmDRIcJh2mCX51Zh?= =?us-ascii?q?xuDMokwiX+Gc5JpM4EVH4FCTjIERIRigg91AQR4iAwBAQE?= X-IronPort-AV: E=Sophos;i="5.38,281,1491256800"; d="scan'208";a="222213354" Received: from mail-wr0-f176.google.com ([209.85.128.176]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 02 May 2017 22:40:11 +0200 Received: by mail-wr0-f176.google.com with SMTP id l9so91008175wre.1 for ; Tue, 02 May 2017 13:40:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chawdhary-co-uk.20150623.gappssmtp.com; s=20150623; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version:content-transfer-encoding; bh=vMOxWb346rQPfv22NgEXGZRVNXg+zfl42iM07KEl0CU=; b=b3RjBbIbs7YkGn0jm4VSOFS0mOsY/HxDBBZ3ociywCs92nm5p+46oF+1ww1gkVv6Xq jq1hkliVs+rTvLI3Z/7GU+iAJkWBh7B8abA0Sl0XyTbJ/G+AsspBnq01rXnY7+itel7Q VO3fpi8X0uSDsIax2YBLv2nBycqmfHefHaMMGRAt434VDid/1Ly09fv0sbankjccXHqr livDEoDwB+Q6OjQ+5o+9LLIO4OPiAz2rQ1pBvjp36fFciX0TB9fuPhHU4yQ8htGarLH0 kLbme6zIZRgLIqGAfcmZ8re1NkrZ7trR8q3K5RNL5aQA1znuR2na3Ab+iqIrjzOIUZLl ZsQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version:content-transfer-encoding; bh=vMOxWb346rQPfv22NgEXGZRVNXg+zfl42iM07KEl0CU=; b=Y2FfdXtnJL5Jf4Iq+eEiGkXNYlI9oebzq4hPLg2tKiukPRAAbyT89OENmOKFFRHLbN hW062bP3uFTGTxWW6/X1mbBtn7AgW5M0nIL2fvEGwXmXahY2/B1HB02KC0tE5WgMfkzz 40+0J/FcN0MK6Y/tPzok36esEN7kTjhkvAJFk/QQW4FlBmKfpUTJBJ28npH8j3GDEtiE zvCltYRtif9hiEj9uuuxh1cQZOH0iy0zMtJhNTT4ajLd9e9MSR6UPONCNPb6YLDT3PY/ 9iulwFBiNXyNXTOuxIOC9Sfr1rhziK4ZlsK/pStzgUsoITDV9xL6A8c0I+YCYCxbVSFw AOnA== X-Gm-Message-State: AN3rC/5Psc78AgpJhQ+pwt96rvXaySuqRtNgdO5ZvNi6pLAQz4ZWOdhN PV1sOUQtLOfPSjdqNdA= X-Received: by 10.223.164.65 with SMTP id e1mr19844979wra.21.1493757610923; Tue, 02 May 2017 13:40:10 -0700 (PDT) Received: from localhost (aziem.plus.com. [80.229.238.52]) by smtp.gmail.com with ESMTPSA id w68sm22216757wrb.49.2017.05.02.13.40.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 May 2017 13:40:10 -0700 (PDT) References: <1493749167.777759387@f198.i.mail.ru> <87ziev3vop.fsf@aziem-ThinkPad-X230> <1493755180.672071950@f413.i.mail.ru> User-agent: mu4e 0.9.16; emacs 26.0.50 From: Aziem Chawdhary To: Alexey Egorov Cc: caml-list In-reply-to: <1493755180.672071950@f413.i.mail.ru> Date: Tue, 02 May 2017 21:40:09 +0100 Message-ID: <87y3uf3sd2.fsf@aziem-ThinkPad-X230> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Caml-list] Linking with zlib on ubuntu When using ocamlbuild, I find it much easier to pass things like linker flags via tags, rather than passing it via the command line, as mentioned in the ocamlbuild manual: https://github.com/ocaml/ocamlbuild/blob/master/manual/manual.adoc#tags-and-the-code-_tags-code-file As a side-note, for building mixed C/OCaml projects, I highly recommend looking at OCaml-Ctypes (https://github.com/ocamllabs/ocaml-ctypes): it has really made interfacing OCaml with C much more pleasant in my experience. Hope that helps! Aziem Alexey Egorov writes: > Thanks, it solves the problem! > > Unfortunately, ocamlbuild adds lflags at the beggining of ocamlopt invocation, so a little hacking required to make it work. > > >>Среда, 3 мая 2017, 0:28 +05:00 от Aziem Chawdhary : >> >> >>I think the linker flag is in the wrong place. So (from the >>github gist), instead of doing: >> >>ocamlopt -cclib -lz main.cmx test.o -o binary >> >>do the following: >> >>ocamlopt test.o -cclib -lz main.cmx -o binary >> >>This passes the linker flags to gcc in the correct order (i.e -lz before >>test.o). You can see the gcc commands invoked by adding the -verbose option >>to ocamlopt. >> >> >>Thanks, >>Aziem >> >> >>Alexey Egorov < electreg@list.ru > writes: >> >>> Hello, >>> >>> I'm trying to create mixed OCaml + C binary and got strange linker errors: https://gist.github.com/anonymous/cc2b69c9e86ff2213e03f59a1ac5494b >>> I have zlib1g-dev installed and linking pure C executable with gcc is working. >>> Also I have no problem compiling this example on Centos 7. >>> >>> Any suggestions? >>> Thanks. >> >> >>-- --