From: Rob Browning <rlb@defaultvalue.org>
Cc: guile-user@gnu.org, guile-devel@gnu.org
Subject: Re: static linking
Date: Thu, 05 Feb 2004 20:23:06 -0600 [thread overview]
Message-ID: <87y8rhosj9.fsf@raven.i.defaultvalue.org> (raw)
In-Reply-To: <200401150550.i0F5orkj005242@pc18.math.umbc.edu> (Rouben Rostamian's message of "Thu, 15 Jan 2004 00:50:53 -0500")
[cc'ing guile-devel too]
"Rouben Rostamian" <rostamian@umbc.edu> 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
next parent reply other threads:[~2004-02-06 2:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200401150550.i0F5orkj005242@pc18.math.umbc.edu>
2004-02-06 2:23 ` Rob Browning [this message]
2004-02-12 23:39 ` static linking Marius Vollmer
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
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y8rhosj9.fsf@raven.i.defaultvalue.org \
--to=rlb@defaultvalue.org \
--cc=guile-devel@gnu.org \
--cc=guile-user@gnu.org \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).