* [Caml-list] OASIS: linking with C library fails
@ 2012-12-19 19:27 Marek Kubica
2012-12-19 19:38 ` Marek Kubica
0 siblings, 1 reply; 2+ messages in thread
From: Marek Kubica @ 2012-12-19 19:27 UTC (permalink / raw)
To: caml-list
Hi,
I have got this simple example where I try to call a C funtion from
libarchive (yes, I am aware of ocaml-archive):
https://gist.github.com/c52d47cff10e4fe8af33
launcher.ml includes Archive.ml which wraps the C file Archive_stubs.c
which calls libarchive.
Unfortunately, I get an error when I try to build it, it boils down to
this:
src/launch.o: In function `camlLaunch__entry':
/home/marek/ostreamer/_build/src/launch.ml:3: undefined reference to
`ost_version_number'
src/Archive.o: In function `camlArchive':
(.data+0x10): undefined reference to `ost_version_number'
collect2: error: ld returned 1 exit status
File "caml_startup", line 1:
Error: Error during linking
Command exited with code 2.
You can see the complete output (after ocaml setup.ml -clean) in the
Gist. Now I wonder how to fix it? From what I see, Archive_stubs.c gets
compiled to an .o file properly but linking fails as it doesn't seem to
get linked to the library. What am I missing?
regards,
Marek
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Caml-list] OASIS: linking with C library fails
2012-12-19 19:27 [Caml-list] OASIS: linking with C library fails Marek Kubica
@ 2012-12-19 19:38 ` Marek Kubica
0 siblings, 0 replies; 2+ messages in thread
From: Marek Kubica @ 2012-12-19 19:38 UTC (permalink / raw)
To: caml-list
On Wed, 19 Dec 2012 20:27:28 +0100
Marek Kubica <marek@xivilization.net> wrote:
> You can see the complete output (after ocaml setup.ml -clean) in the
> Gist. Now I wonder how to fix it? From what I see, Archive_stubs.c
> gets compiled to an .o file properly but linking fails as it doesn't
> seem to get linked to the library. What am I missing?
Alright, I figured it out thanks to adrien @ #ocaml: I don't have a
dependency on ost, so it never links the stuff together.
So I stared at ocaml-archive's _oasis file for a bit and figured I try
adding a
BuildDepends: ost
line in the executable declaration. Lo and behold, it works!
So uhm, thanks for listening :)
regards,
Marek
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-12-19 19:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-19 19:27 [Caml-list] OASIS: linking with C library fails Marek Kubica
2012-12-19 19:38 ` Marek Kubica
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).