Re: [mp1] Linking confusion

[prev] [thread] [next] [Date index for 2004/12/31]

From: Stas Bekman
Subject: Re: [mp1] Linking confusion
Date: 16:35 on 31 Dec 2004
William McKee wrote:
> On Thu, Dec 30, 2004 at 05:57:07PM -0500, Stas Bekman wrote:
> 
>>>During compilation of mod_perl, I was seeing undefined reference errors
>>>which are nicely described on the install page[1]. The prescription
>>>suggests rebuilding Perl with dynamic linking; apparently the version
>>>that's shipped with Debian is not dynamically linked(?). Sounds fine,
>>>but I'm not a C programmer so am not sure exactly what this means.
>>
>>Now that you know what does it take, please send a patch that extends [1] 
>>to explain how to do that.
> 
> 
> I've started working on a patch for the install doc[1] but have come
> across a couple of questions that I'm sure someone on the list could
> answer for me.
> 
>  1) The docs refer to building a "dynamically linked Perl." Shouldn't
>  the Perl be lowercase since we're talking about the interpreter, not
>  the language?

+1

>  2) In the same sentence, it says that a dynamically linked perl will
>  have a libperl.a. Isn't that a libperl.so? 

You are correct.

> Could someone describe the
>  differences between libperl.a and libperl.so? 

libfoo.a is an archive used at linking time - it's completely included in 
the final application that linked it.

libperl.so is a shared library. At the linking time the application only 
knows which library it wants. Only at the loading time (runtime) that 
library will be loaded.

One of the benefits of using a shared library, is that only it's loaded by 
one application, any other application using the same library will not 
need load it, it'll be shared (a service provided by the kernel). In the 
case of static libfoo.a, it'll be loaded as many times as there are 
applications that included it, thus consuming more memory. Of course this 
is not the only benefit of using shared libs.

> I see that it exists in
>  the apache source directory which makes me think it is used when
>  building modperl. If I'm building mp statically linked, I shouldn't
>  need libperl.a after I've installed, right? Is this the library that
>  has been more appropriately named modperl.a in MP2?

Yes, that's the result of the unfortunate naming scheme in Apache 1.3. So 
you have libperl.(so|a) which is perl, and you have libperl.(so|a) which 
is modperl. You are certainly looking at the modperl version of libperl.a 
if you find it in the apache directory. perl's libperl.(so|a) lives under
something like 5.8.6/i686-linux/CORE/

And yes, mp2's lib is mod_perl.(so|a).

> [1] http://perl.apache.org/docs/1.0/guide/install.html#Undefined_reference_to__PL_perl_destruct_level_
> 


        -- 
        __________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@xxxxxx.xxx http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

(message missing)

[mp1] Linking confusion
William McKee 20:53 on 30 Dec 2004

Re: [mp1] Linking confusion
Stas Bekman 22:57 on 30 Dec 2004

Re: [mp1] Linking confusion
William McKee 23:56 on 30 Dec 2004

Re: [mp1] Linking confusion
Stas Bekman 00:00 on 31 Dec 2004

Re: [mp1] Linking confusion
William McKee 00:28 on 31 Dec 2004

Re: [mp1] Linking confusion
Stas Bekman 00:32 on 31 Dec 2004

Re: [mp1] Linking confusion
William McKee 15:48 on 31 Dec 2004

Re: [mp1] Linking confusion
Stas Bekman 16:35 on 31 Dec 2004

Re: [mp1] Linking confusion
William McKee 17:01 on 31 Dec 2004

Re: [mp1] Linking confusion
Stas Bekman 19:02 on 31 Dec 2004

Re: [mp1] Linking confusion
William McKee 04:46 on 31 Dec 2004

Re: [mp1] Linking confusion
Michael Robinton 21:14 on 01 Jan 2005

Re: [mp1] Linking confusion
William McKee 20:08 on 31 Dec 2004

Re: [mp1] Linking confusion
Stas Bekman 21:06 on 31 Dec 2004

Generated at 12:16 on 16 Jan 2005 by mariachi v0.52