3

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.

Time4Tea
  • 2,288
  • 5
  • 23
  • 54
Piyush Verma
  • 31
  • 1
  • 4
  • 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. – Tim Kennedy Feb 01 '18 at 18:18
  • its already installed – Piyush Verma Feb 01 '18 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 01 '18 at 18:24
  • could you please tell me how to create a symbiotic link,i don't know how to do it – Piyush Verma Feb 01 '18 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 01 '18 at 18:57
  • Also, you should use @Time4Tea, to flag to me that you are responding to my comment. – Time4Tea Feb 01 '18 at 19:00
  • @Time4Tea i have located the location of libpcre.so.1 file( /lib64/)and working directry of swig (/usr/local/bin/) what should i do next – Piyush Verma Feb 01 '18 at 19:17
  • *ln -sv /usr/local/bin libpcre.so.1* should this be the command @Time4Tea – Piyush Verma Feb 01 '18 at 19:18
  • Do you know what the location is of the libpcre.so.3 file that was installed by the other package? – Time4Tea Feb 01 '18 at 19:22
  • ' /lib/x86_64-linux-gnu/ ' location of libpcre.so.3 @Time4Tea – Piyush Verma Feb 01 '18 at 19:26
  • Ok. Try `ln -sv /lib64/libpcre.so.1 /lib/x86_64-linux-gnu/libpcre.so.1`. See if that directs swig to the library file that you have installed. – Time4Tea Feb 01 '18 at 19:33
  • Also, you might need to use `sudo` to do that. – Time4Tea Feb 01 '18 at 19:34
  • link created successfully but same error – Piyush Verma Feb 01 '18 at 19:37
  • if i just copy paste the `libpcre.so.1` file to `lib/x86_64-linux-gnu/libpcre.so.1` will that work – Piyush Verma Feb 01 '18 at 19:40
  • If the link didn't work, then that shouldn't work either. It might be that location is not where swig is looking for for the library file. You could try creating similar links in `/lib`, `/usr/lib` and `/usr/lib64`. I would do them one at a time and delete them after, if they don't work. Also, check first to make sure there isn't a file of that name already in there that you are overwriting. – Time4Tea Feb 01 '18 at 19:45
  • Symbolic links should be pretty much equivalent to copying the file, just that you don't end up with multiple versions of the same file scattered around your system. – Time4Tea Feb 01 '18 at 19:46
  • Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/72561/discussion-between-piyush-verma-and-time4tea). – Piyush Verma Feb 01 '18 at 19:48

1 Answers1

3
  • 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.

Stephen Harris
  • 42,369
  • 5
  • 94
  • 123
anhbeo
  • 53
  • 6