I have several shared libraries what I would like to have statically compiled into a module’s shared library. For example, instead of Perl -> Perl Module (.pm & .so) -> shared library, I’d like to be able to have Perl -> Perl Module (.pm & .so).

Here’s an example with the DBD::Sybase modules, but this applies to many other modules, MySQL, Pg, etc.

Instead of:
# ldd /opt/company/apps/perl/site/lib/auto/DBD/Sybase/Sybase.so libct.so.4 => /opt/company/apps/apps/freetds/lib/libct.so.4 (0 +x00c37000) libtds.so.5 => /opt/company/apps/apps/freetds/lib/libtds.so.5 +(0x00e83000) libdl.so.2 => /lib/libdl.so.2 (0x00f7c000) libm.so.6 => /lib/tls/libm.so.6 (0x00f53000) libc.so.6 => /lib/tls/libc.so.6 (0x001a5000) /lib/ld-linux.so.2 (0x0041b000)
I want:
# ldd /opt/company/apps/perl/site/lib/auto/DBD/Sybase/Sybase.so libdl.so.2 => /lib/libdl.so.2 (0x00f7c000) libm.so.6 => /lib/tls/libm.so.6 (0x00f53000) libc.so.6 => /lib/tls/libc.so.6 (0x001a5000) /lib/ld-linux.so.2 (0x0041b000)

The only option I can find is building the module with “make Makefile.PL LINKTYPE=static”. This will not work for me as it just creates a new statically compiled Perl binary. I’m using ActiveState’s Perlapp and it bundles the perl.so with the exe. The Perl exe with the static library built in does me no good.

I’m really looking for a way to get an external static library compiled into a Perl module shared library. Is that even possible? BTW – this same problem exists with PHP and Apache modules. There has to be a way to create a slim exe with shared object modules without requiring any external shared libraries.


In reply to Real Static Modules by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.