From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Rob Browning Newsgroups: gmane.lisp.guile.devel,gmane.lisp.guile.user Subject: Re: static linking Date: Thu, 05 Feb 2004 20:23:06 -0600 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <87y8rhosj9.fsf@raven.i.defaultvalue.org> References: <200401150550.i0F5orkj005242@pc18.math.umbc.edu> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1076034315 13618 80.91.224.253 (6 Feb 2004 02:25:15 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 6 Feb 2004 02:25:15 +0000 (UTC) Cc: guile-user@gnu.org, guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Feb 06 03:25:05 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Aovg1-0006eq-00 for ; Fri, 06 Feb 2004 03:25:05 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1Aovex-00067P-HQ for guile-devel@m.gmane.org; Thu, 05 Feb 2004 21:23:59 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1Aovei-00064F-2w for guile-devel@gnu.org; Thu, 05 Feb 2004 21:23:44 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1Aove9-0005dB-7u for guile-devel@gnu.org; Thu, 05 Feb 2004 21:23:41 -0500 Original-Received: from [66.93.216.237] (helo=defaultvalue.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1Aove8-0005cm-Nm; Thu, 05 Feb 2004 21:23:08 -0500 Original-Received: from raven.i.defaultvalue.org (raven.i.defaultvalue.org [192.168.1.7]) by defaultvalue.org (Postfix) with ESMTP id C2C394037; Thu, 5 Feb 2004 20:23:06 -0600 (CST) Original-Received: by raven.i.defaultvalue.org (Postfix, from userid 1000) id 8615F81125; Thu, 5 Feb 2004 20:23:06 -0600 (CST) Original-To: "Rouben Rostamian" In-Reply-To: <200401150550.i0F5orkj005242@pc18.math.umbc.edu> (Rouben Rostamian's message of "Thu, 15 Jan 2004 00:50:53 -0500") User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Developers list for Guile, the GNU extensibility library List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:3346 gmane.lisp.guile.user:2763 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:3346 [cc'ing guile-devel too] "Rouben Rostamian" writes: > However, I wish to link against Guile's static libraries. > To that end, I do: > > gcc try.c libguile.a libguile-ltdl.a -lcrypt -ldl -lm > which also compiles successfully and produces an executable a.out. > The trouble is, a.out does not run: > > linux> ./a.out > Segmentation fault (core dumped) First question -- what system are you running on and where did your guile libs come from? i.e. Debian unstable, Debian stable, home built, some other dist, etc. For me, doing the same compile, but using the installed libs via -static won't link at all. $ gcc -static try.c -lguile -lguile-ltdl -lcrypt -ldl -lm ...(many link errors)... : undefined reference to `qt_block' /usr/lib/gcc-lib/i486-linux/3.3.3/../../../libguile.a(threads.o) (.text+0xa24):In function `coop_yield': : undefined reference to `qt_block' if I use $(guile-config link), I get closer: gcc -static try.c $(guile-config compile) $(guile-config link) but I still have undefined ltdl symbols. This looks like a missing link option on our part, i.e. guile-config link says: -lguile -lguile-ltdl -lqthreads -lpthread -lcrypt -lm but actually -lguile and -lguile-ltdl are mutually dependent, so for static linking we really need -lguile -lguile-ltdl -lguile -lqthreads -lpthread -lcrypt -lm this gets things to compile, and *then* I can reproduce your segfault. $ gcc -g -O2 -Wall -Werror -static try.c -lguile -lguile-ltdl -lguile -lqthreads -lpthread -lcrypt -lm -ldl ... (many lines of warnings like this)... : warning: Using 'setservent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking $ ./a.out Segmentation fault $ gdb ./a.out GNU gdb 6.0-debian (gdb) run Starting program: /home/rlb/tmp/a.out Program received signal SIGSEGV, Segmentation fault. 0x00000000 in ?? () Not too friendly. So I don't know what's going on yet, but at least it's reproducable. Also, I'm running Debian unstable, but someone else who was running Debian testing couldn't reproduce the problem. -- Rob Browning rlb @defaultvalue.org and @debian.org; previously @cs.utexas.edu GPG starting 2002-11-03 = 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4 _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel