提问人:MaxSilvester 提问时间:11/11/2023 最后编辑:HolyBlackCatMaxSilvester 更新时间:11/11/2023 访问量:27
无法在 nix 上找到 mingw32 的 pthread.h
Unable to find pthread.h for mingw32 on nix
问:
我正在尝试使用 nix 和 mingw 将使用 pthreads 的程序交叉编译到窗口。
构建抱怨缺少标头 (pthread.h),即使我设置为 buildInput。windows.pthreads
windows.pthreads
似乎只复制并忽略标题。(来源libpthreadGC2.a
)
win.nix:
{ pkgs ? import (builtins.fetchTarball "https://github.com/nixos/nixpkgs/archive/nixos-23.05.tar.gz") { } }:
let
source = pkgs.writeText "main.c" ''
#include <pthread.h>
int main() {
return 0;
}
'';
package = { runCommandCC, fetchurl, stdenv, windows }: runCommandCC "test" {
buildInputs = [ windows.pthreads ];
} ''
mkdir $out
cd $out
cd $out
$CC -pthread ${source} -o main
'';
in
pkgs.pkgsCross.mingw32.callPackage package { }
汇编:
nix-build win.nix
this derivation will be built:
/nix/store/7cwz7v404nm51i34avfqpvzz4mm2r7mb-test-i686-w64-mingw32.drv
building '/nix/store/7cwz7v404nm51i34avfqpvzz4mm2r7mb-test-i686-w64-mingw32.drv'...
/nix/store/11635lqa2ad8225ahky756pmj5fv81kl-main.c:1:10: fatal error: pthread.h: No such file or directory
1 | #include <pthread.h>
| ^~~~~~~~~~~
compilation terminated.
答: 暂无答案
评论