libcouchbase reports complie error when building 64-bit DLL on Windows

86 views
Skip to first unread message

Aslan Love

unread,
Apr 6, 2012, 4:18:37 AM4/6/12
to Couchbase
Hi All

I just build libcouchbase successfully on Windows with 32-bit
configuration according to the instructions of Trond Norbye's blog:
http://blog.couchbase.com/libcouchbase-and-Windows

But when building libcouchbase with 64-bit configuration, the complier
reports the compile error:

cl.exe /O2 /DNDEBUG /MD /LD /Iinclude /Iwin32 /Icontrib /I..\deps
\includ
e /Isrc /I. /nologo /W3 /EHsc /DWIN32 /FD /c -D_CRT_SECURE_NO_WARNINGS
-DLIBCOUC
HBASE_INTERNAL=1 /Fo"src\arithmetic.obj" src\arithmetic.c
arithmetic.c
contrib\http_parser/http_parser.h(41) : error C2371: “size_t”:
redefination;different base type
src\arithmetic.c : reference the declaration of “size_t”
NMAKE : fatal error U1077: “"d:\Program Files\Microsoft Visual Studio
9.0\VC\BI
N\x86_amd64\cl.exe"”: return code “0x2”
Stop

It seems there exists a type redefination of size_t. Does anyone
encounter that same problem? Or is libcoucebase not build for 64-bit
Windows now?

Thanks

trond....@gmail.com

unread,
Apr 6, 2012, 4:29:19 AM4/6/12
to couc...@googlegroups.com, Couchbase
It is supposed to work, so you are probably hitting a bug. I dont have access to a windows machine right now to fix it.

Thanks for reporting it.

Trond


Sendt fra min iPad

Sergey Avseyev

unread,
Apr 6, 2012, 6:19:01 AM4/6/12
to couc...@googlegroups.com

This is part of external library we are using to parse HTTP stream,
could you verify it is working standalone?

$ git clone https://github.com/joyent/http-parser
$ cd http-parser
$ make test

It reports that all is ok (on my linux)

$ make test
./test_g
sizeof(http_parser) = 40
response scan 1/2 100%
response scan 2/2 100%
responses okay
request scan 1/4 100%
request scan 2/4 100%
request scan 3/4 100%
request scan 4/4 100%
requests okay
./test_fast
sizeof(http_parser) = 32
response scan 1/2 100%
response scan 2/2 100%
responses okay
request scan 1/4 100%
request scan 2/4 100%
request scan 3/4 100%
request scan 4/4 100%
requests okay

--
Sergey Avseyev

Aslan Love

unread,
Apr 6, 2012, 7:23:37 AM4/6/12
to Couchbase
The http-parser itself is working ok.
The compliation error is reported when building with VS2008.
I build it under VS2010 an hour ago and it builds successfully.

So I suspect the reason for the complie error under VS2008 is the
proprecessor macro in http_parser.h:

#if defined(_WIN32) && !defined(__MINGW32__) && (!defined(_MSC_VER) ||
_MSC_VER<1600)
typedef __int8 int8_t;
typedef unsigned __int8 uint8_t;
typedef __int16 int16_t;
typedef unsigned __int16 uint16_t;
typedef __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;

typedef unsigned int size_t;
typedef int ssize_t;
#else
#include <stdint.h>
#endif

When building with VS2008, it's the "#if" block that executes, which
redifines the size_t type.
But with 32-bit configuration, it builds ok.



On 4月6日, 下午6时19分, Sergey Avseyev <sergey.avse...@gmail.com> wrote:
>     $ git clonehttps://github.com/joyent/http-parser
> Sergey Avseyev- 隐藏被引用文字 -
>
> - 显示引用的文字 -

Aslan Love

unread,
Apr 6, 2012, 8:53:06 AM4/6/12
to Couchbase
I commented the two lines that redifines size_t and ssize_t, and it
can build successful.
Why does the http-parser need to enforce the size_t to be unsigned
int? When building with 64-bit configuration, the size_t which is
precedingly defined in <stddef.h> is indeed __int64, which will
conflict with the redefinition here.
> > - 显示引用的文字 -- 隐藏被引用文字 -
>
> - 显示引用的文字 -

Sergey Avseyev

unread,
Apr 6, 2012, 6:23:20 PM4/6/12
to couc...@googlegroups.com
I submitted the patch on gerrit to allow someone explicitly say that
it isn't break anything on windows

http://review.couchbase.org/14642

--
Sergey Avseyev

Reply all
Reply to author
Forward
0 new messages