数组'__curl_rule_01__'的大小为负数

ash*_*ash 6 git curl compilation

在尝试编译GIT时,我正在努力解决错误.我搜索了谷歌和GIT来源问题/错误类似的问题,但我没有找到任何帮助我.

最初我收到以下错误

root@teemo:/usr/src/git# make prefix=/usr install install-doc install-html install-info;
    CC http-push.o
In file included from cache.h:39:0,
                 from http-push.c:1:
/usr/include/zlib.h:34:19: fatal error: zconf.h: No such file or directory
 #include "zconf.h"
                   ^
compilation terminated.
make: *** [http-push.o] Error 1
Run Code Online (Sandbox Code Playgroud)

我在/usr/include/丢失的文件里面创建了一个符号链接,如下所示(在我安装/编译了最新/开发版本之后)

root@teemo:/usr/src/git# ln -s /usr/include/x86_64-linux-gnu/zconf.h /usr/include
Run Code Online (Sandbox Code Playgroud)

这让我想到了当前的问题,我对如何解决这个问题感到困惑.如果有人可以提出建议,将不胜感激.

root@teemo:/usr/src/git# make prefix=/usr install install-doc install-html install-info;
    CC http-push.o
In file included from /usr/include/curl/curl.h:35:0,
                 from http.h:6,
                 from http-push.c:5:
/usr/include/curl/curlrules.h:142:3: error: size of array '__curl_rule_01__' is negative
   __curl_rule_01__
   ^
/usr/include/curl/curlrules.h:152:3: error: size of array '__curl_rule_02__' is negative
   __curl_rule_02__
   ^
make: *** [http-push.o] Error 1
Run Code Online (Sandbox Code Playgroud)

Tim*_*m B 8

阅读更高版本curlrules.h.故意强制该错误作为检查数据类型大小的测试的一部分.

 * NOTE 2
 * ------
 *
 * Some of the following compile time checks are based on the fact
 * that the dimension of a constant array can not be a negative one.
 * In this way if the compile time verification fails, the compilation
 * will fail issuing an error. The error description wording is compiler
 * dependent but it will be quite similar to one of the following:
 *
 *   "negative subscript or subscript is too large"
 *   "array must have at least one element"
 *   "-1 is an illegal array size"
 *   "size of array is negative"
 *
 * If you are building an application which tries to use an already
 * built libcurl library and you are getting this kind of errors on
 * this file, it is a clear indication that there is a mismatch between
 * how the library was built and how you are trying to use it for your
 * application. Your already compiled or binary library provider is the
 * only one who can give you the details you need to properly use it.
Run Code Online (Sandbox Code Playgroud)

您的libcurl版本使用的不同选项构建,而不是在当前的git构建中使用.(它可能是32对64位)

知道你所使用的平台和构建选项可能足以帮助解决它.如果这是常见的情况,并且您使用的是Linux或其他受支持的平台,那么使用本机软件管理安装预构建的二进制文件会更容易.Git下载