error while loading shared libraries: libpng16.so.16 - node.js

The problem is that I'm trying to use nodejs for building some css files from scss. On the local computer everything is ok.
When I run npm run production it shows me the error:
ERROR in ./resources/assets/sass/images/promo.jpg
Module build failed: Error: Command failed: /var/www/vhosts/site.ru/shared/node_modules/mozjpeg/vendor/cjpeg
/var/www/vhosts/site.ru/shared/node_modules/mozjpeg/vendor/cjpeg: error while loading
shared libraries: libpng16.so.16: cannot open shared object file: No such file or
directory
But when I run the same command from another directory(For example: /var/www/vhosts/site2.ru/) everything is ok(script works with jpg files too).
If I run ldconfig -p | grep libpng I see the next:
libpng12.so.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libpng12.so.0
libpng12.so.0 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libpng12.so.0
So, my Libng12 is working correctly, why does the system needs in libpng16?
And what should I try do in this situation?
My system is Ubuntu 16.04

Find the solution:
apt-get install libpng16-dev
so, I just installed the required library.

Related

How to fix an error `libcrypto.so.3: cannot open shared object file: No such file or directory"?

Premise
I want to share a single keyboard between two computers(ArchLinux and Windows), and there are some options to realize it on.
I choiced an option using Barrier.
Expect
Following steps bellow on a ArchLinux machine and verify there are no error:
Installing barrier : $ sudo pacman -S barrier
Using barrier : $ barrier
Actual
I got error at the step using barrier.
The error message is : barrier: error while loading shared libraries: libcrypto.so.3: cannot open shared object file: No such file or directory
Question
How to fix "No such file or directory" about libcrypto.so.3?
Additional information
Commands output
$ ldd /usr/bin/barrier | grep libcrypto
libcrypto.so.3 => not found
libcrypto.so.1.1 => /usr/lib/libcrypto.so.1.1 (0x00007fcf0f000000)
$ sudo ldconfig -p | grep libcrypto
libcrypto.so.1.1 (libc6,x86-64) => /usr/lib/libcrypto.so.1.1
libcrypto.so (libc6,x86-64) => /usr/lib/libcrypto.so
Tried things
Executed sudo barrier, nothing new.
Searched Barrier issues on github, and I obtained no result about the problem not found libcrypto.
How to fix
At the issue in my Github repository , I knew that libcrypto is a library that is included the package openssl .
And I did reinstalling openssl, installing openssl-1.1 and executing command $ barrier, no error, Barrier was launched.
Cause of error
Probablly, The error was occured by I had not the library libcrypto.so.3in my machine. So, when I reinstalliing openssl (i.e. update by pacman -Sy openssl), the library is placed in /usr/lib, and the error had dissapeared.
Refferences
OpenSSL's issue
StackOverflow's answer

Rocket Chat cannot enable SSL using Caddy: libdns.so.162 not found

I installed rocket chat using snap, following the documentation here.
Now I am trying to enable SSL following the documentation: Auto SSL with Snaps. However, the following error shows up:
$ sudo snap set rocketchat-server https=enable
error: cannot perform the following tasks:
- Run configure hook of "rocketchat-server" snap (run hook "configure":
-----
dig: error while loading shared libraries: libdns.so.162: cannot open shared object file: No such file or directory
Error: Can't resove DNS query for <my_domain_name>, check your DNS configuration, disabling https ...
-----)
Checking what ldd has to say for dig, I found few other libs are also not found:
$ ldd /snap/rocketchat-server/current/usr/bin/dig
linux-vdso.so.1 (0x0000ffff98afc000)
libdns.so.162 => not found
liblwres.so.141 => not found
libbind9.so.140 => not found
libisccfg.so.140 => not found
libisc.so.160 => not found
libpthread.so.0 => /lib/aarch64-linux-gnu/libpthread.so.0 (0x0000ffff98a71000)
libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000ffff98900000)
/lib/ld-linux-aarch64.so.1 (0x0000ffff98acc000)
So, checked if libdns.so exists at all.
$ locate libdns.so
/snap/rocketchat-server/1437/usr/lib/aarch64-linux-gnu/libdns.so.162
/snap/rocketchat-server/1437/usr/lib/aarch64-linux-gnu/libdns.so.162.1.3
/usr/lib/aarch64-linux-gnu/libdns.so.1601
/usr/lib/aarch64-linux-gnu/libdns.so.1601.0.0
It appears that the concerned library exists under snap.
Is there a way to resolve this and make caddy/https work?
System:
Raspberry Pi 4 (aarch64)
Linux ubuntu 5.4.0-1022-raspi
Ubuntu Server 20.04.1 LTS
Similar issues:
dig: error while loading shared libraries: libdns.so.162: cannot open shared object file: No such file or directory
shared libraries of dig and nslookup
Try to do a soft-link to library in your file system
ln -s /snap/rocketchat-server/1437/usr/lib/aarch64-linux-gnu/libdns.so.162 /lib
Or install dns-utils which should add missing lib to your system.

How to configure python with --enable-shared on Ubuntu 18.04

I have a flask application which I'm trying to deploy to heroku. I'm trying to do this through my virtual box where I'm running ubuntu 18.04 .
Up on command : git push heroku master
I see a warning :
WARNING: The Python installation you are using does not appear to have
been installed with a shared library, or in the case of MacOS X, as a
framework. Where these are not present, the compilation of mod_wsgi may
fail, or if it does succeed, will result in extra memory being used by all
processes at run time as a result of the static library needing to
be loaded in its entirety to every process. It is highly recommended
that you reinstall the Python installation being used from source code,
supplying the '--enable-shared' option to the 'configure' script when
configuring the source code prior to building and installing it.
and it fails with an error message:
/usr/bin/ld: final link failed: Bad value
remote: collect2: error: ld returned 1 exit status
remote: error: command 'gcc' failed with exit status 1
I understand that I need to install python with --enable-shared flag in the "configure" script. but I don't seem to find the configure script at all in my python installation under bin or python folder. This is where I'm stuck since 3 days and its frustrating; I don't really have an idea of how to re-install python with such a flag .. After going through many posts I tried the following steps:
1) Downloaded python from the url: https://www.python.org/downloads/source/
2) Ran the command: ./configure --prefix=/opt/python --enable-shared
followed by make
and make install
3) Copied the shared object files to my original python directory
The output to the command: ldd ** path **/anaconda3/bin/python gives me:
libpython3.6m.so.1.0 => /usr/anaconda3/bin/../lib/libpython3.6m.so.1.0
(0x00007f902dd2e000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
(0x00007f902db0e000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f902d906000)
libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f902d6fe000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f902d4f6000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f902d156000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f902cd5e000)
/lib64/ld-linux-x86-64.so.2 (0x00007f902e26e000)
Yet, when I tried to deploy the app, I see the same warning of --enable-shared and the same error message of gcc. I can't seem to figure out how to properly enable my python installation to have shared object. Please note that I'm a total newbie to ubuntu, I really appreciate any leads into solving this issue.
P.S: My mod_wsgi installation was successful and I was able to run the app locally through mod_wsgi.
If you don't need to use custom build of python3, you can try to install python3.6-dev package through apt, it added shared libs for me.

How do I determine what OS dependency packages are required for a Haskell executable?

I've just compiled an executable with stack build and then just copying over the executable to a different machine, however running the application results in:
./app: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory
I'm guessing I need to install some packages from the appropriate Linux distro's packages - but is there more efficient way then googling for each error that comes up and trying to identify the package?
I've tried running executable within some docker images:
fpco/haskell-scratch, debian:stretch-slim which all result in the same behaviour:
sudo docker run --rm -it -v $(pwd):/abcxyz fpco/haskell-scratch sh
# /abcxyz/app
/abcxyz/app: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory
Update
With the debian image I installed openssl:
apt-get install openssl
New error:
/abcxyz/app: error while loading shared libraries: libgmp.so.10: cannot open shared object file: No such file or directory
apt-get install libgmp-dev
And it works...
This is actually not specific to Haskell, but rather to the way Linux dynamically links shared libraries. You can use ldd <file>:
% ldd ./StateSort
linux-vdso.so.1 (0x00007ffd29385000)
libm.so.6 => /usr/lib/libm.so.6 (0x00007fd986bd1000)
libgmp.so.10 => /usr/lib/libgmp.so.10 (0x00007fd98693e000)
librt.so.1 => /usr/lib/librt.so.1 (0x00007fd986736000)
libdl.so.2 => /usr/lib/libdl.so.2 (0x00007fd986532000)
libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007fd986314000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007fd985f5c000)
/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007fd986f1d000)
If there are missing libraries, you will notice them right away: the right hand side with the path to the so file will be absent.
You will then have to refer to your Linux distro's package management system to find out what package may contain the desired so file. For Ubuntu you would use apt-file, for ArchLinux − pkgfile, and so on.
I must warn you that ldd actually executes some of the code found in a file, so a malicious program may take over and wreak havoc. If you want to dissect an executable of unknown origin this way, you must do so in a disposable forensic containment. As I understand, this is not applicable in the case at hand, but nevertheless I must warn you.

Fulfilling missing .so file in libftdi

I am using ft232r library provided by ftdi for programming an LPC11C14 micro-controller through Linux Mint. To initialize the software, I need to run the following command:
./ft232r_prog --manufacturer Sunswift --product $(PROJECT_NAME) --invert_rts --invert_dtr
When I run the code, I get the following issue:
Error while loading shared libraries: libftdi.so.1: cannot open shared object file: No such file or directory
on running ldd ft232r_prog, I get:
linux-gate.so.1 => (0xf77b8000)
libusb-0.1.so.4 => /lib/i386-linux-gnu/libusb-0.1.so.4 (0xf7790000)
libftdi.so.1 => not found
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf75e5000)
/lib/ld-linux.so.2 (0xf77b9000)
The file libftdi.so.1 is located in /usr/lib/x86_64-linux-gnu. Since the executable ft232r_prog is unable to find the .so file, I have tried the following:
Updated the path environment variable to contain /usr/lib/x86_64-linux-gnu -- Failed
Updated the $LD_LIBRARY_PATH environment variable to contain /usr/lib/x86_64-linux-gnu -- Failed
Ran ldconfig in /usr/lib/x86_64-linux-gnu -- Failed
This appears to be a common issue with including shared libraries. Any ideas on how I can resolve it?
Thanks
To install 32-bit version of libftdi on Ubuntu 12.04 x64 try following:
$ sudo apt-get install libftdi1:i386
I suspect your system is 64-bit and the program is 32-bit. In this case, you need to install the 32-bit version of the library.

Resources