Subject: ld.so cannot reolve symbol
To: None <current-users@NetBSD.ORG>
From: Andreas Wrede <andreas@planix.com>
List: current-users
Date: 06/06/1998 09:30:21
Since upgrading from 1.3 to -current a couple of weeks ago I have a two
perl applications (pilot-link's sync-plan and p5-tk's tkmib) for which ld.so 
appears to be unable to find some symbols. Compiling a ld.so with DEBUGing 
and turning Perl's dl_debug on shows the following:

$ PERL_DL_DEBUG=4 ktrace /usr/local/bin/perl -w  /usr/local/bin/sync-plan
[snipped some debug output]
DynaLoader::bootstrap for MD5 (auto/MD5/MD5.so)
dl_load_file(/usr/pkg/lib/perl5/site_perl/i386-netbsd/auto/MD5/MD5.so,0): map1: 0x40139000 for 0x3000
 libref=400176c0
dl_find_symbol(handle=400176c0, symbol=_boot_MD5)
  symbolref = 40139664
dl_install_xsub(name=MD5::bootstrap, symref=40139664)
 BINDER: _Perl_newXS located at = 0x400425b0 in /usr/pkg/lib/perl5/i386-netbsd/5.00404/CORE/libperl.so.1.0
DynaLoader::bootstrap for PDA::Pilot (auto/PDA/Pilot/Pilot.so)
dl_load_file(/usr/pkg/lib/perl5/site_perl/i386-netbsd/auto/PDA/Pilot/Pilot.so,0)
:
map1: 0x4013c000 for 0x2f7a8
map1: 0x4016f000 for 0x3553c
/usr/libexec/ld.so: Undefined symbol "_MailSyncTypeNames" in perl:/usr/pkg/lib/perl5/site_perl/i386-netbsd/auto/PDA/Pilot/Pilot.so

The symbol _MailSyncTypeNames is defined here: nm /usr/local/lib/libpisock.so.3.0 |grep _MailSyncTypeName
00015524 D _MailSyncTypeNames

and a ktrace reveals that dlopen accesses the ld.so.hints file and then 
opens and mmaps the correct library before failing to resolve the symbol.

When running tkmib, the unresolved symbol is different (__XInitImageFuncPtrs 
in libX11.so.6.1) but the scenario leading up to the error are similar. In 
both cases the unresolved symbol is needed in a Perl library 
(_MailSyncTypeNames in /usr/pkg/lib/perl5/site_perl/i386-netbsd/auto/PDA/Pilot/Pilot.so,0 
and __XInitImageFuncPtrs in /usr/pkg/lib/perl5/site_perl/i386-netbsd/auto/Tk/Tk.so).

Is anyone else running sync-plan or tkmib on -current?  

BTW, this is on i386/current as of June 3,  with UVM and PMAP_NEW turned on. 
All programs in question (Perl, p5-tk, pilot-link) were build fresh from 
packages in /usr/pkgsrc.

-- 
Andreas Wrede              Planix, Inc.
andreas@planix.com         Networking, System Administration, Consulting
http://www.planix.com      Toronto, Ontario, Canada