dyld: Library not loaded: /usr/local/lib/libjpeg.8.dylib - homebrew php
As proposed by @jirson-tavera in the homebrew-php repo issue, this can be fixed without overriding your brew installation:
wget -c http://www.ijg.org/files/jpegsrc.v8d.tar.gz
tar xzf jpegsrc.v8d.tar.gz
cd jpeg-8d
./configure
make
cp ./.libs/libjpeg.8.dylib /usr/local/opt/jpeg/lib
Homebrew upgrade drops PHP: dyld: Library not loaded: /usr/local/opt/libpsl/lib/libpsl.5.dylib
Okay, I've solved this by installing this library brew install libpsl
then reinstall php brew reinstall php@7.2 --build-from-source
also the same for php@7.3
Be aware that reinstalling php will reset all php configurations
dyld: Library not loaded: /usr/local/opt/jpeg/lib/libjpeg.9.dylib OpenCV C++ MacOS
OpenCV requires the libjpeg library to read your jpg file, and it is dynamically loaded (like a DLL) when you run your program. The program searches that dynamic library at a predefined path - /usr/local/opt/jpeg/lib/libjpeg.9.dylib
, and most likely you don't have this file there.
The first step is to find this library on your computer, which you can do by running:
sudo find / -name 'libjpeg.*'
If nothing is found (like it happened to me), you have several options: build the library from source code, find a pre-built library and download it, or install it from a package manager (like brew or MacPorts). Probably I would try brew first. Note: you probably need version 9 of the libjpeg library.
brew install libjpeg
command worked for me. (you need to install brew first).
Step 2: when you get the library, you need to make sure that the program can find it. Usually there's a way to override the hardcoded path like /usr/local/opt
at build time using some build script variable somewhere in the OpenCV build scripts. An easier way might be to either install it where it expects it to be (at /usr/local/opt
), or make a symlink from that path to a real location.
I've used brew and it actually installed it at the expected path:
bash-3.2$ pwd
/usr/local/opt/libjpeg/lib
bash-3.2$ ls
libjpeg.9.dylib libjpeg.a libjpeg.dylib pkgconfig
bash-3.2$ brew info libjpeg
jpeg: stable 9c (bottled)
Image manipulation library
http://www.ijg.org
/usr/local/Cellar/jpeg/9c (21 files, 724.6KB) *
dyld: Library not loaded: /usr/local/lib/libpng16.16.dylib with anything php related
I suggest you run:
$ brew update && brew upgrade
Until couple of minutes ago I had this problem, too. Because I have an up to date PHP version, I solved it with:
$ brew reinstall php55
Brew library version mismatch when running PHP
Just faced a very similar problem.
Did this:
Uninstalled PHP 7.1
brew uninstall php71
Installed From source:
brew install --build-from-source php71
And now when I do php -v I get:
PHP 7.1.7 (cli) (built: Aug 7 2017 13:05:56) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
Solution was found on this post.
Edit: second command missed formula name
Brew doctor: dyld: Library not loaded & Error: No available formula for zlib
Try to re-install libtool by:
brew reinstall libtool --universal && brew unlink libtool && brew link libtool
If that doesn't help, try removing libtool completely, and then retry the steps above:
brew uninstall libtool
If it still doesn't work after trying the steps above, check to see if you have the DYLD_FALLBACK_LIBRARY_PATH variable defined somewhere on the system (e.g. ~/.profile) and try unsetting it before trying the steps above again.
Other commands which could be useful for identifying the issue:
$ libtool --version
$ whereis libtool
$ set | grep DYLD_FALLBACK_LIBRARY_PATH
$ echo $DYLD_FALLBACK_LIBRARY_PATH
Related Topics
How to Retrieve All Variables from a Twig Template
Storing and Retrieving an Array in a PHP Cookie
Preserve and Display Text Exactly How It Is Typed and Submitted
How to Remove a Key and Its Value from an Associative Array
Fatal Error: Cannot Use Object of Type Stdclass as Array In
Using Zend Framework for Highload Projects
How to Get All Keys of an Multi Level Associative Arrays in PHP
PHP - Iterate on String Characters
Codeigniter Back Button After Logout
Why Is It Good Save to Save Sessions in the Database
Oracle 11G Xe Greek Character Set Not Displaying
Cannot Use Concatenation When Declaring Default Class Properties in PHP
Getting MySQL_Insert_Id() While Using on Duplicate Key Update with PHP
Combine 2-3 Transparent Png Images on Top of Each Other with PHP