1

I am writing c++ code, and using cmake to compile the application. I want to add the dylib (libraries) to the Frameworks folder. Macdeployqt does not find them all.

I have written my own python script to try and find most, but a few still elude me.

Here is a short list of what I still can't find:

Dependency Not Found! /usr/lib/libz.1.dylib
Dependency Not Found! /usr/lib/libiconv.2.dylib
Dependency Not Found! /usr/lib/libbz2.1.0.dylib
Dependency Not Found! /usr/lib/libexpat.1.dylib
Dependency Not Found! /usr/lib/libresolv.9.dylib
Dependency Not Found! /usr/lib/libxml2.2.dylib
Dependency Not Found! /usr/lib/libsasl2.2.dylib

I usually use brew to install (which I assume is in /usr/local/Cellar by brew --prefix and Cellar), I have so far recursively searched:

/usr/local/opt/**/{lib_name}
/usr/local/Cellar/**/{lib_name}

Where the "**" can be any set of folders and names. Where else can I look, it is not in /usr/local/lib where it states it should be. Even a symlink would be useful.

I need to find these files, how can I do that, even manually would be okay, but i'd prefer some script? Somehow the application can find these on my own computer when run, but otool lists me places (/usr/local/lib) where it cannot be found!

5
  • 1
    You just need a simple command like find / -name dylib to search every directory from the root on. To limit to /usr/local just add that to the command find /usr/local …
    – Allan
    Commented Apr 20, 2023 at 16:36
  • @Allan Ah, I was trying something else wrong, okay - lets give it a shot and see what it can find. I'd prefer an answer that looks in specific assumed directories for the dylib, but lets see what it finds. Two questions, one I get permission denied on some folders is that okay to skip? Also can I stop on found solution?
    – msj121
    Commented Apr 20, 2023 at 16:42
  • Permission denied is fine. find attempts to search everything including directories you don’t have permissions for. If you have no access to those directories, it’s a good bet your library won’t be there.
    – Allan
    Commented Apr 20, 2023 at 16:47
  • @Allan Thank you so much! Found so far most of them in /opt/local/lib Much appreciated! If you add your idea as an answer I will mark it correct
    – msj121
    Commented Apr 20, 2023 at 16:56
  • @msj121 If you /opt/local/lib then you put them there are need to be sure that they are what you want. They are probably installed via macports. If you did not put them there you need to check them as they could be old.
    – mmmmmm
    Commented Apr 20, 2023 at 17:04

2 Answers 2

1

I need to find these [.dylib] files, how can I do that, even manually would be okay, but i'd prefer some script?

A script isn’t necessary. A simple find command (see man find for more details) should suffice:

% find / -name dylib

You will likely get some “Permission Denied” errors - you can ignore these. This is find attempting to search a directory you don’t have access to. Chance are, if you don’t have access, your library won’t be located there.

0

Those are system libraries, they are in the dylib cache, not discrete files on the disk.

A good discussion is here, in the Apple Developer Fora.

2
  • I assume that means I do not need to package them, like libSystemB? How do I know which are included in the OS and which are not? Is it only by path or something else? I did find some of these on my computer, but are you suggesting to not use them? Thanks!
    – msj121
    Commented Apr 21, 2023 at 2:03
  • @msj121 You wouldn't package system libraries within your app bundle in any case. They're, well... system libraries. Commented Apr 22, 2023 at 14:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .