Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

size of array '__curl_rule_01__' is negative

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.

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)

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
like image 206
Ash Avatar asked Feb 03 '16 14:02

Ash


1 Answers

Read higher up in curlrules.h. That error is intentionally forced as part of a test that checks the size of data types.

 * 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)

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

like image 177
Tim B Avatar answered Oct 11 '22 15:10

Tim B