* Re: static linking
[not found] <200401150550.i0F5orkj005242@pc18.math.umbc.edu>
@ 2004-02-06 2:23 ` Rob Browning
2004-02-12 23:39 ` Marius Vollmer
0 siblings, 1 reply; 2+ messages in thread
From: Rob Browning @ 2004-02-06 2:23 UTC (permalink / raw)
Cc: guile-user, guile-devel
[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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: static linking
2004-02-06 2:23 ` static linking Rob Browning
@ 2004-02-12 23:39 ` Marius Vollmer
0 siblings, 0 replies; 2+ messages in thread
From: Marius Vollmer @ 2004-02-12 23:39 UTC (permalink / raw)
Cc: guile-user, guile-devel
Rob Browning <rlb@defaultvalue.org> writes:
> So I don't know what's going on yet, but at least it's reproducable.
I can't reproduce it. The resulting statically linked a.out cannot
load shared libraries (so that for example libguilereadline doesn't
work), tho. No segfaults happen, howevers.
$ ldd a.out
not a dynamic executable
$ ./a.out
ERROR: In procedure dynamic-link:
ERROR: file: "libguilereadline-v-12", message: "/usr/local/lib/libguilereadline-v-12.a: invalid ELF header"
$ ./a.out -q
guile>
--
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-02-12 23:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <200401150550.i0F5orkj005242@pc18.math.umbc.edu>
2004-02-06 2:23 ` static linking Rob Browning
2004-02-12 23:39 ` Marius Vollmer
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).