Browse thread
static linking problems with readline
- Shaddin Doghmi
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Shaddin Doghmi <shaddin@m...> |
| Subject: | static linking problems with readline |
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?