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/libneko.2.dylib #4

Closed
smorimoto opened this issue Mar 10, 2020 · 15 comments · Fixed by #5 or #7
Closed

dyld: Library not loaded: @rpath/libneko.2.dylib #4

smorimoto opened this issue Mar 10, 2020 · 15 comments · Fixed by #5 or #7
Labels
help wanted Extra attention is needed

Comments

@smorimoto
Copy link
Member

The haxelib command seems to require this Dynamic Library, which is not included in the files available for download from the haxe repository. So I created a plugin for neko that includes that Dynamic Library, but is there a good way to interoperate the haxe and neko plugins?

@smorimoto
Copy link
Member Author

CC: @vic

@smorimoto smorimoto added the help wanted Extra attention is needed label Mar 10, 2020
@vic
Copy link
Member

vic commented Mar 10, 2020

Not really sure what's happening (I have no experience at all using haxe+neko) but from reading this issue: HaxeFoundation/neko#98 it looks like you might want to try and set NEKOPATH to include the location of libneko.2.dylib.

I'd recommend first trying to make the command work manually (try setting the PATH and NEKOPATH yourself to anything that works) and once you have that, you might want to create a bin/exec_env file for your plugin which can export environment variables needed by your plugin tools. Also you can provide custom shims (wrappers) around the shipped binaries that can try to determine the environment on behalf of the user.

For a working example, you might want to take a look at asdf-elixir which has it's own mix shim (overriding the one distributed) and also exposes custom env on it's bin/exec_env.

Hope any of this can be of help.

@smorimoto
Copy link
Member Author

If the neko plugin exports NEKOPATH from exec-env as follows, will it be available from the haxe plugin?

#!/usr/bin/env bash

if [ "$NEKOPATH" = "" ]; then
  export NEKOPATH=$ASDF_INSTALL_PATH/bin
fi

@vic
Copy link
Member

vic commented Mar 10, 2020

Hm, no.. In normal asdf (without something like asdf-direnv), the plugin's exec-env file is sourced just prior to executing a tools binary. In this case, if the snippet above is part of neko-plugin/bin/exec-env it will only be sourced prior execution of binaries from the neko plugin.

What you want is haxe-plugin/bin/exec-env which would have to determine if there's an empty NEKOPATH, and if so, it should see if there's a current asdf-managed neko version available (perhaps using asdf current neko and trying to set NEKOPATH to the location of currently selected neko)

In the case of asdf-direnv all exec-env files are sourced just one, creating a big whole environment with everything set. But your plugin should not depend on asdf-direnv being used I guess.

@vic
Copy link
Member

vic commented Mar 10, 2020

@imbsky Just pushed a quick-n-dirty PR for you :D.

If you update your neko plugin, it now exports the NEKOPATH variable, and I'm trying to use that from this plugin.

@smorimoto smorimoto reopened this Mar 11, 2020
@smorimoto
Copy link
Member Author

I have seen that NEKOPATH works well in other cases, but it does not seem to work with this dynamic library problem. Is there a way to enable the Haxe plugin to handle certain files under the Neko plugin's bin directory? I still don't understand correctly if shims can do that.

@vic
Copy link
Member

vic commented Mar 11, 2020

Hm, maybe if you provide an example project I could reproduce the problem and get what you mean by enable the Haxe plugin to handle certain files under Neko's bin directory.

Could you provide an example of what's happening ?

@smorimoto
Copy link
Member Author

Ah, sorry, my English is not very good. For example, is it possible to have the neko's libneko.2.dylib in the haxe plugin's bin directory?

@smorimoto
Copy link
Member Author

It's better to pretend it exists rather than actually copying it, but it doesn't matter.

@vic
Copy link
Member

vic commented Mar 13, 2020

Your English is pretty good :)

It's just that I'm not understanding the problem since I'm not a haxe+neko user and can't properly tell what's the best solution. Perhaps I should try using both of these plugins and try to reproduce the problem to better understand what's happenning.

Could you provide a minimal hello-world or something I could run with haxe+neko so that I can see that libneko.2.dylib problem?

@smorimoto
Copy link
Member Author

Thank you for your kind words! You will probably get the same problem just by running haxelib version.

@as790
Copy link

as790 commented Mar 26, 2020

Hi
Can yuo help meeeee

@Gi0rgi0s
Copy link

Gi0rgi0s commented Apr 8, 2020

I am still seeing this issue, and yes I get it just by running haxelib version
While I can't tell you what version I'm using, I can tell you the md5 of the executable is b468a2704b535080252a95a6aacd66d8

@smorimoto
Copy link
Member Author

@Gi0rgi0s
Copy link

Gi0rgi0s commented Apr 17, 2020

@imbsky Thanks for the help. I'm sorry to say this isn't working for me. Your help is appreciated 👍

$ haxelib
dyld: Library not loaded: @rpath/libneko.2.dylib
Referenced from: /Users/****/.asdf/installs/haxe/3.4.7/bin/haxelib
Reason: image not found
Abort trap: 6

$ asdf current neko
2.0.0 (set by /Users/****/.tool-versions)
$ asdf current haxe
3.4.7 (set by /Users/****/.tool-versions)

$ asdf haxe neko dylibs link
/Users/****/.asdf/installs/haxe/3.4.7/bin/libneko.dylib -> /Users/****/.asdf/installs/neko/2.0.0/bin/libneko.dylib

$ which neko
/Users/****/.asdf/shims/neko
$ which haxe
/Users/****/.asdf/shims/haxe

$ sw_vers
ProductName: Mac OS X ProductVersion: 10.14.6 BuildVersion: 18G87

$ haxelib
dyld: Library not loaded: @rpath/libneko.2.dylib
Referenced from: /Users/****/.asdf/installs/haxe/3.4.7/bin/haxelib
Reason: image not found
Abort trap: 6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
4 participants