On Thursday 29 May 2008 22:40:11 Brian Bevins wrote: > Hi Jeff, > > I'm pretty sure stubs aren't the problem since neither BLT nor the perl > Tcl module are compiled against the stub libraries. They are compiled > against exactly the same version of libtcl8.4.so. > > When I examine the perl Tcl module library, I see a dependence on > libtcl8.4.so: > > ldd > <blah>/perl/5.8.2/lib/site_perl/5.8.2/i686-linux-thread-multi/auto/Tcl/Tcl. >so libtcl8.4.so => <blah>/tcl/8.4/lib/libtcl8.4.so (0x00b62000) libc.so.6 => > /lib/tls/libc.so.6 (0x00577000) > libdl.so.2 => /lib/libdl.so.2 (0x00e83000) > libpthread.so.0 => /lib/tls/libpthread.so.0 (0x00708000) > libm.so.6 => /lib/tls/libm.so.6 (0x00144000) > /lib/ld-linux.so.2 (0x00785000) > > So as I understand it, when perl loads Tcl.so, that should force the > dynamic loader to also load libtcl8.4.so. When I look at our BLT library: > > ldd <blah>/tcl/8.4/lib/libBLT24.so > libc.so.6 => /lib/tls/libc.so.6 (0x0050d000) > /lib/ld-linux.so.2 (0x00785000) > > It does not show any dependence on libtcl8.4.so (but I am certain that > this is the version of Tcl against which it was compiled). > > However, when perl tries to load BLT inside the Tcl module, there are > unresolved symbols. This script: > > #!<blah>/perl/5.8.2/bin/perl > use Tcl::Tk; > my $m = Tcl::Tk::MainWindow->new(); > my $i = $m->interp(); > $i->Eval('package require BLT'); > > gives this error: > > ERROR: couldn't load file "<blah>/tcl/8.4/lib/libBLT24.so": > <blah>/tcl/8.4/lib/libBLT24.so: undefined symbol: TclpRealloc > > If I use just Tcl rather than Tcl::Tk I get the same error. The missing > symbol TclpRealloc is found in libtcl8.4.so: > > nm <blah>/tcl/8.4/lib/libtcl8.4.so | grep TclpRealloc > 0007ade8 T TclpRealloc > > So my conclusion is that libBLT24.so needs to have libtcl8.4.so loaded > even though it doesn't ask for it explicitly. Perl should be loading > libtcl8.4.so since it is asked for by perl's Tcl.so. However, for some > reason when I "use Tcl" from perl, libtcl8.4.so does not get loaded, and > hence it is not there when libBLT24.so needs it. > > I think this confirmed by the fact that everything works if I force the > loading of libtcl8.4.so like so: > > #!<blah>/perl/5.8.2/bin/perl > use Tcl::Tk; > my $m = Tcl::Tk::MainWindow->new();
IMO at the moment of this line both libtcl84.so and libtk84.so already loaded, otherwise you'll get an error. But I think that it is different than /usr/csite/pubtools/tcl/8.4/lib/libtcl8.4.so > my $i = $m->interp(); > $i->Eval('load /usr/csite/pubtools/tcl/8.4/lib/libtcl8.4.so Tcl'); > $i->Eval('package require BLT'); > > Then I get no error. What I don't understand is why I have to do that. > Perl should be loading libtcl8.4.so automatically, but for some reason > it doesn't. I think perl do load libtcl84..., but then you load different libtcl84 library which have another missing symbol, i.e resolving goes okay, but you do get a mess of some kind. You should try isolate your libtcl-s and try to work with only /usr/csite/pubtools/tcl/8.4/lib/libtcl8.4.so one. > Is there any way to get perl to tell me exactly what libraries have been > loaded? In Tcl I would use "info loaded" for this purpose. dynaloader tracks loaded libraries internally, it do not track any shared libraries that were loaded by library that it loaded perl -MTcl::Tk -lwe 'print join " ",keys %{DynaLoader::},";; ",qq/@DynaLoader::dl_shared_objects/' dl_require_symbols dl_error dl_install_xsub dl_modules dl_find_symbol boot_DynaLoader bootstrap dl_undef_symbols isa dl_load_file dl_librefs dl_shared_objects dl_unload_file ;; /opt/perl-5.8.8/lib/site_perl/5.8.8/i686-linux/auto/Tcl/Tcl.so BR, Vadim.