| 10 Feb 2025 |
trofi | loongarch64's libgcc is broken: https://github.com/NixOS/nixpkgs/pull/381016 | 23:18:42 |
| 12 Feb 2025 |
| Kira changed their display name from kira to Kira. | 19:59:44 |
| 14 Feb 2025 |
bitestring | Hi, can anyone please help me how to get started on cross-compilation. Documentation is very confusing and scattered across multiple places. I want to get GHC compiler than can compile my Haskell code to both ARM64 Linux and ARM64 Android. However I do not know where to get started. I tried the following flake.nix
{
description = "Haskell Playground";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
};
outputs =
{
self,
nixpkgs,
}:
let
pkgsBuildSystem = import nixpkgs {
localSystem = "x86_64-linux"; # buildPlatform
config = {
android_sdk.accept_license = true;
allowUnfree = true;
};
};
pkgs = pkgsBuildSystem.pkgsCross.aarch64-android-prebuilt;
hs = pkgs.haskell.packages."ghc966"; # need to match Stackage LTS version from stack.yaml resolver
ghc = hs.ghc.override {
enableRelocatedStaticLibs = true;
enableShared = true;
};
buildDependencies = with pkgs; [
# --- System ---
zlib
# Haskell deps
stack
ghc # GHC compiler in the desired version (will be available on PATH)
];
in
{
formatter = pkgs.nixfmt-rfc-style;
packages.aarch64-android.default = pkgs.mkShell {
buildInputs = [ ];
nativeBuildInputs = buildDependencies;
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildDependencies;
};
};
}
However nix develop fails with
./zconf.h:446:14: fatal error: 'sys/types.h' file not found
| 13:14:55 |
bitestring | * Hi, can anyone please help me how to get started on cross-compilation. Documentation is very confusing and scattered across multiple places. I want to get GHC compiler than can compile my Haskell code to both ARM64 Linux and ARM64 Android. However I do not know where to get started. I tried the following flake.nix
{
description = "Haskell Playground";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
};
outputs =
{
self,
nixpkgs,
}:
let
pkgsBuildSystem = import nixpkgs {
localSystem = "x86_64-linux"; # buildPlatform
config = {
android_sdk.accept_license = true;
allowUnfree = true;
};
};
pkgs = pkgsBuildSystem.pkgsCross.aarch64-android-prebuilt;
hs = pkgs.haskell.packages."ghc966"; # need to match Stackage LTS version from stack.yaml resolver
ghc = hs.ghc.override {
enableRelocatedStaticLibs = true;
enableShared = true;
};
buildDependencies = with pkgs; [
zlib
stack
ghc # GHC compiler in the desired version (will be available on PATH)
];
in
{
formatter = pkgs.nixfmt-rfc-style;
packages.aarch64-android.default = pkgs.mkShell {
buildInputs = [ ];
nativeBuildInputs = buildDependencies;
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildDependencies;
};
};
}
However nix develop fails with
./zconf.h:446:14: fatal error: 'sys/types.h' file not found
| 13:16:14 |
alexfmpe | Yeah, android has regressed quite a bit | 16:17:18 |
alexfmpe | It worked a few years back, not sure to which extent | 16:17:27 |
alexfmpe | For haskell I mean | 16:17:43 |
emily | nobody really puts effort into maintaining Android and iOS upstream in Nixpkgs so they don't really work | 16:17:53 |
alexfmpe | A few months ago I found some low hanging fruit and managed to build non TH libs | 16:18:04 |
alexfmpe | https://github.com/NixOS/nixpkgs/pull/355543 | 16:18:06 |
alexfmpe | But rebasing this on recent nixpkgs yielded the same results you're seeing | 16:18:24 |
alexfmpe | You might want to try haskell.nix in the meantime | 16:19:00 |
Randy Eckenrode | I don’t even know what iOS support would look like in nixpkgs. Pretty much everything assumes Darwin = macOS. | 16:19:30 |
Randy Eckenrode | (I know there is/was some support, but it’s been broken for a while.) | 16:19:45 |
Randy Eckenrode | It’s also such a bad idea due to App Store rules. You’re better off using xcodenv. | 16:20:01 |
alexfmpe | In reply to @alexfmpe:matrix.org You might want to try haskell.nix in the meantime Loathe as I am of perpetuating critical mass for company managed turfs | 16:20:22 |
alexfmpe | In reply to @reckenrode:matrix.org It’s also such a bad idea due to App Store rules. You’re better off using xcodenv. I remember this debate happening a couple times but I don't think I'll be able to get acquainted enough to have an opinion on mobile until at least 8.10 ghcjs is dead | 16:23:09 |
alexfmpe | At any rate the original question was for android, which seems more amenable and where there's more current progress | 16:24:04 |
Randy Eckenrode | iOS was mentioned, so I felt it was worth speaking up about. There is not a lot of available Darwin bandwidth. I’d rather not spend it on fringe use cases when there’s still a lot that can be done to improve the common case. | 16:29:20 |
emily | fwiw still personally happy to mentor bringing iOS support up to date in line with my previous statements about how it should work :P | 17:20:06 |
emily | I think if done right it would be cleanly-factored enough to not impose burden on macOS. and also it doesn't seem that hard to inject the Xcode toolchain as previously discussed, which should be entirely within the rules. though that should be a later project. | 17:20:40 |
Tristan Ross | In reply to @emilazy:matrix.org nobody really puts effort into maintaining Android and iOS upstream in Nixpkgs so they don't really work We've got an Android team now so the effort is starting. | 17:25:21 |
| @rosssmyth:matrix.org joined the room. | 17:33:58 |
@rosssmyth:matrix.org | Hello. I am trying to clean up my build process. I am attempting to use the arm-embedded cross pkg. My derivation looks something like
{
pkgs,
stdenv,
optLevel ? "debug",
}:
stdenv.mkDerivation {
nativeBuildInputs = with pkgs.pkgsBuildHost; [meson ninja gnused srecord];
name = "Jordan";
src = pkgs.lib.cleanSource ./.;
doCheck = false;
mesonBuildType = optLevel;
dontStrip = true;
strictDeps = true;
}
and then it is called with
default = pkgs.pkgsCross.arm-embedded.callPackage ./default.nix {};
This fails with the error
error: attribute 'version' missing
at /nix/store/1d49vqvzrcx28yjj0rrwxr2dfy15rkp6-source/pkgs/os-specific/linux/systemd/default.nix:119:59:
118| # assumes hard floats
119| && (stdenv.hostPlatform.isAarch -> lib.versionAtLeast stdenv.hostPlatform.parsed.cpu.version "6")
| ^
120| # see https://github.com/NixOS/nixpkgs/pull/194149#issuecomment-1266642211
The build target is armv6m, and I am building on x86. Is there some way to provide it the info it needs?
Note that if I instance a dedicated cross instance with
armPkgs = import nixpkgs { crossSystem = { config = "armv6m-none-none-eabi"; libc="newlib"; }; };
armPkgs.callPackage ./default.nix {};
It almost works (it gets to the build stage but hits an error I've not seen with the arm-embedded compiler), but it requires compiling GCC from source.
| 17:45:18 |
@rosssmyth:matrix.org | * Hello. I am trying to clean up my build process. I am attempting to use the arm-embedded cross pkg. My derivation looks something like
{
pkgs,
stdenv,
optLevel ? "debug",
}:
stdenv.mkDerivation {
nativeBuildInputs = with pkgs.pkgsBuildHost; [meson ninja gnused srecord];
name = "MyProject";
src = pkgs.lib.cleanSource ./.;
doCheck = false;
mesonBuildType = optLevel;
dontStrip = true;
strictDeps = true;
}
and then it is called with
default = pkgs.pkgsCross.arm-embedded.callPackage ./default.nix {};
This fails with the error
error: attribute 'version' missing
at /nix/store/1d49vqvzrcx28yjj0rrwxr2dfy15rkp6-source/pkgs/os-specific/linux/systemd/default.nix:119:59:
118| # assumes hard floats
119| && (stdenv.hostPlatform.isAarch -> lib.versionAtLeast stdenv.hostPlatform.parsed.cpu.version "6")
| ^
120| # see https://github.com/NixOS/nixpkgs/pull/194149#issuecomment-1266642211
The build target is armv6m, and I am building on x86. Is there some way to provide it the info it needs?
Note that if I instance a dedicated cross instance with
armPkgs = import nixpkgs { crossSystem = { config = "armv6m-none-none-eabi"; libc="newlib"; }; };
armPkgs.callPackage ./default.nix {};
It almost works (it gets to the build stage but hits an error I've not seen with the arm-embedded compiler), but it requires compiling GCC from source.
| 17:45:33 |
@rosssmyth:matrix.org | * Hello. I am trying to clean up my build process. I am attempting to use the arm-embedded cross pkg. My derivation looks something like
{
pkgs,
stdenv,
optLevel ? "debug",
}:
stdenv.mkDerivation {
nativeBuildInputs = with pkgs.pkgsBuildHost; [meson ninja gnused srecord];
name = "MyProject";
src = pkgs.lib.cleanSource ./.;
doCheck = false;
mesonBuildType = optLevel;
dontStrip = true;
strictDeps = true;
}
and then it is called with
default = pkgs.pkgsCross.arm-embedded.callPackage ./default.nix {};
This fails with the error
error: attribute 'version' missing
at /nix/store/1d49vqvzrcx28yjj0rrwxr2dfy15rkp6-source/pkgs/os-specific/linux/systemd/default.nix:119:59:
118| # assumes hard floats
119| && (stdenv.hostPlatform.isAarch -> lib.versionAtLeast stdenv.hostPlatform.parsed.cpu.version "6")
| ^
120| # see https://github.com/NixOS/nixpkgs/pull/194149#issuecomment-1266642211
The build target is armv6m, and I am building on x86. Is there some way to provide it the info it needs?
Note that if I instance a dedicated cross instance with
armPkgs = import nixpkgs { crossSystem = { config = "armv6m-none-none-eabi"; libc="newlib"; }; };
armPkgs.callPackage ./default.nix {};
It almost works (it gets to the build stage but hits an error I've not seen with the arm-embedded compiler), but it requires compiling GCC from source which is not really needed.
| 17:46:29 |
Artturin | No version here https://github.com/NixOS/nixpkgs/blob/795a271ba11f5a7875e314d2d197a7bd361e695f/lib/systems/parse.nix#L111 | 17:53:43 |
Artturin | arm-embedded is arm-none-eabi | 17:54:04 |
Artturin | Theres no way to know the cpu.version for arm-none-eabi | 17:55:19 |
Artturin | * I think theres no way to know the cpu.version for arm-none-eabi from the name | 17:55:28 |