caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Aziem Chawdhary <aziem@chawdhary.co.uk>
To: Alexey Egorov <electreg@list.ru>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Linking with zlib on ubuntu
Date: Tue, 02 May 2017 20:28:22 +0100	[thread overview]
Message-ID: <87ziev3vop.fsf@aziem-ThinkPad-X230> (raw)
In-Reply-To: <1493749167.777759387@f198.i.mail.ru>


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.


-- 

  reply	other threads:[~2017-05-02 19:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-02 18:19 Alexey Egorov
2017-05-02 19:28 ` Aziem Chawdhary [this message]
2017-05-02 19:59   ` Alexey Egorov
2017-05-02 20:40     ` Aziem Chawdhary

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ziev3vop.fsf@aziem-ThinkPad-X230 \
    --to=aziem@chawdhary.co.uk \
    --cc=caml-list@inria.fr \
    --cc=electreg@list.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).