Solved: Perl undefined symbol: PL_stack_base at … DynaLoader.pm

Solution for Perl undefined symbol: PL_stack_base

This problem was reported when trying to use Chilkat for the first time on a RHEL8 machine using chilkat-9.5.0-perl-5.26-x86_64-linux. Here’s the environment:

# lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: RedHatEnterprise
Description:    Red Hat Enterprise Linux release 8.9 (Ootpa)
Release:        8.9
Codename:       Ootpa

# perl -v
This is perl 5, version 26, subversion 3 (v5.26.3) built for x86_64-linux-thread-multi
(with 58 registered patches, see perl -V for more detail)

# perl test.pl
Can't load '/usr/local/share/perl5/libchilkat.so' for module chilkat: /usr/local/share/perl5/libchilkat.so: undefined symbol: PL_stack_base at /usr/lib64/perl5/DynaLoader.pm line 193.
 at /usr/local/share/perl5/chilkat.pm line 11.
Compilation failed in require at test.pl line 1.
BEGIN failed--compilation aborted at test.pl line 1.

Answer:

This problem is caused when a Perl module compiled for non-multi-thread is used with a multi-thread Perl. In the above problem, it is a multi-thread Perl that is being used (perl 5, version 26, subversion 3 (v5.26.3) built for x86_64-linux-thread-multi). If one looks at the Chilkat Perl module download choices at https://www.chilkatsoft.com/perl.asp#linuxDownloads, there are both multi-thread and non-multi-thread downloads. The solution is to download and use the threading that matches your instance of Perl. In the above case, the Chilkat Perl with Threads 5.26 64-bit Linux build should be used.

Note: Perl provides both multi-threaded and non-multi-threaded builds to accommodate different use cases and preferences of its users.

1. Single-Threaded Build (non-multi-threaded):

  • Simplicity: The non-multi-threaded build of Perl is simpler in terms of design and implementation. It follows a traditional single-threaded model.
  • Compatibility: Some legacy or existing Perl applications may not be designed to work with multi-threading. Using a single-threaded build ensures compatibility with such applications.

2. Multi-Threaded Build:

  • Concurrency: The multi-threaded build of Perl allows developers to create multi-threaded applications. Threads can run concurrently, and this can be beneficial for tasks that can be parallelized, such as handling multiple connections or processing tasks simultaneously.
  • Performance: In certain scenarios, multi-threading can lead to improved performance by utilizing multiple CPU cores efficiently.
Tags :