HaxeFoundation / HaxeFoundation/haxe
Can't find a way to let `haxelib called from haxe` find local libneko if none is installed globally
Nobody has claimed this yet.
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
I'm trying to make haxe & haxelib work as self-contained binaries without the need of installing haxe, haxelib or neko globally on the computer.
I managed to get something almost working following @nadako's gist to set proper environment variables: https://gist.github.com/nadako/f15f6c03c15f8f8e244a124b615febb7
That is, before calling haxe or haxelib I ensure I set these environment variables:
PATH (add paths to haxe/haxelib & neko)
HAXEPATH
HAXE_STD_PATH
HAXELIB_PATH
NEKOPATH
DYLD_FALLBACK_LIBRARY_PATH (let it point to neko directory)
haxelib works if I call it explicitly, it can find neko thanks to the environment variables and we are good to go
haxe seems to work as long as it doesn't use haxelib internally. But as soon as it needs haxelib (to resolve dependencies when building a hxml file for instance), it fails because it can't find libneko:
Error: dyld: Library not loaded: @rpath/libneko.2.dylib
Referenced from: (...)/haxe/haxelib
Reason: image not found
I provide the same environment variables when calling haxe and haxelib, but somehow when haxe calls haxelib internally, it doesn't seem to propagate these environment variables and haxelib fails to find libneko.
Currently, if I want that to work, I have to create additional symbolic links to /usr/local/lib like this so that libneko can be found from default env variable, but I would like to avoid it as it breaks the "self-contained" goal:
ln -s $NEKOPATH/libneko.dylib /usr/local/lib/libneko.dylib
ln -s $NEKOPATH/libneko.2.1.0.dylib /usr/local/lib/libneko.2.1.0.dylib
ln -s $NEKOPATH/libneko.2.dylib /usr/local/lib/libneko.2.dylib
Is there a way I don't know of to solve that, or could there be an option to let haxe propagate the env variables we gave it into its haxelib calls?
Experiencing this on macOS, testing on a machine without any haxe/haxelib/neko installed globally (on purpose).
Issue is probably similar on linux. Can't say for Windows as it may work differently.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source files or tests are named. Start by reproducing the macOS self-contained setup, comparing direct haxelib invocation with haxe's internal haxelib call and the environment each receives. Done means dependency resolution works without globally installed Haxe, haxelib, or Neko and without /usr/local/lib symlinks.
Written by the indexing model from the issue text.
Assessment
- Domain
- build-system, compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100