如何在 Windows 上编译 C 完美最小哈希库?

发布于 2025-01-07 23:50:19 字数 3947 浏览 0 评论 0原文

我已经安装了 mingw 和 Msys。

我已经运行 bash configure 来创建 make 文件。

但是当我运行 make 时,我得到以下输出,

E:\cmph-1.1>make
make  all-recursive
make[1]: Entering directory `/e/cmph-1.1'
Making all in src
make[2]: Entering directory `/e/cmph-1.1/src'
/bin/sh ../libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..     -Wall -Werror -MT hash.lo -MD -MP -MF .deps/hash.Tpo -c -o hash.lo hash.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Werror -MT hash.lo -MD -MP -MF .deps/hash.Tpo -c hash.c  -DDLL_EXPORT -DPIC -o .libs/hash.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Werror -MT hash.lo -MD -MP -MF .deps/hash.Tpo -c hash.c -o hash.o >/dev/null 2>&1
mv -f .deps/hash.Tpo .deps/hash.Plo
/bin/sh ../libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..     -Wall -Werror -MT jenkins_hash.lo -MD -MP -MF .deps/jenkins_hash.Tpo -c -o jenkins_hash.lo jenkins_hash.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Werror -MT jenkins_hash.lo -MD -MP -MF .deps/jenkins_hash.Tpo -c jenkins_hash.c  -DDLL_EXPORT -DPIC -o .libs/jenkins_hash.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Werror -MT jenkins_hash.lo -MD -MP -MF .deps/jenkins_hash.Tpo -c jenkins_hash.c -o jenkins_hash.o >/dev/null 2>&1
mv -f .deps/jenkins_hash.Tpo .deps/jenkins_hash.Plo
/bin/sh ../libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..     -Wall -Werror -MT vstack.lo -MD -MP -MF .deps/vstack.Tpo -c -o vstack.lo vstack.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Werror -MT vstack.lo -MD -MP -MF .deps/vstack.Tpo -c vstack.c  -DDLL_EXPORT -DPIC -o .libs/vstack.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Werror -MT vstack.lo -MD -MP -MF .deps/vstack.Tpo -c vstack.c -o vstack.o >/dev/null 2>&1
mv -f .deps/vstack.Tpo .deps/vstack.Plo
/bin/sh ../libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..     -Wall -Werror -MT vqueue.lo -MD -MP -MF .deps/vqueue.Tpo -c -o vqueue.lo vqueue.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Werror -MT vqueue.lo -MD -MP -MF .deps/vqueue.Tpo -c vqueue.c  -DDLL_EXPORT -DPIC -o .libs/vqueue.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Werror -MT vqueue.lo -MD -MP -MF .deps/vqueue.Tpo -c vqueue.c -o vqueue.o >/dev/null 2>&1
mv -f .deps/vqueue.Tpo .deps/vqueue.Plo
/bin/sh ../libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..     -Wall -Werror -MT graph.lo -MD -MP -MF .deps/graph.Tpo -c -o graph.lo graph.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Werror -MT graph.lo -MD -MP -MF .deps/graph.Tpo -c graph.c  -DDLL_EXPORT -DPIC -o .libs/graph.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Werror -MT graph.lo -MD -MP -MF .deps/graph.Tpo -c graph.c -o graph.o >/dev/null 2>&1
mv -f .deps/graph.Tpo .deps/graph.Plo
/bin/sh ../libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..     -Wall -Werror -MT cmph.lo -MD -MP -MF .deps/cmph.Tpo -c -o cmph.lo cmph.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Werror -MT cmph.lo -MD -MP -MF .deps/cmph.Tpo -c cmph.c  -DDLL_EXPORT -DPIC -o .libs/cmph.o
In file included from cmph.h:105:0,
                 from cmph.c:1:
cmph_time.h: In function 'elapsed_time_in_seconds':
cmph_time.h:23:19: error: storage size of 'e_time' isn't known
cmph_time.h:24:4: error: implicit declaration of function 'gettimeofday' [-Werror=implicit-function-declaration]
cmph_time.h:23:19: error: unused variable 'e_time' [-Werror=unused-variable]
cmph_time.h: In function 'elapsed_time_in_useconds':
cmph_time.h:34:19: error: storage size of 'e_time' isn't known
cmph_time.h:34:19: error: unused variable 'e_time' [-Werror=unused-variable]
cmph.c: In function 'count_nlfile_keys':
cmph.c:154:18: error: variable 'ptr' set but not used [-Werror=unused-but-set-variable]
cc1.exe: all warnings being treated as errors

我正在努力弄清楚我需要做什么才能使其编译。

I've installed mingw and Msys.

I've run bash configure to create the make file.

But when I run make I get the following output

E:\cmph-1.1>make
make  all-recursive
make[1]: Entering directory `/e/cmph-1.1'
Making all in src
make[2]: Entering directory `/e/cmph-1.1/src'
/bin/sh ../libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..     -Wall -Werror -MT hash.lo -MD -MP -MF .deps/hash.Tpo -c -o hash.lo hash.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Werror -MT hash.lo -MD -MP -MF .deps/hash.Tpo -c hash.c  -DDLL_EXPORT -DPIC -o .libs/hash.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Werror -MT hash.lo -MD -MP -MF .deps/hash.Tpo -c hash.c -o hash.o >/dev/null 2>&1
mv -f .deps/hash.Tpo .deps/hash.Plo
/bin/sh ../libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..     -Wall -Werror -MT jenkins_hash.lo -MD -MP -MF .deps/jenkins_hash.Tpo -c -o jenkins_hash.lo jenkins_hash.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Werror -MT jenkins_hash.lo -MD -MP -MF .deps/jenkins_hash.Tpo -c jenkins_hash.c  -DDLL_EXPORT -DPIC -o .libs/jenkins_hash.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Werror -MT jenkins_hash.lo -MD -MP -MF .deps/jenkins_hash.Tpo -c jenkins_hash.c -o jenkins_hash.o >/dev/null 2>&1
mv -f .deps/jenkins_hash.Tpo .deps/jenkins_hash.Plo
/bin/sh ../libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..     -Wall -Werror -MT vstack.lo -MD -MP -MF .deps/vstack.Tpo -c -o vstack.lo vstack.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Werror -MT vstack.lo -MD -MP -MF .deps/vstack.Tpo -c vstack.c  -DDLL_EXPORT -DPIC -o .libs/vstack.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Werror -MT vstack.lo -MD -MP -MF .deps/vstack.Tpo -c vstack.c -o vstack.o >/dev/null 2>&1
mv -f .deps/vstack.Tpo .deps/vstack.Plo
/bin/sh ../libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..     -Wall -Werror -MT vqueue.lo -MD -MP -MF .deps/vqueue.Tpo -c -o vqueue.lo vqueue.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Werror -MT vqueue.lo -MD -MP -MF .deps/vqueue.Tpo -c vqueue.c  -DDLL_EXPORT -DPIC -o .libs/vqueue.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Werror -MT vqueue.lo -MD -MP -MF .deps/vqueue.Tpo -c vqueue.c -o vqueue.o >/dev/null 2>&1
mv -f .deps/vqueue.Tpo .deps/vqueue.Plo
/bin/sh ../libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..     -Wall -Werror -MT graph.lo -MD -MP -MF .deps/graph.Tpo -c -o graph.lo graph.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Werror -MT graph.lo -MD -MP -MF .deps/graph.Tpo -c graph.c  -DDLL_EXPORT -DPIC -o .libs/graph.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Werror -MT graph.lo -MD -MP -MF .deps/graph.Tpo -c graph.c -o graph.o >/dev/null 2>&1
mv -f .deps/graph.Tpo .deps/graph.Plo
/bin/sh ../libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..     -Wall -Werror -MT cmph.lo -MD -MP -MF .deps/cmph.Tpo -c -o cmph.lo cmph.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -Werror -MT cmph.lo -MD -MP -MF .deps/cmph.Tpo -c cmph.c  -DDLL_EXPORT -DPIC -o .libs/cmph.o
In file included from cmph.h:105:0,
                 from cmph.c:1:
cmph_time.h: In function 'elapsed_time_in_seconds':
cmph_time.h:23:19: error: storage size of 'e_time' isn't known
cmph_time.h:24:4: error: implicit declaration of function 'gettimeofday' [-Werror=implicit-function-declaration]
cmph_time.h:23:19: error: unused variable 'e_time' [-Werror=unused-variable]
cmph_time.h: In function 'elapsed_time_in_useconds':
cmph_time.h:34:19: error: storage size of 'e_time' isn't known
cmph_time.h:34:19: error: unused variable 'e_time' [-Werror=unused-variable]
cmph.c: In function 'count_nlfile_keys':
cmph.c:154:18: error: variable 'ptr' set but not used [-Werror=unused-but-set-variable]
cc1.exe: all warnings being treated as errors

I'm struggling to work out what I need to do to make it compile.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

只有一腔孤勇 2025-01-14 23:50:19

如果您查看该头文件,您将在顶部附近看到此构造:

#ifdef WIN32
// include headers to use gettimeofday
#else
    #ifdef __GNUC__
    #include <sys/time.h>
    #include <sys/resource.h>
    #endif
#endif

看起来您不会在后半部分结束,从那里您将获得 gettimeofday() 和 struct timeval

我对 MinGW 不是很熟悉 - 它定义了 WIN32 吗?如果是这样,您可能需要重新设计预处理器逻辑才能完成您想要的操作。作为参考,它在 cygwin 中运行良好。

If you look in that that header file, you'll see near the top this construct:

#ifdef WIN32
// include headers to use gettimeofday
#else
    #ifdef __GNUC__
    #include <sys/time.h>
    #include <sys/resource.h>
    #endif
#endif

It looks like you're not ending up in that second half, from where you'd get the declarations of gettimeofday() and struct timeval.

I'm not very familiar with MinGW - does it define WIN32? If so, you might need to rework that preprocessor logic to do what you want. For reference, it works fine in cygwin.

难理解 2025-01-14 23:50:19

查看此补丁,其中包含要在 mingw 上编译的修复程序: http://sourceforge.net/p /cmph/补丁/3/

Look at this patch that contains the fix to compile on mingw : http://sourceforge.net/p/cmph/patches/3/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文