Hi,
Openblas (https://www.openblas.net/) is a widely used BLAS library for scientific computing. The library builds just fine with MinGW on windows & arch linux.
Unfortunately, the Nix package does not support the x86_64-windows
platform, so my first idea (knowing that it should work fine) was to just manually add that platform and try to build it. However, this pulls mingw-w64-gcc
with gfortran
enabled, which fails to build: libgfortran error: unknown type name 'pthread_t'
.
Some additional digging seems to indicate some problem with the threads implementation used by MinGW (or maybe some configuration clash in the specific case of libgfortran
).
A solution which has been working great for me would be to use a fully binary MinGW release, for example the precompiled stuff from mingw-w64-builds download | SourceForge.net. But trying to package this for Nix seems over my head with my current knowledge of the Nix system.
Any ideas how to get this going on Nix so I won’t have to keep other distros/containers around just for crosscompilation?
EDIT: a minimal shell.nix
:
let
pkgs = import <nixpkgs> {
crossSystem = {
config = "x86_64-w64-mingw32";
libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain
};
};
openblas = pkgs.callPackage ./openblas.nix{}; # added windows platform
in
pkgs.stdenv.mkDerivation {
name = "test";
hardeningDisable = [ "all" ];
buildInputs = with pkgs; [ openblas ];
}