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.