Wondering how to fix Nginx error while loading shared libraries? We can help you.
Often Nginx users report that they end up with this error while trying to start Nginx. Nginx is open-source software for web serving, reverse proxying, caching, load balancing, media streaming, etc.
Here at Bobcares, we handle requests from our customers using Nginx servers to fix similar issues as a part of Server Management Services.
Today, let us see how our Support techs resolve this issue for our customers.
What causes ‘Nginx error while loading shared libraries’
A typical error looks like the one given below:
Starting nginx: /opt/nginx/sbin/nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
The Nginx executable was compiled to expect the PCRE (Perl-compatible Regular Expression) shared library to be available somewhere on LD_LIBRARY_PATH or specified in /etc/ld.so.conf or whatever equivalent library-locating mechanisms apply to our operating system and it cannot find the library.
Common causes for this error is given below:
1. PCRE library not available
2. Nginx compiled installation did not specify the correct PCRE address
3. Did not add PCRE library to LD_LIBRARY_PATH
How to fix ‘Nginx error while loading shared libraries’
To fix this error we need to install PCRE.
Nginx is looking for a file libpcre.so.1 which comes under the PCRE library and usually installed on UNIX.
We can find libpcre.so.1 using the following find command:
$find / -name libpcre.so.1
/usr/local/lib/libpcre.so.1
If this file is present, it means that PCRE is already installed.
In case, if we do not get find results, we will have to install PCRE using the following command:
yum install pcre
Now, we have to set LD_LIBRARY_PATH, as we could see libpcre.so.1 is available under /usr/local/lib.
$export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
Start Nginx using either of the following commands:
sudo systemctl start nginx
orsudo service nginx start
If Nginx does not specify the correct PCRE address, we need to recompile and install Nginx and specify PCRE.
We do this using the following commands:
./configure –prefix=/usr/local/nginx –with-pcre=../pcre-8.38
make
sudo make install
[Need assistance? We can help you]
Conclusion
In short, we saw how our Support Techs fix ‘Nginx error while loading shared libraries’ for our customers.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
GET STARTED
var google_conversion_label = «owonCMyG5nEQ0aD71QM»;
I run through the following steps to attempt to start up an app for production:
-Setup a virtualenv for the python dependencies: virtualenv -p /usr/bin/python3.8 ~/app_env
-Install pip dependencies: . ~/app_env/bin/activate && pip install -r ~/app/requirements.txt
-Un-comment the lines for privilege dropping in uwsgi.ini and change the uid and gid to your account name
-Login to root with sudo -s and re-source the env with source /home/usr/app_env/bin/activate
-Set the courthouse to production mode by setting the environment variable with export PRODUCTION=1
-Start the app: cd /home/usr/app && ./start_script.sh
And I get the following error:
(app_env) root@usr-Spin-SP314-53N:/home/usr/Desktop/app# ./start.sh
uwsgi: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
I tried a few things such as installing a newer libpcre version like mentioned here, tried also the steps mentioned here but that didn’t work. Also the environment I’m setting up doesn’t use anaconda but regular python. I even tried pip install uwsgi
in my virtual env but it said the requirement was already satisfied. I’m not much of an expert when it comes to somewhat complex package management like this, help with how to solve this would be greatly appreciated. Thanks. I’m on Ubuntu 20.04, using python 3.8.
asked Jan 1, 2021 at 2:08
amdorsey12amdorsey12
4235 silver badges15 bronze badges
What solved it for me was apparently just reinstalling UWSGI, like in this thread, in my virtual env while forcing it to ignore the cache so it could know to use the pcre library I installed.
In order, doing this
uwsgi --version
Was giving me this
uwsgi: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
So I made sure I had the latest libpcre installed
sudo apt-get install libpcre3-dev
And then what linked it all together was this
pip install uwsgi -I --no-cache-dir
answered Jan 1, 2021 at 18:11
amdorsey12amdorsey12
4235 silver badges15 bronze badges
I tried to solve this error but it did not work no matter what I did and then reinstalled uwsgi, but the following 2 lines solved my problem
sudo find / -name libpcre.so.*
#change the path of the /home/anaconda3/lib/libpcre.so.1 with the one appears after above one.
sudo ln -s /home/anaconda3/lib/libpcre.so.1 /lib
which python
answered Mar 6, 2021 at 19:58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub?
Sign in
to your account
Closed
chomwitt opened this issue
May 4, 2019
· 11 comments
Comments
I installed the nQuake script.
I run it. pak file found ok .
ezquake tar buid.
I untar and try to execute ezquake-linux-x86_64 👎
./ezquake-linux-x86_64: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
Unfortunately in Debian 9 i found only:
libpcre3: /lib/x86_64-linux-gnu/libpcre.so.3
libpcre2-16-0: /usr/lib/x86_64-linux-gnu/libpcre2-16.so.0
fyi, build-linux.sh will install all dependencies for you.
I compiled it.
homwitt@enous:~/Λήψεις/ezquake/ezquake-source-master$ ./build-linux.sh
[STEP ] Install/check dependecies (packages)…
[INFO ] You might be prompted to input your password as superuser privileges are required.
[INFO ] Updating apt repo list… (running with sudo)
[sudo] password for chomwitt:
W: GPG error: http://debian-mirrors.sdinet.de/deb-multimedia stable InRelease: Οι παρακάτω υπογραφές δεν ήταν δυνατόν να επαληθευτούν επειδή δεν ήταν διαθέσιμο το δημόσιο κλειδί: NO_PUBKEY 5C808C2B65558117
W: The repository ‘http://debian-mirrors.sdinet.de/deb-multimedia stable InRelease’ is not signed.
[INFO ] Checking/installing required packages… (running with sudo)
[STEP ] Cleaning up any previous build files…
[STEP ] Compiling sources (this might take a while, please wait)…
Build completed successfully.
Copy ezquake-linux-x86_64 into your quake directory.
I copied it to the directory i’ve made following nquake script but now i get:
Error: Couldn’t load gfx/palette.lmp
in the directory you have that binary should be an id1 directory, and inside of it pak0.pak and pak1.pak, that error means it couldn’t find id1/pak0.pak
Thanks. I thought that because the nQuake script found the pak file to the path i gave that that step was done.
Anyway it run.
Thanks!!
The files are case sensitive. Might be called PAK01.PAK and PAK02.PAK, works after renamed to lowercase.
I had the same issue on Linux Mint 19.2 (very current version).
I issued the following command:
sudo apt–get install libpcre3
And then I went into:
cd /usr/lib/x86_64-linux-gnu/
And then I copied the lib:
sudo cp libpcre.so libpcre.so.1
And then ezquake started and ran for me.
Think this is because they’ve been built in either Arch or an old version of Ubuntu in the past — will be using newer Ubuntu in future.
@meag — Define «newer». Hopefully you retain backward libc compatibility (2.17)
kentonshade
added a commit
to kentonshade/newrelic-php-agent
that referenced
this issue
May 12, 2022
kentonshade
added a commit
to kentonshade/newrelic-php-agent
that referenced
this issue
May 18, 2022
For Mint 21/Ubuntu 20.04:
$ find / -iname libpcre.so* 2>/dev/null
/usr/lib/x86_64-linux-gnu/libpcre.so.3
/usr/lib/x86_64-linux-gnu/libpcre.so.3.13.3
$ sudo ln -s /usr/lib/x86_64-linux-gnu/libpcre.so.3 /usr/lib/x86_64-linux-gnu/libpcre.so.1
While trying to install apache version 2.4.4 using the following method:
Source: http://zhuojun.info/?p=1121
Before installing Apache 2.4.4, you should install PCRE, otherwise it will not succeed. The process of installing PCRE is simple. After you downloaded it, run in terminal next commands:
sudo ./configure sudo make sudo make install
Download APR and APR-Util from http://apr.apache.org, unpack them to Apache directory,
/srclib/apr
and/srclib/apr-util
(no version numbers in the directory names) and type following commands to install Apache:sudo ./configure --with-included-apr sudo make sudo make install
Type following command to start Apache:
sudo /usr/local/apache2/bin/apachectl start
There may be something wrongs like:
/usr/local/apache2/bin/httpd: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
Type following command to see httpd’s shared library dependencies:
ldd httpd
Found «libpcre.so.1 => not found», then type the following command to update links:
sudo ldconfig
Restart Apache and should work.
Everything seemed fine but when I tried to start the apache service it gives error:
root@server1:/usr/local/apache2/bin# /etc/init.d/apache2 start
* Starting web server apache2 /usr/sbin/apache2: symbol lookup error: /usr/sbin/apache2: undefined symbol: apr_ldap_url_parse
Action 'start' failed.
The Apache error log may have more information.
[fail]
I tried to install the apr again but nothing seems to work. Please help.
The Apache log shows something like this:
[Mon Jun 17 10:31:08 2013] [notice] Apache/2.2.22 (Ubuntu) PHP/5.3.10-1ubuntu3.6 with Suhosin-Patch configured -- resuming normal operations
[Mon Jun 17 11:48:20 2013] [notice] Apache/2.2.22 (Ubuntu) PHP/5.3.10-1ubuntu3.6 with Suhosin-Patch configured -- resuming normal operations
[Mon Jun 17 15:44:36 2013] [notice] Apache/2.2.22 (Ubuntu) PHP/5.3.10-1ubuntu3.6 with Suhosin-Patch configured -- resuming normal operations
# |
|
Темы: 1 Сообщения: 2 Участник с: 05 марта 2012 |
Доброго Всем времени суток господа! Заранее прошу прощения — возможно вопрос дилетанский.
У меня Arch Linux 3.0.3. Была проблема при старте Apache, первый запуск , была такая ошибка /usr/sbin/httpd: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory Нашел решение на одном из форумов — переустановил pcre. Запускаю с зажмуриными глазами /etc/rc.d/httpd start и Апач заработал. Но теперь проблема совершенно другая. Пытаюсь запустить Midnight Commander, системы выдает во такую ошибку mc: error while loading shared libraries: libpcre.so.0: cannot open shared object file: No such file or directory Midnight Commander удалял и устанавливал по новой, ошибка не пропала. |
sirocco |
# |
Темы: 29 Сообщения: 2501 Участник с: 25 июля 2007 |
А что это такое? Частичные обновления официально не поддерживаются |
afonder |
# |
Темы: 1 Сообщения: 2 Участник с: 05 марта 2012 |
Господа — проблема решена весьма оригенаальным споссобом, ручками добавление /usr/lib/libpcre.so.0. Всем спасибо. Если у кого то будет что то подобное — пишите, помогу обязательно. |
sav-62 |
# |
Темы: 5 Сообщения: 22 Участник с: 24 марта 2012 |
У меня такая же беда. После установки apache пишет что не видит libpce.so.1. Так как я в Линуксе ноль, подскажите, как переустановить pcre? |
domov0y |
# |
Темы: 5 Сообщения: 819 Участник с: 09 июля 2011 |
если вы делали полное обновление системы то ничего переставлять не надо. ldd /полный_путь_к_исполнимому_файлу вам подскажет чего не хватает. потом ищете файл с похожим именем в папке /usr/lib/ и делаете копию с нужным именем Да пребудет с вами знание ip адреса |
Natrio |
# |
Темы: 47 Сообщения: 4765 Участник с: 08 января 2011 |
Как правило, такие вещи бывают именно при неполном обновлении. |
sav-62 |
# |
Темы: 5 Сообщения: 22 Участник с: 24 марта 2012 |
Большое спасибо за поддержку. Похоже что у меня неполное обновление. Выкрутился командой pacman -S pcre. Теперь повторяю Ваш путь, перестал работать mc. Сейчас буду репу морщить. |
Natrio |
# |
Темы: 47 Сообщения: 4765 Участник с: 08 января 2011 |
Полное обновление делается командой
pacman -Syu |
sav-62 |
# |
Темы: 5 Сообщения: 22 Участник с: 24 марта 2012 |
Вопрос снят. Запуск pacman -Syu ничего не дает. Выкрутился командой: ln -sv /usr/lib/libpcre.so.1.0.0 /usr/lib/libpcre.so.0 . Всем спасибо. |
Natrio |
# |
Темы: 47 Сообщения: 4765 Участник с: 08 января 2011 |
$ pacman -Ql pcre|grep '/lib/libpcre.' pcre /usr/lib/libpcre.a pcre /usr/lib/libpcre.so pcre /usr/lib/libpcre.so.1 pcre /usr/lib/libpcre.so.1.0.0 $ ls -l /usr/lib/libpcre.* -rw-r--r-- 1 root root 408392 февр. 6 06:00 /usr/lib/libpcre.a lrwxrwxrwx 1 root root 16 февр. 6 06:00 /usr/lib/libpcre.so -> libpcre.so.1.0.0 lrwxrwxrwx 1 root root 16 февр. 6 06:00 /usr/lib/libpcre.so.1 -> libpcre.so.1.0.0 -rwxr-xr-x 1 root root 374260 февр. 6 06:00 /usr/lib/libpcre.so.1.0.0 $ ldd /usr/bin/mc | grep pcre libpcre.so.1 => /usr/lib/libpcre.so.1 (0xb72bc000) У меня вашего симлинка нет, но mc работает. |