I tried installing z3 compiling it from this repository (sudo make install
) on my MacBook with M1 pro processor and MacOS Sonoma.
make examples
worked.
I succesfully compiled a file in another directoty using the same commands used by make examples
.
However, upon executing the compiled file, the library could not be loaded:
Library not loaded: libz3.dylib Referenced from: <856829F0-D35A-383B-8D63-7734D9099FC4> /my_path/cpp_example Reason: tried: 'libz3.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibz3.dylib' (no such file), 'libz3.dylib' (no such file), '/my_path/libz3.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS//my_path/libz3.dylib' (no such file), '/my_path/libz3.dylib' (no such file)
Upon forcibly copying the libz3.dylib file into the folder where the file I am trying to execute is, it worked.
Anyone has any suggestion on how to solve this problem in a more elegant way? Could it possibly be an issue with z3's make install procedure? My machine is basically empty and no weird/conflicting libraries are installed.
Thank you :)
TLDR;
export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH
Ideally on linux one would do:
sudo ldconfig /usr/local/lib
On mac OS (sonoma) with apple silicon, forums seem to say the corresponding command is sudo update_dyld_shared_cache
. But this seems to be deprecated.
The workaround that works for me is to export as in the TLDR.