This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

hobbit problems


Hello!

After at least two days of attempts that still not lead to success I hope
one of you can help me:

I installed guile-hobbit.1.3.1. For some reason, the 'hob' command was not
created the way I would have expected: it did not use the information of
`guile-config link` correctly (see my manual patch for 'hob' below). However,
maybe I messed something up here.

Since I use the latest libtool (1.2b) I had to add further patches to the
'hob' command: libtool does not accept an '-o' option any more with
mode=compile. Further, during linking dynamic libraries have to be prefixed
with 'lib' (at least on our system, which is solaris). According to the
libtool webpage, the 'lib'-prefix issue is out since libtool version 1.1, so
maybe this part of the patch may be of common interest.

diff hob~ hob
87,89c87,88
<   (let* ((o-name (string-append (root-name (pure-name main-name)) ".o"))
<          (lo-name (string-append (root-name (pure-name main-name)) ".lo"))
<          (la-name (string-append (root-name (pure-name main-name)) ".la"))
---
>   (let* ((lo-name (string-append (root-name (pure-name main-name)) ".lo"))
>          (la-name (string-append "lib" (root-name (pure-name main-name)) ".la"))
102c101
<                     CC " " CFLAGS " -o " o-name 
---
>                     CC " " CFLAGS
154c153
<                     CC " " CFLAGS " -o " wrapper-o
---
>                     CC " " CFLAGS
162c161
<                     la-name " -L/automatix/home/dirk/pub/guile-19981109/lib -lguile")))
---
>                     la-name " -L/automatix/home/dirk/pub/guile-19981109/lib -lguile -ldl -lreadline -ltermcap -lsocket -lnsl -lm")))


With this patch applied, calling hob worked for the first time. However,
link.scm in the hobbit4d directory had to be updated as well: The added lib
prefix had to be taken care of here as well:


diff link.scm~ link.scm
153c153,155
<   (let ((dyninfo (%search-load-path (string-append path ".la"))))
---
>   (let* ((dir (dir-name path))
>        (base (pure-name path))
>        (dyninfo (%search-load-path (string-append dir "/lib" base ".la"))))


Finally, there appeared to be a problem with hobbit and 'use-modules': hobbit
does not know that it is a macro and tries to handle it as a function
call. The following patch makes hobbit ignore calls to 'use-modules' during
translation, which means that the loading of the appropriate modules has to be
done by the user, prior to loading the dynamic libraries at run time.


diff guile-hobbit.scm~ guile-hobbit.scm
201c201,202
<                        (eq? 'require (car def)) ))
---
>                        (eq? 'require (car def))
>                        (eq? 'use-modules (car def))))


But now I'm lost: Somehow the init-code that is generated by hobbit destroys
some initial bindings. The following transcript shows what happens to
'cdr' (BTW: my code does not make use of modules except for the two commands 
(use-modules (ice-9 slib)) 
(require 'common-list-functions)
at the very head of the compiled code.)


guile
Reading ~/.guile.
guile> (use-modules (hobbit4d link))
guile> cdr
#<primitive-procedure cdr>
guile> (hobbit-load-from-path "clique-partitioning")
guile> cdr
ERROR: In expression cdr:
ERROR: Unbound variable: cdr
ABORT: (misc-error)


In the headerfiles the following definitions are found:

#define GLOBAL(x) (*(x))
static SCM *H_cdr;
static SCM *H_supergraph_dot_node_dash_vec;


In the .c file, the following accesses to H_cdr and
H_supergraph_dot_node_dash_vec within the initialization functions are
found:


static SCM H_top_actions_clique_dash_partitioning()
{
  ...
  GLOBAL(H_supergraph_dot_node_dash_vec) = GLOBAL(H_cdr);
  ...
}


SCM scm_init_clique_dash_partitioning()
{
  ...
  H_cdr = &SCM_CDR(intern("cdr",3));
  ...
  H_top_actions_clique_dash_partitioning();
}

The function scm_init_clique_dash_partitioning is the function that is called
automatically when (hobbit-load-from-path "clique-partitioning") is
performed.

I looked at the definition of 'intern' and it seems that it returns a pair
(symbol . value), which indicates that &SCM_CDR(intern("cdr",3)) should be the
address of the symbol's value.

Can someone give me a hint what the problem is and how I can get hobbit to
work? Thanks in advance!


Best regards, 
Dirk Herrmann