pixi icon indicating copy to clipboard operation
pixi copied to clipboard

DYLD_LIBRARY_PATH should be updated with pixi path

Open zhuoqiang opened this issue 9 months ago • 1 comments

Checks

  • [x] I have checked that this issue has not already been reported.

  • [x] I have confirmed this bug exists on the latest version of pixi, using pixi --version.

Reproducible example

build some binary in mac os that depends on python using pixi and then run the binary

pixi add python
pixi r make
pixi r some-binary-depends-on-python

it will output error:

dyld[97647]: Library not loaded: @rpath/libpython3.12.dylib

Issue description

update the env manually could fix the issue

[project]
channels = ["conda-forge"]
name = "abc"
platforms = ["osx-arm64"]

[dependencies]
python = "==3.12.10"

[tasks]
xmake = {cmd="xmake", env={DYLD_LIBRARY_PATH="$PIXI_PROJECT_ROOT/.pixi/envs/default/lib:$DYLD_LIBRARY_PATH"}}

Expected behavior

pixi run command should setup DYLD_LIBRARY_PATH prepended with $PIXI_PROJECT_ROOT/.pixi/envs/default/lib automatically, just as PATH env variable

zhuoqiang avatar Apr 13 '25 00:04 zhuoqiang

In general this sounds like a binary was built in a wrong way. Usually the rpath is injected in the dylib so that it is relative to the path of the library, whcih makes it unecessary to do anything with the DYLD_LIBRARY_PATH.

If your software is open source I would be happy to take a look at the package / the recipe.

If not, you can use otool to find out what's wrong and look in the recipe wheter relocation patching was disabled.

wolfv avatar Apr 13 '25 08:04 wolfv

There is nothing actionable here for us, but feel free to reopen if you have more questions!

lucascolley avatar Aug 15 '25 12:08 lucascolley