Skip to content

macOS build creates symlinks for dylibs, leading to incorrect linkage #1560

Open
@fatcerberus

Description

Building Allegro for macOS creates several dylibs for each Allegro component, like this:

liballegro.dylib
liballegro.5.2.dylib
liballegro.5.2.10.dylib
etc.

with the one having the full version number being the real one and the rest being symlinks. However this causes problems because:

Load command 4
          cmd LC_ID_DYLIB
      cmdsize 56
         name @rpath/liballegro.5.2.dylib (offset 24)
   time stamp 1 Wed Dec 31 19:00:01 1969
      current version 5.2.10
compatibility version 5.2.0

The install name in the dylib refers to one of the symlinks. Then, when one of these is imported into e.g. an Xcode project, Xcode follows the symlink and pulls in the real file - which, if dylibs are bundled with the app, leads to the OS being unable to load them because the name the linker used in the executable (taken from LC_ID_DYLIB) doesn't match the name of the file that actually got bundled. In other words, liballegro.5.2.10.dylib is what gets bundled, but the OS tries to load liballegro.5.2.dylib at runtime, and the app crashes on startup.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions