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

py-rattler install with a relative prefix path results in invalid dynamic library dependency paths #1037

Open
2 tasks done
calebzulawski opened this issue Jan 31, 2025 · 5 comments

Comments

@calebzulawski
Copy link
Contributor

calebzulawski commented Jan 31, 2025

Checklist

  • I added a descriptive title
  • I searched open reports and couldn't find a duplicate

What happened?

After switching from mamba to py-rattler in my project, I started getting occasional strange behavior where files couldn't be found. Consider an environment conda with ncurses installed:

$ otool -L conda/lib/libncurses.6.dylib
conda/lib/libncurses.6.dylib:
	@rpath/libncurses.6.dylib (compatibility version 6.0.0, current version 6.0.0)
	conda/lib/libtinfo.6.dylib (compatibility version 6.0.0, current version 6.0.0, reexport)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.0.0)

Shouldn't libtinfo.6.dylib be one of @loader_path/libtinfo.6.dylib or perhaps @loader_path/../lib/libtinfo.6.dylib?

Edit:

I see that LC_RPATH is set to @loader_path/, so I believe it should be @rpath/libtinfo.6.dylib or @rpath/../lib/libtinfo.6.dylib

Additional Context

No response

@calebzulawski calebzulawski changed the title py-rattler produces surprising rpaths on shared binaries py-rattler doesn't use rpath for shared library dependencies Jan 31, 2025
@wolfv
Copy link
Contributor

wolfv commented Jan 31, 2025

Is this only with the most recent py-rattler releases? We changed to use "abi3" format and that might have triggered this.

@calebzulawski
Copy link
Contributor Author

I was able to test as far back as 0.6.0 and it had the same behavior.

@calebzulawski
Copy link
Contributor Author

Upon further inspection, it looks like ncurses is the only package in my entire package cache that has a placeholder dynamic dependency:

/Users/runner/miniforge3/conda-bld/ncurses_1738195744584/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_p/lib/libtinfo.6.dylib (compatibility version 6.0.0, current version 6.0.0, reexport)

Every other dylib already has @rpath

@calebzulawski
Copy link
Contributor Author

Looks like I was a little wrong, the placeholder is supposed to be replaced with the full path. I was able to fix my build by calling pathlib.Path.absolute on the prefix! It seems like maybe that should be done by rattler to avoid this bug?

@calebzulawski calebzulawski changed the title py-rattler doesn't use rpath for shared library dependencies py-rattler install with a relative prefix path results in invalid dynamic library dependency paths Jan 31, 2025
@baszalmstra
Copy link
Collaborator

Makes sense! Would you be able to submit a Pr?

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

3 participants