2

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.

Ian
  • 13,724
  • 4
  • 52
  • 75
  • Perl builds without threads by default (except maybe on Windows?) – ikegami Feb 20 '20 at 13:53
  • 1
    The error is saying that the requirement of having threads wasn't met, meaning it wants threads. – ikegami Feb 20 '20 at 13:53
  • Oh! I read that the wrong way around, thought it was saying I had compiled it with threads...I guess the opposite question arises then, how to make mod_perl not require threads, or is it compulsory. – Ian Feb 20 '20 at 13:57
  • 1
    By the way, an easy way to see whether thread support was added or not is `perl -v`. `thread` will be included in the arch ("built for ...") string if support was added. – ikegami Feb 20 '20 at 14:00
  • Could you provide the steps you took to get to your current situation so I can replicate them to study the issue? – ikegami Feb 20 '20 at 14:02
  • Thanks ikegami, have added an edit to the end – Ian Feb 20 '20 at 14:05
  • I think whether mod_perl needs threads or not depends on the MPM model used for Apache – ikegami Feb 20 '20 at 14:06
  • Could you check apache's config for a `LoadModule` module directive for a module with a name starting with `mpm`, please? – ikegami Feb 20 '20 at 14:08
  • I can't see any module, all I can see is a line commented out #Include conf/extra/httpd-mpm.conf – Ian Feb 20 '20 at 14:11
  • `grep mpm /etc/apache2/mods-enabled/*`, maybe? – ikegami Feb 20 '20 at 14:13
  • Does passing `--with-mpm=prefork` to Apache's `configure` help? – ikegami Feb 20 '20 at 14:34
  • Sorry, still the same. I can't find any dir mods-enabled either. Thanks for the help...I note there's a couple of comments about -Uusethreads -Dusethreads, -Duseithreads...just wondering for my sanity, are there any docs on the differences? – Ian Feb 20 '20 at 14:54
  • I can see a comment in mod_perl Makefile.PL saying MP_NO_THREADS=1 may be an option I think can be passed somehow to it...for versions over http2.4, so I think I may need to use an older version or figure where that var/param is checked – Ian Feb 20 '20 at 15:08
  • aha, it may be perl Makefile.PL MP_NO_THREADS=1 – Ian Feb 20 '20 at 15:19
  • To build perl without threads, specify `-Uusethreads` or `-Dusethreads=undef` to the `Configure` script. – mob Feb 20 '20 at 17:50
  • Whats the difference between -U and -D in compile options ? – Ian Feb 20 '20 at 19:46
  • -D: define, -U: undefine – mob Feb 20 '20 at 20:35
  • @mob, 1) Or specify nothing at all, as that is the default. 2) The OP is already building a Perl without threads. The problem is that mod_perl was requiring a threaded `perl`. – ikegami Feb 20 '20 at 21:05

1 Answers1

2

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.

Ian
  • 13,724
  • 4
  • 52
  • 75