When you run a program, then it tells you that some lib file or dynamic lib file are not exist or not loaded or not, the reason may be you are missing some lib file.
For example, when you execute octave
dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib
Referenced from: /usr/local/Cellar/octave/4.4.1_4/bin/octave-cli-4.4.1
Reason: image not found
The message told that libreadline.7.dylib
file is not found.
There may be two reasons for this problem.
First, the library may be not installed in the system. To verify this, you should try to find some files that are related to the name libreadline
, you can do
$ updatedb
$ locate libreadline
you may find several or many files associated with libreadline
/usr/lib/libreadline.dylib
/usr/local/Cellar/readline/7.0.5/lib/libreadline.7.0.dylib
/usr/local/Cellar/readline/7.0.5/lib/libreadline.7.dylib
/usr/local/Cellar/readline/7.0.5/lib/libreadline.a
/usr/local/Cellar/readline/7.0.5/lib/libreadline.dylib
/usr/local/Cellar/readline/8.0.1/lib/libreadline.7.dylib
/usr/local/Cellar/readline/8.0.1/lib/libreadline.8.0.dylib
/usr/local/Cellar/readline/8.0.1/lib/libreadline.8.dylib
/usr/local/Cellar/readline/8.0.1/lib/libreadline.a
/usr/local/Cellar/readline/8.0.1/lib/libreadline.dylib
/usr/local/Cellar/readline/8.0.4/lib/libreadline.8.0.dylib
/usr/local/Cellar/readline/8.0.4/lib/libreadline.8.dylib
/usr/local/Cellar/readline/8.0.4/lib/libreadline.a
/usr/local/Cellar/readline/8.0.4/lib/libreadline.dylib
After seeing this, the libreadline has already installed in our system. So, that’s not the first reason.
The second reason may be the version was not matched, the version 7 is required but this version is not exist, while version 8 is exist.
In this case, we can create a dynamic like from version 8 to version 7.
$ cd /usr/local/opt/readline/lib
$ ls
libhistory.8.0.dylib
there is a version 8 file in there. So we can create a soft link file from it.
ln -s libreadline.8.0.dylib libreadline.7.dylib
then we can try our octave
program again
$ octave
GNU Octave, version 4.4.1
Copyright (C) 2018 John W. Eaton and others.
This is free software; see the source code for copying conditions.
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. For details, type 'warranty'.
Octave was configured for "x86_64-apple-darwin18.2.0".
Additional information about Octave is available at https://www.octave.org.
Please contribute if you find this software useful.
For more information, visit https://www.octave.org/get-involved.html
Read https://www.octave.org/bugs.html to learn how to submit bug reports.
For information about changes from previous versions, type 'news'.
oho, that’s right. We are done.
Summary
When missing a lib file, you can install it, copy it form other systems, or make a soft link from existing others versions, placing it at the right directory.