gpt4 book ai didi

C - MADV_HUGEPAGE 编译错误

转载 作者:行者123 更新时间:2023-11-30 15:07:25 25 4
gpt4 key购买 nike

我试图编译一些 C 代码,只需一个命令就可以在 Linux 上正常工作。

./autogen.sh && ./configure && make

我需要为 Windows 编译它,所以我安装了 cygwin 和我能想到的所有依赖项,现在我收到编译错误。 (make 时出错)。

-cpu-miner.o `test -f 'cpu-miner.c' || echo './'`cpu-miner.c
cpu-miner.c: In function ‘miner_thread’:
cpu-miner.c:1056:139: error: ‘MAP_HUGETLB’ undeclared (first use in this function)
persistentctx = (struct cryptonight_ctx *)mmap(0, sizeof(struct cryptonight_ctx), PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB | MAP_POPULATE, 0, 0);
^
cpu-miner.c:1056:139: note: each undeclared identifier is reported only once for each function it appears in
cpu-miner.c:1056:153: error: ‘MAP_POPULATE’ undeclared (first use in this function)
persistentctx = (struct cryptonight_ctx *)mmap(0, sizeof(struct cryptonight_ctx), PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB | MAP_POPULATE, 0, 0);
^
cpu-miner.c:1058:88: error: ‘MADV_HUGEPAGE’ undeclared (first use in this function)
madvise(persistentctx, sizeof(struct cryptonight_ctx), MADV_RANDOM | MADV_WILLNEED | MADV_HUGEPAGE);
^
make[2]: *** [Makefile:563: minerd-cpu-miner.o] Error 1

完整代码在这里: https://github.com/wolf9466/cpuminer-multi

按照项目依赖项所述,我使用 gcc、ming-w64、libcurl 和 openssl 安装了 Cygwin,但我被难住了。

(我确实对代码进行了更改以进行优化,但它们是数学上的调整,并且在 Linux 上运行良好,所以我认为这不是问题。)

编辑 1

现在可以编译了!我删除了大页面并编译了它 - 但它是一个具有 .exe 文件名的 Linux 可执行文件。它需要 cygwin dll 才能运行。

最佳答案

“hugepage”功能特定于 Linux,在 Cygwin 中不可用。

关于C - MADV_HUGEPAGE 编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38277297/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com