35

How do I solve this error?

Can't locate Switch.pm in @INC (you may need to install the Switch module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at external/webkit/Source/WebCore/make-hash-tools.pl line 23.
BEGIN failed--compilation aborted at external/webkit/Source/WebCore/make-hash-tools.pl line 23.
make: *** [out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/Source/WebCore/html/DocTypeStrings.cpp] Error 2
Michael Burr
  • 333,147
  • 50
  • 533
  • 760
Deepak Singh
  • 1,079
  • 2
  • 11
  • 15
  • 3
    Could you at least make an attempt to describe what exactly you're trying to do? How is this related to Android, are you trying to run this in Android Scripting Environment? Have you tried installing the Switch module as the error message itself says? – Sundar R Apr 26 '14 at 18:05
  • 2
    For anyone else who comes across this question, I ran into this problem trying to perform an AOSP Android build. That's what it has to do with Android. – Michael Burr Feb 14 '15 at 00:29
  • 1
    I had this error message while creating a pilight_ctrl device in FHEM. The answer by @yurishi fixed it for me on my raspberry pi. – tmuecksch Oct 13 '16 at 17:10

7 Answers7

60

On Linux Mint I had to type

$ sudo apt-get install libswitch-perl
yurishi
  • 611
  • 5
  • 7
  • 6
    The above command works on my Ubuntu 14.04 LTS as well and got past the error. – Ashwin Sep 16 '14 at 13:33
  • I get an error: **debconf: Perl may be unconfigured (Can't locate strict.pm in @INC (you may need to install the strict module) (@INC contains: /etc/perl** – IgorGanapolsky Jan 30 '17 at 20:59
13

You are getting this error because you don't have the Switch.pm perl module installed on your system. There are two ways to install it and both of them work on Ubuntu 14.04 as well.

  1. Install it through the Ubuntu repositories.

  2. Install the .pm through CPAN.

Installing Switch.pm using the Ubuntu repositories:

From the command-line, the installation can be completed by running the following command from the terminal (Ctrl-Alt-t):

 sudo apt-get install libswitch-perl

Installing Switch.pm using CPAN:

If you would prefer to install this via cpan, follow these instructions:

Open a terminal(Ctrl-Alt-t).

Enter the command cpan.

At the prompt cpan[1]>, type install Switch.

Once completed, Type exit.

Credits: Kevin Bowen

Community
  • 1
  • 1
4aRk Kn1gh7
  • 4,259
  • 1
  • 30
  • 41
  • 2
    @IgorGanapolsky it seems that you don't have the perl package installed. Install it using the command: sudo apt-get install perl. – 4aRk Kn1gh7 Jan 31 '17 at 07:37
9

You can resolve this error by installing "perl-Switch"

for Amazon Linux / Redhat / Centos / etc:

sudo yum install -y perl-Switch

for Ubuntu:

sudo apt-get install -y libswitch-perl
Eduardo Cuomo
  • 17,828
  • 6
  • 117
  • 94
Jose Nobile
  • 3,243
  • 4
  • 23
  • 30
3

If only one perl version,

sudo apt-get install libswitch-perl 

can solve the problem.

But if there are multi-versions perl in your system like me, first choose 5.18 version for aosp v4.x, then use cpan command install Swtich, like @4aRk Kn1gh7 's answer.

Also notice that, in some perl script first line is:

#! /usr/bin/perl

so make sure the /usr/bin/perl is the correct perl version you choose.

DinoStray
  • 696
  • 1
  • 6
  • 20
2

I have solve this, actually i was using 14.04LTS for android 4.2jellybean source code. In 14.04LTS have to install the switch module. Below is the procedure to install

1:use below command and configure as automatic $cpan App::cpanminus

2:install switch $cpanm Switch

Note:By using these two commands that problem solved in my Ubuntu 14.04LTS....

Deepak Singh
  • 1,079
  • 2
  • 11
  • 15
0

If you have mac:

sudo cpan -f Switch

The local::lib option didn't work for me.

Elazar
  • 20,415
  • 4
  • 46
  • 67
0

Try CPAN. It worked for me on Fedora 25.

cpan
cpan[1]> install Switch
mars
  • 19
  • 3