Subject: libtool dlopen [WAS: Guile and Readline won't play together]
From: Jan Nieuwenhuizen <[email-masked]>
To: [email-masked]
Date: Tue, 16 Jul 2002 00:46:48 +0200

"Robert Collins" <[email-masked]> writes:

> WAG time. Perhaps libtool is looking for the .la file via libtldl. As for
> the segfault, no idea. I'll hazard a guess that no change will occur with
> your rebuild though.

Indeed.  No change did occur.  However, rebuilding cygltdl-3.dll from
CVS, gives me:

    $ guile
    ERROR: In procedure dynamic-link:
    ERROR: file: "libguilereadline", message: "file not found"

Not found eh?  So what about:

    $ guile -c '(write (dynamic-link "/usr/lib/libguilereadline.la"))'
    #<dynamic-object "/usr/lib/libguilereadline.la">

Ah, strange that we need to provide the full path, but looks nice.

Looking at readline.scm:

    (if (not (feature? 'readline))
    (dynamic-call "scm_init_readline" (dynamic-link "libguilereadline")))

(if (not (feature? 'readline))
    (scm-error 'misc-error
               #f
               "readline is not provided in this Guile installation"
               '()
               '()))

and changing the dynamic-link statement to:

    (dynamic-call "scm_init_readline" (dynamic-link "/usr/lib/libguilereadline.la")))

sadly gives:

    guile
    ERROR: readline is not provided in this Guile installation

I compiled guile and libtool with debugging info, and ran guile under
gdb.  It seems to dlopen, but no symbols get defined:

    $ gdb -nw /usr/bin/guile.exe
    (gdb) dir libguile
    Source directories searched: /usr/src/guile-1.5.6-4/libguile:$cdir:$cwd
    (gdb) b main      
    Breakpoint 1 at 0x401072: file /home/cygwin/netrel/src/guile-1.5.6-4/libguile/guile.c, line 88.
    (gdb) r
    Starting program: /usr/bin/guile.exe 

    Breakpoint 1, main (argc=1, argv=0x10192810)
        at /home/cygwin/netrel/src/guile-1.5.6-4/libguile/guile.c:88
    88	{
    (gdb) b scm_error
    Breakpoint 2 at 0x1000ccb0: file /home/cygwin/netrel/src/guile-1.5.6-4/libguile/error.c, line 79.
    (gdb) c
    Continuing.
    guile> (dynamic-link "/usr/lib/libguilereadline.la")
    #<dynamic-object "/usr/lib/libguilereadline.la">
    guile> (error)

    Breakpoint 2, scm_error (key=0x101a2ec0, subr=0x0, message=0x101e7410 "?", 
        args=0x2174, rest=0x2174)
        at /home/cygwin/netrel/src/guile-1.5.6-4/libguile/error.c:79
    79	  if (scm_gc_running_p)

    (gdb) p rl_<TAB><TAB> ...

Doing the very same under Linux, shows the readline rl_* functions,
after the linking.

Any clues as to how to proceed?

Jan.

-- 
Jan Nieuwenhuizen <[email-masked]> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/