Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cadebrown opened this issue Jul 23, 2018 · 2 comments
Open

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

cadebrown opened this issue Jul 23, 2018 · 2 comments

Comments

@cadebrown
Copy link

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!

@Iainmon
Copy link

Iainmon commented Feb 12, 2019

I had the same issue, and I fixed it by installing libui.

# Clone the https://github.com/andlabs/libui repo and cd into it.
$ mkdir build
$ cd build
$ cmake .. -DBUILD_SHARED_LIBS=OFF
$ make
$ sudo cp -a ./out/. /usr/local/lib/

@Iainmon
Copy link

Iainmon commented Apr 27, 2019

Fixed the issue, check out my makefile I made to solve this : https://github.com/Iainmon/macOS-crystal-packaging/blob/master/Makefile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants