添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

I am trying to cross-compile the eprover package to Windows. I ran

nix-build '<nixpkgs>' -A pkgsCross.mingwW64.eprover

but got

fatal error: pwd.h: No such file or directory

It seems that pwd.h is included by the which package, on which eprover has a build dependency:

buildInputs = [ which ];

Is there anything I can do to fix or work around this?

Note that Windows is not a supported platform. You can expect super simple packages like hello to cross-compile but anything more complex likely won’t work.

What’s the tree of pkgs.mingwW64.which ? Does it contain pwd.h in its inlcude dir? Why doesn’t eprover’s compiler find the include while compiling? (make the build system output compiler commands and check include paths)

Thank you for your response. Why do you say that “Windows is not a supported platform”? I checked the cross-compilation tutorial at nix.dev, and it lists pkgsCross.mingwW64 in the set of “predefined host platforms” that come with nixpkgs. It includes x86_64-w64-mingw32 in the “common examples of platform configs”. It has a whole section intended to “show off the power of cross compilation in Nix” which compiles a program to two platforms, one of which is x86_64-w64-mingw32 (Windows). It is part of the “[o]fficial documentation for getting things done with Nix”.

As for pwd.h , the issue seems to be with the which package, not with eprover . Running

nix-build '<nixpkgs>' -A pkgsCross.mingwW64.which

gives the same error about pwd.h .

“is not a supported platform” means that even though the cross compilation target is provided, there is no active testing or monitoring happening.

This also means, that some given expression might have worked when the parts of the tutorial have been written, but does not anymore today.

Fixing cross build problems isn’t always easy (never actually).

And in this case, you haven’t even given any hint on which derivation the build failed, nor from which branch/channel you are trying to do the build.

Good idea! I moved which from buildInputs to nativeBuildInputs , and the pwd.h error went away.

Now there is a new error coming from eprover’s configure script:

Unknown option --build

It seems the script does not support specifying a build platform. This does not bode well for getting cross-compilation to work. It would seem to require changing not just the Nix eprover package, but eprover itself.

Anyway, thanks for the advice.

Now there is a new error coming from eprover’s configure script:

Unknown option --build

It seems the script does not support specifying a build platform.

You can prevent such options being passed to the configure script if it does not support them. Take a look at setting

configurePlatforms = [];

and maybe also

dontAddPrefix = true;
              

Okay, I added configurePlatforms = [], and that allowed the configure step to succeed and the compilation to begin.

The compilation is failing with a lot of “No such file or directory” errors. The files it is missing are:

  • netinet/in.h
  • sys/resource.h
  • sys/select.h
  • sys/socket.h
  • sys/uio.h
  • sys/wait.h
  • These are all POSIX header files, that apparently are not available on MinGW.

    Can anything be done about this, or am I stuck?