git 数组 '__curl_rule_01__' 的大小为负
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35181744/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
size of array '__curl_rule_01__' is negative
提问by ash
I'm struggling with an error whilst trying to compile GIT. I've searched Google and the GIT source issues/bugs for similar issues but i've not found anything to help me.
我在尝试编译 GIT 时遇到错误。我已经在 Google 和 GIT 源问题/错误中搜索了类似的问题,但没有找到任何可以帮助我的东西。
Originally I received the following error
最初我收到以下错误
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
I created a symbolic link inside /usr/include/
to the missing file as follows (after I had installed/compiled the latest/development version)
我在/usr/include/
丢失的文件中创建了一个符号链接,如下所示(在我安装/编译了最新/开发版本之后)
root@teemo:/usr/src/git# ln -s /usr/include/x86_64-linux-gnu/zconf.h /usr/include
Which brings me to the current issue, which I am confused as to how to solve. If someone could advise it would be greatly appreciated.
这让我想到了当前的问题,我对如何解决感到困惑。如果有人可以提供建议,将不胜感激。
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
回答by Tim B
Read higher up in curlrules.h
. That error is intentionally forced as part of a test that checks the size of data types.
在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.
Your version of libcurl was built with different options than you're using in your current git build. (it could be 32 vs 64 bit)
您构建的 libcurl 版本使用的选项与您在当前 git 构建中使用的选项不同。(可能是 32 位和 64 位)
Knowing what platform you're on and your build options might be enough others to help resolve it. If this is the common case, and you're on Linux or another supported platform, it'd be easier just to install a prebuilt binary using the native software management. Git downloads
了解您在哪个平台上以及您的构建选项可能足以帮助解决它。如果这是常见情况,并且您使用的是 Linux 或其他受支持的平台,那么使用本机软件管理安装预构建的二进制文件会更容易。Git下载
回答by user6373404
In case system reports __curl_rule_01__
or __curl_rule_02__
is negative make the following changes to /usr/include/curl/curlbuild.h
:
如果系统报告 __curl_rule_01__
或是__curl_rule_02__
否定的,请对 进行以下更改/usr/include/curl/curlbuild.h
:
Add the following lines:
添加以下几行:
define CURL_SIZEOF_LONG 4
define CURL_SIZEOF_CURL_OFF_T 4
define CURL_SIZEOF_LONG 4
define CURL_SIZEOF_CURL_OFF_T 4
(Or replace similar lines if these are already defined)
(或者如果已经定义了类似的行,则替换它们)