Pregunta

This is similar to this question: On OS X, how do I find out what architecture a shared lib is compiled for?

Except I want to know if a .dylib will run on 10.5.x or 10.4, for instance.

¿Fue útil?

Solución

Run otool -L on the .dylib. That will show you the libraries it depends on and their compatibility versions. Then, run otool -L against the libraries from the OS of interest. That will show you (on the first line) the current version of that library. If the current version is at least the compatibility version, then that library can be used by your .dylib. Repeat for all of the libraries.

There's not much of a shortcut. A .dylib doesn't directly contain any explicit indication of what SDK it was linked against. It only indirectly and implicitly does so via the library dependencies.

If the .dylib links against a central system library, such as /usr/lib/libSystem.B.dylib (which is likely), then you can use compatibility with that one library as a proxy for compatibility with the OS version as a whole.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top