[redland-dev] Problems with Tcl interface...

Georgios Petasis petasis at iit.demokritos.gr
Thu Mar 25 17:55:34 GMT 2004


----- Original Message ----- 
From: "Dave Beckett" <dave.beckett at bristol.ac.uk>
To: "George Petasis" <petasis at iit.demokritos.gr>;
<redland-dev at lists.librdf.org>
Sent: Thursday, March 25, 2004 1:16 PM
Subject: Re: [redland-dev] Problems with Tcl interface...


> On Sat, 20 Mar 2004 21:01:26 +0200, George Petasis
<petasis at iit.demokritos.gr> wrote:
>
> > I am trying to use the redland package, initially from its
> > Tcl interface. However, something is wrong with the dynamic
> > library. In my system (fedora core 1), the following commands
> > where perfomed to produce the shared library:
>
> Wow, Tcl.  I've not heard much about people using that redland API
> for a while.  I do some minimal testing before shipping releases but
> don't use it myself.

Well, I also posted a relevant question on comp.lang.tcl, but no one seems
to
have used it :-) But if things go well, perhaps more people will use the Tcl
API:-)
I am evaluating redland for possible inclusion into the Ellogon language
engineering
platform (http://www.ellogon.org). I really liked the fact that a lot of
languages
are supported through swig, exactly as Ellogon does :-) We plan to
integrate ontology management support into Ellogon and we are evaluating
available tools to see if they can cover our needs, before we start
re-inventing the wheel.
So far, the only negative point is the lack of support for windows :-)
(but I have red your opinion about this, so I am not asking for it :-))

>
> > gcc -DHAVE_CONFIG_H  -I..    -DLIBRDF_INTERNAL=1 -g  -fPIC -DPIC
> > -I../librdf -I/disk2b/local/include -DUSE_TCL_STUBS Redland_wrap.c -c -o
> > Redland_wrap.so
> > gcc -DLIBRDF_INTERNAL=1 -g -shared Redland_wrap.so -L/disk2b/local/lib
> > -ltclstub8.5
> > -L/disk2b/local/sources/Development/XML/redland-0.9.16/librdf/.libs
> > -lrdf -lcrypto -ldb-4.1 -L/usr/lib/mysql -lmysqlclient -lz -lcrypt -lnsl
> > -lm -L/disk2b/local/sources/Development/XML/redland-0.9.16/raptor/.libs
> > -lraptor -lcurl -L/usr/kerberos/lib -lssl -lcrypto -lgssapi_krb5 -lkrb5
> > -lcom_err -lk5crypto -lresolv -ldl -lz -L/usr/kerberos/lib -lz -lssl
> > -lcrypto -lssl -lcrypto -lgssapi_krb5 -lkrb5 -lcom_err -lk5crypto
> > -lresolv -ldl -lz -lz -L/usr/lib -lxml2 -lz -lpthread -lm -lglib-2.0 -o
> > Redland.so
> > if test `uname` = Darwin; then \
> >   /usr/bin/install -c Redland.so Redland.dylib; \
> > fi
> > touch Redland-stamp
>
> > First of all, the compilation define USE_TCL_STUBS was added by
> > me. Is there any particularly reason its not defined by default?
> > The idea is that you define this symbol, and you link with
> > tclstub<version> instead tcl<version> and you get a shared library
> > that can work in almost all tcl versions. I think such support
> > should exist by default :-)
>
> That define is news to me.  You seem to be using Tcl 8.5 which is
> beyond what I have on several machines here (8.3, 8.4).  Was it
> introduced then?

No, the stubs mechanism exists since 8.1, back in 1997 I think. To my
knowledge,
Tcl is the only language that has this very convinient interface. Once you
link with
stubs enabled, you can run on any system, with any Tcl >= 8.1...
Since I know Tcl fairly well, I can provide a patch that adds stubs support
:-)
Its really easy...

>
>
> > However, the produced shared library cannot be loaded from tcl, due to
> > undefined symbols.
> > Ldd reports on this:
> >
> > ldd -d Redland.so
> >         librdf.so.0 => not found
>
> Er, did you do 'make install'?  That installs librdf.so* into
> the system library directories.  Otherwise you need to set
> LD_LIBRARY_PATH (or DYLD_LIBRARY_PATH OSX) to where librdf.so.*
> lives (in redland/librdf/.libs in the source tree)
>
> It looks like it's intended that librdf.so.0 is installed into
> /disk2b/local/lib
>
> At compile time it finds it because of
>  > -L/disk2b/local/sources/Development/XML/redland-0.9.16/librdf/.libs
>  > -lrdf
>
> but if you then try to run the program, or use ldd without setting
> the run-time library path, you'll get failure.
>
>
> >         libcrypto.so.4 => /lib/libcrypto.so.4 (0x0099e000)
> >         libdb-4.1.so => /usr/lib/tls/libdb-4.1.so (0x00111000)
> >         libmysqlclient.so.10 => /usr/lib/mysql/libmysqlclient.so.10
> > (0x002ce000)
> >         libz.so.1 => /usr/lib/libz.so.1 (0x00712000)
> >         libcrypt.so.1 => /lib/libcrypt.so.1 (0x0041f000)
> >         libnsl.so.1 => /lib/libnsl.so.1 (0x00fd8000)
> >         libm.so.6 => /lib/tls/libm.so.6 (0x00384000)
> >         libraptor.so.1 => not found
> >         libcurl.so.2 => /usr/lib/libcurl.so.2 (0x001d2000)
> >         libssl.so.4 => /lib/libssl.so.4 (0x001fb000)
> >         libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x00230000)
> >         libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x00243000)
> >         libcom_err.so.2 => /lib/libcom_err.so.2 (0x00e11000)
> >         libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x00338000)
> >         libresolv.so.2 => /lib/libresolv.so.2 (0x00530000)
> >         libdl.so.2 => /lib/libdl.so.2 (0x002aa000)
> >         libxml2.so.2 => /usr/lib/libxml2.so.2 (0x00542000)
> >         libpthread.so.0 => /lib/tls/libpthread.so.0 (0x00b3f000)
> >         libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x003a6000)
> >         libc.so.6 => /lib/tls/libc.so.6 (0x00723000)
> >         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x0035d000)
> > undefined symbol: librdf_version_string (./Redland.so)
> > undefined symbol: librdf_version_minor  (./Redland.so)
> > undefined symbol: librdf_version_decimal        (./Redland.so)
> > undefined symbol: librdf_version_release        (./Redland.so)
> > undefined symbol: librdf_copyright_string       (./Redland.so)
> > undefined symbol: librdf_version_major  (./Redland.so)
> > undefined symbol: librdf_short_copyright_string (./Redland.so)
>
> Those are the few external statics refered to in Redland.so, so
> failure to find librdf.so would give that.

I really don't know what is going on :-) This output is
from "ldd -d Redland.so". I am looking inside the redland shared
library. If these symbols are undefined inside the library, they will
not be satisfied even if the library is found.
I don't remember if librdf.so was also built, but it is not mentioned
at all in the ldd output...
I have tried everything, like puting the directory librdf.so
lives in LD_LIBRARY_PATH
or event putting symbolic links in common places, like
/usr/lib. I was never able to load the tcl bindings, as all
symbols (variables & functions) were undefined. I even
preloaded the redland library into the Tcl interpreter, but again
with no results. What is even more strange, is that I linked
the Tcl bindings with the static redland library, and again *all*
the redland library symbols (and raptors I suppose) were undefined.

To my understanding, there is something wrong in the way
the library is linked. I usually use the -fPIC gcc flag,
even during linking (which is missing from the way
redland is build). It is possible that this is the cause for all
these. I will test it and report if it solves the problem :-)
I finally managed to get the bindings
to load in Tcl, but I link to the object files directly
(by placing all the *.o files instead of the libraries).

>
> > The library was created by:
> > gcc -shared  .libs/rdf_init.o .libs/rdf_uri.o .libs/rdf_node.o
> > .libs/rdf_statement.o .libs/rdf_digest.o .libs/rdf_hash.o
> > .libs/rdf_hash_cursor.o .libs/rdf_hash_memory.o .libs/rdf_model.o
> > .libs/rdf_model_storage.o .libs/rdf_iterator.o .libs/rdf_concepts.o
> > .libs/rdf_list.o .libs/rdf_storage.o .libs/rdf_storage_list.o
> > .libs/rdf_storage_hashes.o .libs/rdf_storage_file.o .libs/rdf_stream.o
> > .libs/rdf_parser.o .libs/rdf_heuristics.o .libs/rdf_files.o
> > .libs/rdf_utf8.o .libs/rdf_query.o .libs/rdf_query_triples.o
> > .libs/rdf_serializer.o .libs/rdf_serializer_raptor.o
> > .libs/rdf_serializer_rdfxml.o .libs/rdf_digest_openssl.o
> > .libs/rdf_hash_bdb.o .libs/rdf_parser_raptor.o
> > .libs/rdf_storage_mysql.o  -Wl,--rpath
> > -Wl,/disk2b/local/sources/Development/XML/redland-0.9.16/raptor/.libs
> > -Wl,--rpath -Wl,/disk2b/local/redland/lib -L/usr/lib -L/usr/kerberos/lib
> > -lcrypto /usr/lib/libdb-4.1.so -L/usr/lib/mysql -lmysqlclient -lz
> > -lcrypt -lnsl -lm ../raptor/.libs/libraptor.so  -Wl,-soname
> > -Wl,librdf.so.0 -o .libs/librdf.so.0.0.0
> >
> > ar cru .libs/librdf.a  rdf_init.o rdf_uri.o rdf_node.o rdf_statement.o
> > rdf_digest.o rdf_hash.o rdf_hash_cursor.o rdf_hash_memory.o rdf_model.o
> > rdf_model_storage.o rdf_iterator.o rdf_concepts.o rdf_list.o
> > rdf_storage.o rdf_storage_list.o rdf_storage_hashes.o rdf_storage_file.o
> > rdf_stream.o rdf_parser.o rdf_heuristics.o rdf_files.o rdf_utf8.o
> > rdf_query.o rdf_query_triples.o rdf_serializer.o rdf_serializer_raptor.o
> > rdf_serializer_rdfxml.o rdf_digest_openssl.o rdf_hash_bdb.o
> > rdf_parser_raptor.o rdf_storage_mysql.o
> > ranlib .libs/librdf.a
> > creating librdf.la
> >
> > which seems quite right. Any ideas?
> > (The symbols exist in .libs/rdf_init.o but not in the library?)
>
> That builds librdf.so in the librdf/.libs directory, not in your
> search path.
>
> The symbols should be in librdf.so in the above directory.

The problem is that the symbols are not in the library, as I explained
for the output of ldd above. It would be interesting to check if the same
problem occurs also for other bindings. Is there a application that I can
call from the terminal to see if it is working? (or a script in python/perl
that loads redland?)

>
> So in summary:
>   cd <root of source tree>
> (as root)
>   # make install
> then
>   cd tcl
>   make check
>
> that should work a bit better.

If you exclude "make check", I have already done the rest...

Regards,

George





More information about the redland-dev mailing list