Archived Forum Post

Index of archived forum posts

Question:

Can't find 'boot_chilkat' symbol in /usr/perl5/site_perl/5.8.4/libchilkat.so

Sep 16 '16 at 09:24

We are trying to get the Perl modules working on Solaris 10.1, Perl 5.8.4 and on the SPARC architecture. We followed the installation instructions and are now attempting to execute test.pl which came with the package.

The package we installed is: chilkat-9.5.0-perl-5.8-sparc-sparc

The following output is displayed on the screen:

Can't find 'boot_chilkat' symbol in /usr/perl5/site_perl/5.8.4/libchilkat.so
at /usr/perl5/site_perl/5.8.4/chilkat.pm line 11
Compilation failed in require at test.pl line 1.

BEGIN failed--compilation aborted at test.pl line 1


Answer

Chilkat uses swig (swig.org) to interface from Perl to the underlying C++ code.

The 1st step in understanding the problem is to find "boot_chilkat" in the SWIG generated wrappers. If a symbol cannot be found, then it must be that an exported symbol (function) is not present in name, or in signature (i.e. the arguments are different).

In the SWIG generated C++ code (which is not public), this is found:

#define SWIG_init    boot_chilkat

It means that for any SWIG module, there will be an exported function named "boot_MODULENAME". In this case the module name is "chilkat". So.. SWIG defined a macro that resolves to "boot_chilkat", and therefore the function in the generated SWIG wrappings will be named "SWIG_init". So let's look for it...

This is what we find:

#ifndef PERL_OBJECT
#ifndef MULTIPLICITY
SWIGEXPORT void SWIG_init (CV cv);
#else
SWIGEXPORT void SWIG_init (pTHXo_ CV cv);
#endif
#else
SWIGEXPORT void SWIG_init (CV cv, CPerlObj );
#endif

In Chilkat's case, PERL_OBJECT is never going to be defined. So this leaves two possible function signatures. The Chilkat Perl module, and the Perl installation both must agree with MULTIPLICITY. If they do not, then the boot_chilkat function will have different arguments, and thus a different exported function signature and boot_chilkat will not be found.

We need to find the MULTIPLICITY of the Perl installation and of Chilkat. To find out if your Perl was built with MULTIPLICITY, type "perl -V" on the command line:

perl -V
You'll get a lot of output. Look for this:
...
Characteristics of this binary (from libperl):
  Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV
                        PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP
                        PERL_USE_SAFE_PUTENV USE_ITHREADS USE_LARGE_FILES
                        USE_PERLIO USE_REENTRANT_API USE_SITECUSTOMIZE
  Built under solaris
  Compiled at Jul 24 2012 13:41:27
...
In this case, we can see that MULTIPLICITY is defined.

Now... in building a Perl module in C++, one must compile with the Perl provided header files (.h) in the CORE subdirectory. The config.h will indicate whether MULTIPLICITY is defined or not. Chilkat should be consistent across-the-board in MULTIPLICITY. The answer is that Chilkat chooses to always define MULTIPLICITY. Perl installations normally have MULTIPLICITY defined. Therefore, Chilkat should work with typical Perl installations.

But... Here's Where I Found the Source of the Problem

In reviewing Chilkat's config.h headers for the various platforms and various Perl versions, I found that almost all correctly defined MULTIPLICITY. A few did not, and one of the few that did not was the config.h for Perl 5.8 on Solaris SPARC. I will fix these config.h files and rebuild, and assuming no other unforeseen problems arise (you never know with the tangled messy internals of C++ interfacing to things like Perl, PHP, etc.), then the problem should get resolved..