As @hacker said, you either have to ensure that you install PCRE on the target machine or you have to use a static library (libpcre.a
instead of libpcre.so
) on the development machine. That might also mean you need to build PCRE with a static library, and you'd have to use the correct compile time options to pull in the static library. One relatively easy way to do it is to specify /usr/lib/libpcre.a
on the compiler command line. Ideally, you'd avoid including -lpcre
on the command line too - certainly, you'd want the static library to appear ahead of the shared library.
Your copy may have failed because of issues with symlinks. You usually link to a file such as:
/usr/lib/libpcre.so
but that is a symlink to a versioned library such as:
/usr/lib/libpcre.so.0
Or it could work the other way around. If you were using tar
to copy things, you may have copied a symlink.
Ideally, you install PCRE in a system directory - but doing that requires root privileges. You also have to be careful to ensure that you don't overwrite a more recent version of PCRE with your older version. You also want to avoid forcing users into setting the LD_LIBRARY_PATH
environment variable (or its equivalents), or forcing them to use the configuration program (ld.so.conf
?).