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

rtl-sdr: fix cross compilation #82412

Merged
merged 1 commit into from Mar 13, 2020

Conversation

Mindavi
Copy link
Contributor

@Mindavi Mindavi commented Mar 12, 2020

This patch partially fixes #81985.
Cross-compiling rtl-sdr is possible using this patch.
Use nix build -f -A pkgsCross.raspberryPi.rtl-sdr to build rtl-sdr.

The error that occured when trying to do this before was as follows:

/nix/store/ldb2v2z0198abkp2minr9a9vz5np4mn4-cmake-3.16.4-armv6l-unknown-linux-gnueabihf/nix-support/setup-hook: line 107: cmake: command not found

Motivation for this change

I want to be able to cross-compile rtl_433 using NixOS. This is a first step towards that goal.

Things done
  • Is on by default? 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
  • Seems N/A Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Not sure how this works 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/)
    • note: this fails because it's cross-compiled, but the cross-compiled binary is of the correct type (ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /nix/store/b996ssrajnrjkni0fz3k7ihrp0m77ahr-glibc-2.30-armv6l-unknown-linux-gnueabihf/lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.32, not stripped )
  • Expect low impact Determined the impact on package closure size (by running nix path-info -S before and after)
  • N/A Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Should this be merged to master or to another branch? I can't tell what's expected here.

Copy link
Contributor

@bjornfor bjornfor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmake should be moved from buildInputs to nativeBuildInputs. It should not appear both places.

This patch partially fixes NixOS#81985.
Cross-compiling rtl-sdr is possible using this patch.
Use nix build -f <nixpkgs-path> -A pkgsCross.raspberryPi.rtl-sdr to build rtl-sdr.

The error that occured when trying to do this before was as follows:

/nix/store/ldb2v2z0198abkp2minr9a9vz5np4mn4-cmake-3.16.4-armv6l-unknown-linux-gnueabihf/nix-support/setup-hook: line 107: cmake: command not found
@Mindavi Mindavi force-pushed the feature/rtl-sdr-cross-compilation branch from 8674b89 to 379e3d5 Compare March 12, 2020 19:13
@Mindavi
Copy link
Contributor Author

Mindavi commented Mar 12, 2020

I've moved it, thanks for the quick review.

@ofborg ofborg bot requested a review from bjornfor March 12, 2020 19:19
@bjornfor bjornfor merged commit 91c4571 into NixOS:master Mar 13, 2020
@bjornfor
Copy link
Contributor

Thanks!

@Mindavi Mindavi deleted the feature/rtl-sdr-cross-compilation branch November 21, 2021 17:33
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.

Cross compiling rtl-sdr and rtl_433 fails
3 participants