From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 23746BBBB for ; Wed, 25 Jan 2006 20:56:55 +0100 (CET) Received: from smtp-bedford-dr.mitre.org (smtpproxy2.mitre.org [192.160.51.65]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k0PJusPn026453 for ; Wed, 25 Jan 2006 20:56:54 +0100 Received: from smtp-bedford-dr.mitre.org (localhost.localdomain [127.0.0.1]) by smtp-bedford-dr.mitre.org (8.11.6/8.11.6) with SMTP id k0PJurM23304 for ; Wed, 25 Jan 2006 14:56:53 -0500 Received: from smtp-bedford-dr.mitre.org (localhost.localdomain [127.0.0.1]) by smtp-bedford-dr.mitre.org (Postfix) with ESMTP id 2D6474F8E1 for ; Wed, 25 Jan 2006 14:56:53 -0500 (EST) Received: from IMCFE1.MITRE.ORG (imcfe1.mitre.org [129.83.29.3]) by smtp-bedford-dr.mitre.org (8.11.6/8.11.6) with ESMTP id k0PJuqn23255 for ; Wed, 25 Jan 2006 14:56:52 -0500 Received: from [129.83.160.61] ([129.83.160.61]) by IMCFE1.MITRE.ORG with Microsoft SMTPSVC(6.0.3790.211); Wed, 25 Jan 2006 14:56:52 -0500 Message-ID: <43D7D7D6.8090203@mitre.org> Date: Wed, 25 Jan 2006 14:56:06 -0500 From: Shaddin Doghmi User-Agent: Debian Thunderbird 1.0.7 (X11/20051017) X-Accept-Language: en-us, en MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: static linking problems with readline Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 25 Jan 2006 19:56:52.0551 (UTC) FILETIME=[7C70ED70:01C621E9] X-Miltered: at nez-perce with ID 43D7D806.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; readline:01 statically:01 readline:01 gcc:01 -wall:01 ocamlc:01 -custom:01 ocaml:01 mli:01 ocamlc:01 -custom:01 ocaml:01 -cclib:01 cmo:01 cmo:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 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?