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

Workspace feature resolution for multiple binaries #1740

Open
CramBL opened this issue Feb 2, 2025 · 0 comments
Open

Workspace feature resolution for multiple binaries #1740

CramBL opened this issue Feb 2, 2025 · 0 comments

Comments

@CramBL
Copy link
Contributor

CramBL commented Feb 2, 2025

Description

It's somewhat related to the issue I have here: #1460

I now modified my approach to instead of attempting to statically link HDF5, I dynamically link it, but then I distribute two binaries, one that needs a system HDF5 installation and one that doesn't. I use a feature to guard the HDF5 dependency.

Then I run into the yet unsolved issue of workspace feature unification there's a (merged) RFC as well but it is a hard problem. If I just build with cargo build -p plotinator3000 I get a binary that does not link to hdf5, but if I build with cargo build --bins then both link to hdf5 because of the workspace feature unification issue.

This is where dist comes into the picture because how does dist build the binaries? Evidently through something like cargo build --bins because both binaries built by dist link to HDF5.

e.g. in this action log I build a workspace with multiple binaries (plotinator3000 and plotinator3000-h5), such that users can run a binary that doesn't require an HDF5 dynamic library on the system if they don't need HDF5 support. The example is the apple build but it is the same for all builds.

plotinator3000 (aarch64-apple-darwin)
┌────────────────────┬─────────────────────────────────────────────────────────────────────────────────────────┐
│ Category           ┆ Libraries                                                                               │
╞════════════════════╪═════════════════════════════════════════════════════════════════════════════════════════╡
│ System             ┆ /usr/lib/libSystem.B.dylib                                                              │
│                    ┆ /usr/lib/libbz2.1.0.dylib                                                               │
│                    ┆ /usr/lib/libiconv.2.dylib                                                               │
│                    ┆ /usr/lib/libobjc.A.dylib                                                                │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Homebrew           ┆ /opt/homebrew/opt/hdf5/lib/libhdf5.310.dylib (hdf5)                                     │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Public (unmanaged) ┆                                                                                         │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Frameworks         ┆ /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit                           │
│                    ┆ /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices │
│                    ┆ /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon                           │
│                    ┆ /System/Library/Frameworks/ColorSync.framework/Versions/A/ColorSync                     │
│                    ┆ /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation           │
│                    ┆ /System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics               │
│                    ┆ /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices               │
│                    ┆ /System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo                     │
│                    ┆ /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation                   │
│                    ┆ /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL                           │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Other              ┆                                                                                         │
└────────────────────┴─────────────────────────────────────────────────────────────────────────────────────────┘
plotinator3000-h5 (aarch64-apple-darwin)

┌────────────────────┬─────────────────────────────────────────────────────────────────────────────────────────┐
│ Category           ┆ Libraries                                                                               │
╞════════════════════╪═════════════════════════════════════════════════════════════════════════════════════════╡
│ System             ┆ /usr/lib/libSystem.B.dylib                                                              │
│                    ┆ /usr/lib/libbz2.1.0.dylib                                                               │
│                    ┆ /usr/lib/libiconv.2.dylib                                                               │
│                    ┆ /usr/lib/libobjc.A.dylib                                                                │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Homebrew           ┆ /opt/homebrew/opt/hdf5/lib/libhdf5.310.dylib (hdf5)                                     │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Public (unmanaged) ┆                                                                                         │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Frameworks         ┆ /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit                           │
│                    ┆ /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices │
│                    ┆ /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon                           │
│                    ┆ /System/Library/Frameworks/ColorSync.framework/Versions/A/ColorSync                     │
│                    ┆ /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation           │
│                    ┆ /System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics               │
│                    ┆ /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices               │
│                    ┆ /System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo                     │
│                    ┆ /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation                   │
│                    ┆ /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL                           │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Other              ┆                                                                                         │
└────────────────────┴─────────────────────────────────────────────────────────────────────────────────────────┘

Proposed solution

If I could control the build to use cargo build -p plotinator3000 and cargo build -p plotinator3000-h5 then I achieve what I need without having to wait for the Cargo team to figure out and implement workspace feature unification configuration options.

This issue of HDF5 linkage is becoming more and more of an issue for my project, I really want to keep using dist because it is a major benefit, but if I can't solve this issue in a way that doesn't bother users, then I have to consider another approach. I'm very open to suggestions btw, maybe there's a much better approach that I'm totally missing.

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

1 participant