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

Dave Beckett dave.beckett at bristol.ac.uk
Thu Mar 25 11:16:56 GMT 2004


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.

> 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?


> 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.

> 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.

So in summary:
  cd <root of source tree>
(as root)
  # make install
then
  cd tcl
  make check

that should work a bit better. 

Dave





More information about the redland-dev mailing list