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

libusb1: enable compiling with musl #71563

Merged
merged 1 commit into from Oct 28, 2019

Conversation

cdepillabout
Copy link
Member

This PR enables compiling libusb1 with musl.

libusb1 can't depend on systemd in order to be compiled with musl, because systemd can't be built with musl.

Since systemd provides udev, udev support also needs to be disabled when building libusb1.

Motivation for this change

This is motivated by nh2/static-haskell-nix#50. I'd like to build GTK apps with musl. The gtk3 library depends on cups, which depends on libusb1.

You can try building this with the following command:

$ nix-build -A pkgsMusl.libusb1
...
/nix/store/qqq6bgrsxd28wqy4cd6npwcv4hz1d3qv-libusb-1.0.23
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

@cdepillabout
Copy link
Member Author

@GrahamcOfBorg build pkgsMusl.libusb1 libusb1

@cdepillabout
Copy link
Member Author

This is related to the following three PRs:

@cdepillabout cdepillabout mentioned this pull request Oct 21, 2019
10 tasks
@cdepillabout
Copy link
Member Author

@GrahamcOfBorg build pkgsMusl.libusb1

@cdepillabout
Copy link
Member Author

cdepillabout commented Oct 22, 2019

There was a good suggestion by @nh2 to add a top-level enableSystemd argument: #71575 (comment)

I have done this in f4fc02e.

You can see how this enableSystemd argument works:

$ nix-build -A libusb1
...
/nix/store/4v7wlxmhch7q9nvv125bzcdfzki5vzdv-libusb-1.0.23
$ nix show-derivation ./result | grep -i systemd
      "/nix/store/q42ibginb26cr9xs1vly9b5gxjjzzw3i-systemd-243.drv": [
...
$ nix-build -E 'with import ./. {}; libusb1.override { enableSystemd = false; }'
...
/nix/store/8awlhj1cmphpaycgvs742r4p7vya1gz5-libusb-1.0.23
$ nix show-derivation ./result | grep -i systemd # no deps on systemd...
$ nix-build -A pkgsMusl.libusb1
...
/nix/store/qqq6bgrsxd28wqy4cd6npwcv4hz1d3qv-libusb-1.0.23
$ nix show-derivation ./result | grep -i systemd # no deps on systemd
$

@cdepillabout
Copy link
Member Author

@GrahamcOfBorg build pkgsMusl.libusb1

libusb1 can't depend on systemd in order to be compiling with musl,
because systemd can't be built with musl.

Since systemd provides udev, udev support needs to be disabled when
building libusb1.
@nh2 nh2 force-pushed the libusb1-compiling-with-musl branch from f4fc02e to 08c0172 Compare October 26, 2019 15:03
@nh2
Copy link
Contributor

nh2 commented Oct 26, 2019

As in #71575 (comment), I've force-pushed a change that avoids Darwin mass rebuilds.

@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 370d483 into NixOS:master Oct 28, 2019
@cdepillabout cdepillabout deleted the libusb1-compiling-with-musl branch October 28, 2019 16:06
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

2 participants