Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Shaddin Doghmi <shaddin@mitre.org>
To: caml-list@yquem.inria.fr
Subject: static linking problems with readline
Date: Wed, 25 Jan 2006 14:56:06 -0500	[thread overview]
Message-ID: <43D7D7D6.8090203@mitre.org> (raw)

I am having problems trying to statically link readline. Dynamic linking 
is working fine, however. This works:

gcc - -Wall -c readline_wrp_c.c
ocamlc -custom -c readline_wrp_ocaml.mli
ocamlc -custom -c readline_wrp_ocaml.ml
ocamlc -custom -c readline_test.ml
ocamlc -custom -cclib -lreadline -o test_readline readline_wrp_c.o 
readline_wrp_ocaml.cmo readline_test.cmo


but changing the last line to:

ocamlc -custom -ccopt -static -cclib -lreadline -o test_readline 
readline_wrp_c.o readline_wrp_ocaml.cmo readline_test.cmo
or
ocamlc -custom -cclib /usr/lib/libreadline.a -o test_readline 
readline_wrp_c.o readline_wrp_ocaml.cmo readline_test.cmo
or
ocamlc -custom -o test_readline /usr/lib/libreadline.a readline_wrp_c.o 
readline_wrp_ocaml.cmo readline_test.cmo



will give the following error:

/usr/lib/ocaml/3.09.0/libcamlrun.a(unix.o): In function `caml_dlopen': 
warning: Using 'dlopen' in statically linked applications requires at 
runtime the shared libraries from the glibc version used for linking
/usr/lib/ocaml/3.09.0/libcamlrun.a(debugger.o): In function 
`caml_debugger_init': warning: Using 'gethostbyname' in statically 
linked applications requires at runtime the shared libraries from the 
glibc version used for linking
readline_wrp_c.o: In function 
`readline_wrp':readline_wrp_c.c:(.text+0x85): undefined reference to 
`readline'
readline_wrp_c.o: In function 
`add_history_wrp':readline_wrp_c.c:(.text+0x151): undefined reference to 
`add_history'
readline_wrp_c.o: In function 
`write_history_wrp':readline_wrp_c.c:(.text+0x1ad): undefined reference 
to `write_history'
readline_wrp_c.o: In function 
`read_history_wrp':readline_wrp_c.c:(.text+0x209): undefined reference 
to `read_history'
readline_wrp_c.o: In function 
`stifle_history_wrp':readline_wrp_c.c:(.text+0x267): undefined reference 
to `stifle_history'
readline_wrp_c.o: In function 
`readline_set_autocomplete_c':readline_wrp_c.c:(.text+0x3c6): undefined 
reference to `rl_attempted_completion_function'
readline_wrp_c.o: In function 
`completion_function':readline_wrp_c.c:(.text+0x3f6): undefined 
reference to `rl_completion_matches'
collect2: ld returned 1 exit status
Error while building custom runtime system



The functions indicated as having an undefined reference are all 
functions from the readline library libreadline. I got the same behavior 
using ocamlopt as well. Any idea what I am doing wrong?


                 reply	other threads:[~2006-01-25 19:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=43D7D7D6.8090203@mitre.org \
    --to=shaddin@mitre.org \
    --cc=caml-list@yquem.inria.fr \
    /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