Search code examples
perlmod-perl

Compile Perl without threads


I'm compiling Perl 5.30.1 and will be using mod_perl 2.0.11 with it and Apache 2.4.41.

If I try to compile mod_perl with perl MakeFile.pm I get

Configuring Apache/2.4.41 mod_perl/2.0.11 Perl/v5.30.1
Using Perl 5.030001 w/o ithreads and httpd-2.4.
Failed requirements: Perl built with ithreads (build perl with -Duseithreads)

We don't use threads, so it feels like the simplest would be to remove that from Perl compile options...

I can see people say how to compile with it (I guess on older versions of Perl where it was off by default ?)

-Dusethreads

But I'm assuming it now is enabled by default ? In which case, how do I compile without it ?

If I look at the myconfig file it suggests

useithreads=undef

I've tried things like -Dusethreads=no or false, and things like that, but I'm probably missing the right one to use.

I've also got nothing against enabling threads on mod_perl (but can't find how to do that either) if there isn't a performance hit (posts on S.O seem to suggest there is a 10% hit, but not sure if that's still relevant)

The steps I took (new server) were..downloading

perl-5.30.1 and mod_perl-2.0.11

Then

CFLAGS='-m64 -mtune=nocona' ./Configure -des -A ccflags=-fPIC -Dprefix=/opt/perl  

perl -v doesn't show threads.

And then for mod_perl

Perl Makefile.PL

Apache compiled with

./configure --enable-proxy --enable-rewrite --enable-headers --enable-ssl --with-apr=/usr/local/apr/

Edit: So it may be that mod_perl needs threads enabled as it is, so is there a way to turn that off in compile options if that's the case.


Solution

  • The answer I think seems to be to compile mod_perl with the option..

    perl Makefile.PL MP_NO_THREADS=1
    

    If anyone wants to provide a more complete answer as to whether it's not so desirable to do that now (or any other info), as there seem to be some changes with Apache 2.4 I will gladly accept their answer.