Skip to content

dyld: Library not loaded: @rpath/libui.A.dylib #10

@cadebrown

Description

@cadebrown

Hello,

I see the note in the readme which advises to add -L$(pwd) as a linker flag to avoid this error, but I am still getting it. (I'm on macos)

My project structure is essentially:

  • TESTAPP/
    • lib/
      • libui/
    • src/

When I try to do a crystal build, it reports no errors, and generates an executable ./TESTAPP, but hen I try to run it I get the "library not loaded" error

Here's the first of the output of otool -L ./TESTAPP:

./TESTAPP:
        @rpath/libui.A.dylib (compatibility version 0.0.0, current version 0.0.0)
...<< other libraries that are found >>

This problem may have something to do with my installation set up, because I have installed libui through homebrew, and my path is non standard. However, I have LD_LIBRARY_PATH and DYLD_LIBRARY_PATH set up to handle this, and it works with other libraries, but I could have missed something common.

I can get the program to run fine by running the command:

install_name_tool -change "@rpath/libui.A.dylib" "/Users/cadebrown/programs/homebrew/lib/libui.dylib" ./TESTAPP

Which manually changes it to the explicit value of the dynamic library. But, I have to do this on each crystal build and I'd rather not have a Makefile to automate this and just use crystal's system directly.

Any help would be much appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions