For some reason swig on my computer is not configured correctly. It gives this output on checking version:

$ swig --version

swig: error while loading shared libraries: libpcre.so.1: cannot open 
shared object file: No such file or directory

whereas on reinstalling it the following output is generated:

piyush@piyush-HP:~/test$ sudo apt-get install swig
[sudo] password for piyush: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
swig is already the newest version (3.0.8-0ubuntu3).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

any suggestions for how to fix it? thanks.

  • 1
    swig isn't the problem. it's that your system can't find libpcre.so.1. Ubuntu has a package libpcre3 that has a libpcre.so.3 file. You could try installing that and see if it satisfies swig's requirements. Feb 1, 2018 at 18:18
  • its already installed Feb 1, 2018 at 18:24
  • If not, you could try creating a symbolic link named 'libpcre.so.1', pointing to the libpcre.so.3 file, and see if that works. Kind of strange though, because apt should be managing the dependencies.
    – Time4Tea
    Feb 1, 2018 at 18:24
  • could you please tell me how to create a symbiotic link,i don't know how to do it Feb 1, 2018 at 18:26
  • To do that, you use the ln command, for example: ln -sv [target] [link-name]. You would need to put the link in the location that swig is expecting for libpcre.so.1 and direct it to wherever libpcre.so.3 is installed. Chances are, it is probably looking for the so.1 in the same directory as libpcre.so.3. You can see man ln for more details.
    – Time4Tea
    Feb 1, 2018 at 18:57

1 Answer 1

  • You can follow either these two link to download and install pcre. link1 link2

  • After finishing installing pcre: Go to: cd /pcre-8.42/.libs then

    sudo mv -v libpcre.so.* /usr/lib/

Then you will be able to use swig.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .