Search code examples
perlperl-module

Error using thread module: This Perl not built to support threads?


In script, I'm using threads and Thread::Queue and also using version perl 5.18.2. when I run my scripts it gives Error:This Perl not built to support threads In documentation, I read, it is an error. What is the possible solution to resolve this?


Solution

  • When you build Perl, you need to use -Dusethreads to make a build of Perl that supports threads.

    sh ./Configure -Dusethreads
    make test
    make install
    

    I personally use perlbrew to install Perl.

    perlbrew install 5.18.2 --as=5.18.2t -Dusethreads