caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* static linking problems with readline
@ 2006-01-25 19:56 Shaddin Doghmi
  0 siblings, 0 replies; only message in thread
From: Shaddin Doghmi @ 2006-01-25 19:56 UTC (permalink / raw)
  To: caml-list

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?


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-01-25 19:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-25 19:56 static linking problems with readline Shaddin Doghmi

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).