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

cups: enable compiling with musl #71575

Merged
merged 1 commit into from Oct 28, 2019

Conversation

cdepillabout
Copy link
Member

This PR enables cups to be able to be compiled with pkgsMusl.

cups can't depend on systemd when being compiled with pkgsMusl, because it is not possible to build systemd with pkgsMusl.

Motivation for this change

This is for nh2/static-haskell-nix#50. I'd like to get GTK compiling with pkgsMusl, and GTK has a dependency on cups.

This can be tested like the following:

$ nix-build -A pkgsMusl.cups
...
/nix/store/mw3v16g8qbyr10dwz18krpssilpap67c-cups-2.2.12
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @nh2 @domenkozar @matthewbauer

@cdepillabout
Copy link
Member Author

Note that currently there are 3 commits in this PR. However, two of them are from other PRs, and shouldn't be included when this is merged in.

This PR should only be merged in after the following two have been merged in:

The only commit that is relevant to this PR (well, cups), is 317cd4d.

@cdepillabout
Copy link
Member Author

@GrahamcOfBorg build cups

@GrahamcOfBorg build pkgsMusl.cups

@cdepillabout
Copy link
Member Author

This is related to the following three PRs:

@matthewbauer
Copy link
Member

Systemd /should/ build on Musl right? Perhaps some patch exists for it?

@cdepillabout
Copy link
Member Author

@matthewbauer As far as I am aware, it is difficult to get systemd to build with musl:

https://github.com/NixOS/rfcs/blob/master/rfcs/0023-musl-libc.md#big-incompatibilities

I think @nh2 has done a lot of work getting stuff building in pkgsMusl. Maybe he can say something about systemd?

@flokli
Copy link
Contributor

flokli commented Oct 21, 2019

Feedback to things like https://lists.freedesktop.org/archives/systemd-devel/2014-September/023177.html was mostly constructive IMHO.

I think in general systemd upstream seems to be fine with accepting patches enhancing musl compat, it might be just more complicated if it's about things not provided by the libc, if there's different opinions on whether it should be in there or not.

Another thread from systemd/casync: systemd/casync#129 (comment)

@flokli
Copy link
Contributor

flokli commented Oct 21, 2019

That being said, removing systemd in case of building with musl might be a good workaround for now, but having a musl-based systemd might become interesting for NixOS-on-whatever-device setups :-)

@cdepillabout
Copy link
Member Author

This has the 10.rebuild-linux: 2501-5000 tag. Would it be better to go into staging?

pkgs/misc/cups/default.nix Outdated Show resolved Hide resolved
@nh2
Copy link
Contributor

nh2 commented Oct 22, 2019

On the point of systemd + musl compatibility:

Upstream support for making systemd support building on musl is mixed.

systemd maintainers are mostly of the opinion that they should use glibc functions they consider useful, as opposed to re-implementing them (code duplication) to support other libcs.

I think one could say they consider glibc a more of a "normal library dependency" that provides the functions they want, and not a "minimal portable standard".

On the functions that systemd uses that glibc has and musl does not, the opinions diverge on whether they are are useful or good to have in a libc.

I personally forecast that systemd and musl slowly get together over time, but don't expect that this is very soon, so I think the approach in this PR to disable it for now is exactly the right choice.

@nh2
Copy link
Contributor

nh2 commented Oct 22, 2019

@cdepillabout Another request across your 4 PRs (not a blocker but a nice-to-have):

Could you make enableSystemd ? (stdenv.isLinux && !stdenv.hostPlatform.isMusl) a parameter (top-level argument) of each package?

That would allow us to easily turn off systemd deps even when using glibc, which would be convenient to quickly check whether things are fine with glibc in situations where the musl builds are broken. It would also be in line with how other packages are written.

@cdepillabout
Copy link
Member Author

Could you make enableSystemd ? (stdenv.isLinux && !stdenv.hostPlatform.isMusl) a parameter (top-level argument) of each package?

This has been done in 3a4584c. Thanks for the suggestion!

@cdepillabout
Copy link
Member Author

@GrahamcOfBorg build pkgsMusl.cups

@nh2
Copy link
Contributor

nh2 commented Oct 26, 2019

This has the 10.rebuild-linux: 2501-5000 tag. Would it be better to go into staging?

I've force-pushed a slightly reworked version of the patch that keeps the original order of buildInputs, so that on non-musl, this should not create any changes.

@cdepillabout
Copy link
Member Author

@nh2 Didn't realize this was the thing forcing the mass rebuild! Thanks for catching and fixing this!

When compiling `cups` with `pkgsMusl`, `cups` can't depend on `systemd`
because `systemd` is not able to be built with musl.
@nh2
Copy link
Contributor

nh2 commented Oct 28, 2019

Rebased on master

@nh2
Copy link
Contributor

nh2 commented Oct 28, 2019

This has worked fine for me in static-haskell-nix so far, and no changes for non-musl; merging.

@nh2 nh2 merged commit 664823c into NixOS:master Oct 28, 2019
@cdepillabout cdepillabout deleted the cups-compiling-with-musl branch October 28, 2019 19:42
@cdepillabout
Copy link
Member Author

@nh2 Thanks for fixing up these four PRs and merging them in :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants