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

libwebsockets: improve cross-compilation support #115995

Merged

Conversation

Mindavi
Copy link
Contributor

@Mindavi Mindavi commented Mar 11, 2021

Building works on aarch64-multiplatform:

  • libwebsockets_3_1
  • libwebsockets_3_2
  • libwebsockets_4_0
  • libwebsockets_4_1

This patch disables building the test applications for libmosquitto in case you're cross-compiling. I don't think they're that important and this is the easiest fix for enabling cross-compilation.

If anyone cares enough about the test applications and wants to use them in a cross scenario, they could properly patch this. I'd assume that a patch would be the same for all versions, since I've seen this error at least on 3.1 and 4.1.

Error log without this patch
rick@nixos-asus:~/hobby/nixos-mobile-nixpkgs$ nix build https://github.com/nixos/nixpkgs/archive/master.tar.gz#pkgsCross.aarch64-multiplatform.libwebsockets_4_0
error: --- Error ----------------------------------------------------------------------------------------------- nix
builder for '/nix/store/lc966irnncjnppdnj4j6icpsbmkyjqvx-libwebsockets-4.0.21-aarch64-unknown-linux-gnu.drv' failed with exit code 2; last 10 log lines:
  -- Installing: /nix/store/z1h2gkdiqyqpp9fdpabf369pvqmrh387-libwebsockets-4.0.21-aarch64-unknown-linux-gnu/bin/libwebsockets-test-server-extpoll
  -- Installing: /nix/store/z1h2gkdiqyqpp9fdpabf369pvqmrh387-libwebsockets-4.0.21-aarch64-unknown-linux-gnu/bin/libwebsockets-test-lejp
  -- Installing: /nix/store/z1h2gkdiqyqpp9fdpabf369pvqmrh387-libwebsockets-4.0.21-aarch64-unknown-linux-gnu/bin/libwebsockets-test-client
  CMake Error at cmake_install.cmake:174 (file):
    file INSTALL cannot find
    "/build/source/build/libwebsockets-test-server.key.pem": No such file or
    directory.
  
  
  make: *** [Makefile:147: install] Error 1
Motivation for this change

libwebsockets is a dependency of mosquitto, and I tried cross-compiling mosquitto. It was easy to fix this dependency, so here we are.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • 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 nixpkgs-review --run "nixpkgs-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.

Note that I haven't actually tried running this (yet), but at least it compiles now, which is a step in the right direction IMO.

Building works on aarch64-multiplatform:

- libwebsockets_3_1
- libwebsockets_3_2
- libwebsockets_4_0
- libwebsockets_4_1
@Mindavi Mindavi added the 6.topic: cross-compilation Building packages on a different sort platform than than they will be run on label Mar 11, 2021
@SuperSandro2000
Copy link
Member

pinging @fabaff because there is no maintainer. Maybe one of you wants to add themselves?

@SuperSandro2000 SuperSandro2000 merged commit 1b6e2fb into NixOS:master Mar 12, 2021
@Mindavi Mindavi deleted the libwebsockets/cross-compilation-fix branch May 15, 2021 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: cross-compilation Building packages on a different sort platform than than they will be run on 10.rebuild-darwin: 0 10.rebuild-linux: 0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants