Are many packages in pkgsCross.mingwW64 just broken?

I’m trying to get a basic cross compilation setup. I’ve read the cross compiling wiki. But the examples quickly break down. For example:

with import <nixpkgs> {
  crossSystem = {
    config = "x86_64-w64-mingw32";
  };
};

mkShell {
  buildInputs = [ fmt spdlog ];
}

spdlog fails with:

/build/source/tests/utils.cpp:4:14: fatal error: Windows.h: No such file or directory
    4 | #    include <Windows.h>
      |              ^~~~~~~~~~~

and fmt fails with:

/nix/store/ar3j35s4brxdda418xd48qzh3af6pggb-x86_64-w64-mingw32-binutils-2.39/bin/
x86_64-w64-mingw32-ld: CMakeFiles/os-test.dir/objects.a(os-test.cc.obj):os-test.cc:
(.rdata$.refptr._ZTVN3fmt2v77ostreamE[.refptr._ZTVN3fmt2v77ostreamE]+0x0): 
undefined reference to `vtable for fmt::v7::ostream'

Is this to be expected?

I think the spdlog failure could be fixed quite easily by patching that include to lowercase. But I wouldn’t know how to fix that fmt failure.

Are many package in pkgsCross.mingwW64 just broken?

I wouldn’t be surprised if this is generally true. In the last 2 years I can barely remember merging any mingw fixes.

2 Likes

Thanks for confirming that I’m probably not doing anything wrong.

I also just found out that it is only fmt_7 which fails, fmt_8 and fmt_9 do compile without issues.

I guess I’ll open issues about this on GitHub and ping the maintainers.

You probably want to find some mingw maintainers instead because most maintainers will not know how to properly debug and fix this.

1 Like

Should mingw have separate maintainers? The spdlog package does list support for all platforms in its metadata. And the fix is simply to change Windows.h to windows.h. So I thought that would be in scope for the original maintainers.

No, I meant that for more hard fixes than that must maintainers can’t really help you to much because mingw is not that commonly used.

Also a package can totally list all platforms and only ever be tested on Linux. If it ends up being broken on a more obscure platform that is not run on hydra we usually don’t do to much about it.

And for that easy fix just send a PR and I’ll take a look at it. I would appreciate a command how to test it and we don’t necessarily need the approval of the maintainer for this.

1 Like