linuxapacheperlcentos6mod-perl2

"undefined symbol: mg_free_type" when installing mod_perl 2.0.10 with Apache 2.4.26 and Perl 5.10.1


I'm trying to install mod_perl 2.0.10 for use with a new Apache 2.4 instance. I've got Apache 2.4.26 up and running by itself, but I also need mod_perl installed for a couple of modules to work.

Here's the problem: mod_perl always fails its tests claiming:

Syntax error on line 82 of .../t/conf/httpd.conf: Cannot load .../src/modules/perl/mod_perl.so into server: .../src/modules/perl/mod_perl.so: undefined symbol: mg_free_type

The only information I could find on this is here: Error when installing mod_perl2. Unfortunately, it didn't solve the problem.

Using CentOS release 6.8 (Final) x86_64 x86_64 x86_64 GNU/Linux

More from the log:

> make test
cd "src/modules/perl" && make
make[1]: Entering directory `/software/apa/mod_perl/mod_perl-2.0.10/src/modules/perl'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/software/apa/mod_perl/mod_perl-2.0.10/src/modules/perl'
...
make[1]: Leaving directory `/software/apa/mod_perl/mod_perl-2.0.10/xs'
/usr/bin/perl -Iblib/arch -Iblib/lib \
    t/TEST -clean
[warning] setting ulimit to allow core files
ulimit -c unlimited; /usr/bin/perl /software/apa/mod_perl/mod_perl-2.0.10/t/TEST -clean
APACHE_TEST_APXS= APACHE_TEST_GROUP= APACHE_TEST_HTTPD= APACHE_TEST_PORT= APACHE_TEST_USER= \
    /usr/bin/perl -Iblib/arch -Iblib/lib \
    t/TEST -bugreport -verbose=0 
[warning] setting ulimit to allow core files
ulimit -c unlimited; /usr/bin/perl /software/apa/mod_perl/mod_perl-2.0.10/t/TEST -bugreport -verbose=0
/software/apa/apa24/bin/httpd.prefork  -d /software/apa/mod_perl/mod_perl-2.0.10/t -f /software/apa/mod_perl/mod_perl-2.0.10/t/conf/httpd.conf -D APACHE2 -D APACHE2_4 -D PERL_USEITHREADS
using Apache/2.4.26 (prefork MPM)

waiting 300 seconds for server to start: .httpd.prefork: Syntax error on line 82 of /software/apa/mod_perl/mod_perl-2.0.10/t/conf/httpd.conf: Cannot load /software/apa/mod_perl/mod_perl-2.0.10/src/modules/perl/mod_perl.so into server: /software/apa/mod_perl/mod_perl-2.0.10/src/modules/perl/mod_perl.so: undefined symbol: mg_free_type
[  error] 
server has died with status 255 (t/logs/error_log wasn't created, start the server in the debug mode)
sh: line 1:  3359 Terminated              /usr/bin/perl /software/apa/mod_perl/mod_perl-2.0.10/t/TEST -bugreport -verbose=0
make: *** [run_tests] Error 143

Solution

  • This bug was introduced when they added support of perl version 5.22, in mod_perl 2.0.10: https://github.com/apache/mod_perl/commit/82827132efd3c2e25cc413c85af61bb63375da6e#diff-0a249c57fb8151f85647e167a883be1b

    And then was fixed in a mod_Perl patch on 4 January 2018 (2.0.11-dev): https://github.com/apache/mod_perl/commit/f4d886fdf7d79d54a0647336b5623b840a053eab

    To fix this problem you must compile from source of this commit of mod_perl 2.0.11-dev (or the trunk version) to fix the problem if you have perl <=5.13.6, or if you can upgrade Perl to version >5.13.6 you can compile with mod_perl 2.0.10.

    This change in Perl as been introduced in source of Perl version 5.13.6 in this perl commit : https://perl5.git.perl.org/perl.git/commit/d908838680ec40ea0e85f59ee66f5f56a225f9b4

    The mod_perl fix (in last 2.0.11-dev) in src/modules/perl/modperl_env.c use contextual usage of mg_free to fix the problem :

    #if MP_PERL_VERSION_AT_LEAST(5, 13, 6)
        mg_free_type((SV*)ENVHV, PERL_MAGIC_env);
    #else
        mg_free((SV*)ENVHV);
    #endif