Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Bernhard Schommer <bernhardschommer@gmail.com>
To: "Christoph Höger" <christoph.hoeger@celeraone.com>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Manually linking generated native code
Date: Thu, 19 Jan 2017 11:05:11 +0100	[thread overview]
Message-ID: <CAG8G+nsMu1jH1WV8ii+i5Zb=K+ZcWJhvEtdu1f=JuuGvCRU2sg@mail.gmail.com> (raw)
In-Reply-To: <CAOazmvss9i2izHxjuZgJeF+2csRUva7=TMcLWKno_8UOYusCJA@mail.gmail.com>

Hi,

you might want to use the -verbose switch to get the actual output of
the linker call. For me it is:
clang  -o 'a.out'   '-L$(ocamlc -where)'  'a.out.startup.s' '$(ocamlc
-where)/std_exit.o' 'test.s' '$(ocamlc -where)/stdlib.a' '$(ocamlc
-where)/libasmrun.a' -lm  -ldl

Best,
-Bernhard

2017-01-19 10:44 GMT+01:00 Christoph Höger <christoph.hoeger@celeraone.com>:
> Dear all,
>
> consider a simple test program:
>
>   let _ = Printf.printf "Hello world!\n"
>
> I can generate the relevant assembly just fine, e.g.:
>
> ocamlopt -dstartup -S test.ml
> gcc -c a.out.startup.s -c
>
> But I cannot link it:
>
> gcc a.out.startup.o -L$(ocamlc -where) -lasmrun_shared
> ....
> a.out.startup.o(.data+0x6e8): error: undefined reference to
> 'camlStd_exit__frametable'
> collect2: Fehler: ld gab 1 als Ende-Status zurück
> distcc[9960] ERROR: compile (null) on localhost failed
>
> It seems that the whole Pervasives is missing (which is kind of expected).
>
> How do I link it, manually? Where are the relevant object files?
>
> thanks,
>
> Christoph
>

  reply	other threads:[~2017-01-19 10:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-19  9:44 Christoph Höger
2017-01-19 10:05 ` Bernhard Schommer [this message]
2017-01-19 12:11 ` Gerd Stolpmann
2017-01-19 12:24   ` Christoph Höger
2017-01-19 13:10     ` Gerd Stolpmann

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='CAG8G+nsMu1jH1WV8ii+i5Zb=K+ZcWJhvEtdu1f=JuuGvCRU2sg@mail.gmail.com' \
    --to=bernhardschommer@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=christoph.hoeger@celeraone.com \
    /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