Tweak 04
[?]
Mar 22, 2023, 2:12 PM
WK2OO4YYGVZKCIVSA43GW3WDUQ4UEUHF2GGY4WNWOZYISPFYWMDACDependencies
Change contents
- edit in 04-cmake-and-cross/flake.nix at line 26[5.4591][3.701]
# The 'default' package is the package injected into our package set - edit in 04-cmake-and-cross/flake.nix at line 28[3.747][5.4895]
# But the package set also has a pkgsCross set, and we can select our package from one of its contentspackages.cross-riscv64 = pkgs.pkgsCross.riscv64.wttr-delft; - replacement in 04-cmake-and-cross/demo.sh at line 15
, Packaging in this way and making use of the sandboxed Nix build process can hepl find missing dependencies etc., Packaging in this way and making use of the sandboxed Nix build process, can help find dependencies that were not correctly declared etc. - edit in 04-cmake-and-cross/demo.sh at line 33
, The previous build was for x86_64-linux by default because that is our current system:x "${file_cmd}" ./result/bin/wttr-delft - replacement in 04-cmake-and-cross/demo.sh at line 36
, We can very easily set up cross-compilation.h We can very easily set up cross-compilation. - replacement in 04-cmake-and-cross/demo.sh at line 40
, If we take a look at what the flake provides:, Now we can call a different output:x nix build "${dir}#cross-riscv64", And this is indeed a RISC-V binary:x "${file_cmd}" ./result/bin/wttr-delfth Emulation, If we take a look at what the flake provides we see multiple architectures as well: - replacement in 04-cmake-and-cross/demo.sh at line 49
h The previous build was for x86_64-linux by default because that is our current system:x "${file_cmd}" ./result/bin/wttr-delftn This will not work if the emulation is not available:, But, if you use NixOS it\'s also very simple to set up binfmt to emulate e.g. aarch64-linux! - edit in 04-cmake-and-cross/demo.sh at line 52
h But we can easily build for aarch64-linux \(e.g. for Raspberry Pi\): - edit in 04-cmake-and-cross/demo.sh at line 55
n If you use NixOS it\'s also very simple to set up binfmt to still be able to run the binary!