Loading ...
Sorry, an error occurred while loading the content.
 

Re: [mp1] Linking confusion

Expand Messages
  • William McKee
    ... And ldd is the best tool to use to check the links (at least on Unix)? William -- Knowmad Services Inc. http://www.knowmad.com -- Report problems:
    Message 1 of 14 , Dec 30, 2004
      On Thu, Dec 30, 2004 at 07:32:19PM -0500, Stas Bekman wrote:
      > >Hmm, that's what I thought too and was creating a symlink from
      > >/usr/lib/libperl.so to the newly created one. I was still getting
      > >strange behavior though so moved them all out of /usr/lib. Seems a bit
      > >better now.
      >
      > If the application links against a specific libperl.so.x.y that would
      > explain that behavior.

      And ldd is the best tool to use to check the links (at least on Unix)?


      William

      --
      Knowmad Services Inc.
      http://www.knowmad.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
    • William McKee
      ... 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)
      Message 2 of 14 , Dec 31, 2004
        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?

        2) In the same sentence, it says that a dynamically linked perl will
        have a libperl.a. Isn't that a libperl.so? Could someone describe the
        differences between libperl.a and libperl.so? 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?


        Cheers!
        William

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

        --
        Knowmad Services Inc.
        http://www.knowmad.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
      • Stas Bekman
        ... +1 ... You are correct. ... libfoo.a is an archive used at linking time - it s completely included in the final application that linked it. libperl.so is a
        Message 3 of 14 , Dec 31, 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@... 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
        • William McKee
          Thanks for the clear explanation of *.a and *.so files, Stas. I m starting to grok how it works together. I ve attached the diff to the install docs to this
          Message 4 of 14 , Dec 31, 2004
            Thanks for the clear explanation of *.a and *.so files, Stas. I'm
            starting to grok how it works together.

            I've attached the diff to the install docs to this message which
            incorporates some of your notes about .so and .a files. I found this
            information hard to find while browsing Google, Perlmonks and the
            modperl docs. I hope that you will include them in some form.


            Thanks,
            William

            --
            Knowmad Services Inc.
            http://www.knowmad.com
          • Stas Bekman
            ... Thanks William, I ve committed that with a few tweaks. Especially the last para. Please check that it still makes sense. --
            Message 5 of 14 , Dec 31, 2004
              William McKee wrote:
              > Thanks for the clear explanation of *.a and *.so files, Stas. I'm
              > starting to grok how it works together.
              >
              > I've attached the diff to the install docs to this message which
              > incorporates some of your notes about .so and .a files. I found this
              > information hard to find while browsing Google, Perlmonks and the
              > modperl docs. I hope that you will include them in some form.

              Thanks William, I've committed that with a few tweaks. Especially the last
              para. Please check that it still makes sense.

              --
              __________________________________________________________________
              Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
              http://stason.org/ mod_perl Guide ---> http://perl.apache.org
              mailto:stas@... 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
            • William McKee
              ... Looks fine except for a couple of typos (dangling quote mark and mispelled should ). Also, now that I m a bit more knowledgeable about the subject matter,
              Message 6 of 14 , Dec 31, 2004
                On Fri, Dec 31, 2004 at 02:02:59PM -0500, Stas Bekman wrote:
                > Thanks William, I've committed that with a few tweaks. Especially the last
                > para. Please check that it still makes sense.

                Looks fine except for a couple of typos (dangling quote mark and
                mispelled 'should'). Also, now that I'm a bit more knowledgeable about
                the subject matter, I was able to find this reference[1] in your docs
                which I've added to the attached patch.


                William

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

                --
                Knowmad Services Inc.
                http://www.knowmad.com
              • Stas Bekman
                ... Thanks William, committed. For the future please note that internal links are done like so: Also see L
                Message 7 of 14 , Dec 31, 2004
                  William McKee wrote:
                  > On Fri, Dec 31, 2004 at 02:02:59PM -0500, Stas Bekman wrote:
                  >
                  >>Thanks William, I've committed that with a few tweaks. Especially the last
                  >>para. Please check that it still makes sense.
                  >
                  >
                  > Looks fine except for a couple of typos (dangling quote mark and
                  > mispelled 'should'). Also, now that I'm a bit more knowledgeable about
                  > the subject matter, I was able to find this reference[1] in your docs
                  > which I've added to the attached patch.

                  Thanks William, committed.

                  For the future please note that internal links are done like so:

                  Also see L<libperl.so and
                  libperl.a|docs::1.0::guide::install/libperl_so_and_libperl_a">.

                  I've adjusted that.

                  also your patch was reverted :)

                  --
                  __________________________________________________________________
                  Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
                  http://stason.org/ mod_perl Guide ---> http://perl.apache.org
                  mailto:stas@... 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
                • Michael Robinton
                  ... Try... in apache directory make distclean ./configure --with-layout=Apache then in mod perl source directory Run: perl Makefile.PL
                  Message 8 of 14 , Jan 1, 2005
                    On Thu, 30 Dec 2004, William McKee wrote:

                    > Hi folks,
                    >
                    > I'm trying to recompile Perl and Apache/mod_perl on a Debian Sarge
                    > system using the following versions:
                    >
                    > Perl 5.8.6
                    > Apache 1.3.33
                    > mod_perl 1.29
                    >
                    > I am compiling mod_perl statically (using Apachetoolbox) with the
                    > following options:
                    >
                    > APACHE_PREFIX=/usr/local/apache
                    > APACHE_SRC=/usr/local/src/Apachetoolbox-1.5.72/apache_1.3.33/src
                    > SSL_BASE=
                    > APACI_ARGS='--enable-module=rewrite'
                    > DO_HTTPD=1
                    > USE_APACI=1
                    > EVERYTHING=1
                    >

                    Try...

                    in apache directory

                    make distclean

                    ./configure --with-layout=Apache

                    then

                    in mod perl source directory
                    Run:
                    perl Makefile.PL \
                    APACHE_SRC=/usr/src/apache/src \
                    DO_HTTPD=1 \
                    USE_APACI=1 \
                    PREP_HTTPD=1 \
                    EVERYTHING=1 \

                    make
                    make test # broken ??
                    make install

                    back in apache directory
                    ./configure --with-layout=Apache \
                    --activate-module=src/modules/perl/libperl.a
                    make
                    make install




                    > 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.
                    >
                    > >From what I could find reading the INSTALL document that comes with the
                    > Perl source, I need to recompile with the -Duseshrplib compile-time
                    > option. My understanding is that this option will build a libperl.so
                    > file. Is this correct? Am I taking the right action to build a dynamic
                    > Perl?
                    >
                    > With that option, I am able to compile Apache with mod_perl. Now though,
                    > when starting the newly compiled server, I'm receiving relocation errors
                    > which appear to be due to multiple versions of libperl.so/libperl.a (not
                    > sure which).
                    >
                    > While browsing the net for possible solutions, I came across the
                    > troubleshooting document[2]. It seems to say that if 'perl
                    > -V:useshrplib' returns true, then Perl is statically linked. Is this
                    > correct? It seems opposite of what I'd expect from reading the INSTALL
                    > document.
                    >
                    > I'm pretty much at wits end as to why I'm receiving relocation errors.
                    > The best I can figure is some kind of binary incompatibility between the
                    > version of Perl that I've compiled and previously compiled libraries.
                    > I've tried reinstalling some of the XS modules such as DBI which seems
                    > to clear up these errors.
                    >
                    > Any other suggestions or pointers, esp. in light of the differences
                    > between dynamic and static linking and libperl.so/libperl.a, would be
                    > much appreciated.
                    >
                    >
                    > Thanks,
                    > William
                    >
                    > [1] http://perl.apache.org/docs/1.0/guide/install.html#Undefined_reference_to__PL_perl_destruct_level_
                    > [2] http://perl.apache.org/docs/1.0/guide/troubleshooting.html#_relocation_errors__or__undefined_symbol_
                    >
                    > --
                    > Knowmad Services Inc.
                    > http://www.knowmad.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
                    >


                    --
                    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
                  Your message has been successfully submitted and would be delivered to recipients shortly.