Subject: Re: pkg/13726: problems w/ perl, mod_perl, and C based perl modules?
To: None <>
From: Johnny Lam <>
List: tech-pkg
Date: 09/22/2001 21:03:51
I'm trying to solve pkg/13726 where using perl modules within Apache with leads to errors with not finding symbols in  On
NetBSD-1.5Y/I386 (ELF), the link command used to create is:

ld --whole-archive -shared  -L/usr/pkg/lib
	mod_perl.lo perlxsi.lo perl_config.lo perl_util.lo perlio.lo
	mod_perl_opmask.lo  Apache.lo Constants.lo ModuleConfig.lo Log.lo
	URI.lo Util.lo Connection.lo Server.lo File.lo Table.lo
	-whole-archive -lgcc -no-whole-archive -E
	-R/usr/pkg/lib -R/usr/pkg/lib/perl5/5.6.1/i386-netbsd/CORE
	-L/usr/pkg/lib -L/usr/pkg/lib/perl5/5.6.1/i386-netbsd/CORE
	-lperl -lm -lcrypt

As you can see, is linked into and the proper
locations are added to's rpath, and -E (-export-dynamic).

The PR fix is to link perl modules against, which is reported
to solve the problem.  The patch included below causes all of the pkgsrc
p5-* modules to automatically link against -lperl.  It should be saved
as lang/perl5/patches/patch-af.

Can anyone confirm that this fixes things?  My knowledge of perl is scant,
and the PR didn't have a test case I could use.  Can anyone see if this
might break normal perl module usage outside of


	-- Johnny Lam <>

--- lib/ExtUtils/	Thu Mar 15 07:25:20 2001
+++ lib/ExtUtils/	Sun Sep  2 16:09:07 2001
@@ -1059,6 +1059,9 @@
     my($ldfrom) = '$(LDFROM)';
     $armaybe = 'ar' if ($^O eq 'dec_osf' and $armaybe eq ':');
+    my($llibperl) = '';
+    $llibperl = '-L$(PERL_INC) -Wl,-R$(INSTALLARCHLIB)/CORE -lperl' if ($^O eq 'netbsd');
+    push(@m,'LLIBPERL = '.$llibperl."\n");
 # This section creates the dynamically loadable $(INST_DYNAMIC)
 # from $(OBJECT) and possibly $(MYEXTLIB).
@@ -1088,7 +1091,7 @@
     push(@m,'	LD_RUN_PATH="$(LD_RUN_PATH)" $(LD) '.$ldrun.' $(LDDLFLAGS) '.$ldfrom.
     push @m, '
 	$(CHMOD) $(PERM_RWX) $@