You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by Nick North <no...@gmail.com> on 2016/01/19 17:24:06 UTC

Compiling snappy under Windows

I'm trying to compile up CouchDB 2.0 on Windows, using Joan Touzet's
PowerShell script. This used to work, but the 1.1.3 Snappy update in
October broke Windows compatibility, as it uses the ssize_t type, which MS
C++ does not understand.

The original google/snappy repository code deals with this in autoconf, but
that is not in use in the CouchDB version. There is a work-around by
#including <BaseTsd.h>, but I'm not sure where the best place to put it
would be. The couchdb-snappy/c_src/snappy files are all directly lifted
from google/snappy, and it would be a shame to make CouchDB-specific
changes to them. Would it make sense to put the Windows code into
couchdb-snappy/c_src/snappy_nif.cc? If someone can suggest the best place
to put the work-around, I can submit a pull request.

Thanks,

Nick

Re: Compiling snappy under Windows

Posted by Nick North <no...@gmail.com>.
That's what I hoped everyone would say. I'll put in a PR for comment.

Nick
On Tue, 19 Jan 2016 at 18:01, Joan Touzet <wo...@apache.org> wrote:

> I agree we should avoid re-introducing autoconf to the build process.
>
> Hopefully we can fix this with a simple set of #ifdefs in a header file
> somewhere that defines ssize_t (or anything else we need) appropriately,
> or dig into the MS SDK for any references available and include compat
> header files.
>
> -Joan
>
> ----- Original Message -----
> > From: "Alexander Shorin" <kx...@gmail.com>
> > To: dev@couchdb.apache.org
> > Sent: Tuesday, January 19, 2016 12:15:25 PM
> > Subject: Re: Compiling snappy under Windows
> >
> > On Tue, Jan 19, 2016 at 8:05 PM, Nick North <no...@gmail.com>
> > wrote:
> > > I'm not exactly sure what you are proposing here. Are you saying we
> > > should
> > > run autoconf for the snappy code? There is an earlier commit in
> > > couchdb-snappy repository that removed autotools, saying they did
> > > not work
> > > well with snappy, which makes me a bit cautious about that.
> > > Apologies if
> > > I've misunderstood your suggestion,
> >
> > That's the one of the solutions, but will require to:
> > 1) integrate autoconf run from rebar
> > 2) make autoconf as build dependency
> > 3) ...
> > and all these just for a few C++ types?
> >
> > I proposed to add preprocessor conditional to catch Windows case and
> > inject the right code to make snappy works. Basically, unfold
> > autoconf
> > conditions manually. That's the idea. I'm not sure if this will help,
> > but worth to start from there.
> >
> > --
> > ,,,^..^,,,
> >
>

Re: Compiling snappy under Windows

Posted by Joan Touzet <wo...@apache.org>.
I agree we should avoid re-introducing autoconf to the build process.

Hopefully we can fix this with a simple set of #ifdefs in a header file
somewhere that defines ssize_t (or anything else we need) appropriately,
or dig into the MS SDK for any references available and include compat
header files.

-Joan

----- Original Message -----
> From: "Alexander Shorin" <kx...@gmail.com>
> To: dev@couchdb.apache.org
> Sent: Tuesday, January 19, 2016 12:15:25 PM
> Subject: Re: Compiling snappy under Windows
> 
> On Tue, Jan 19, 2016 at 8:05 PM, Nick North <no...@gmail.com>
> wrote:
> > I'm not exactly sure what you are proposing here. Are you saying we
> > should
> > run autoconf for the snappy code? There is an earlier commit in
> > couchdb-snappy repository that removed autotools, saying they did
> > not work
> > well with snappy, which makes me a bit cautious about that.
> > Apologies if
> > I've misunderstood your suggestion,
> 
> That's the one of the solutions, but will require to:
> 1) integrate autoconf run from rebar
> 2) make autoconf as build dependency
> 3) ...
> and all these just for a few C++ types?
> 
> I proposed to add preprocessor conditional to catch Windows case and
> inject the right code to make snappy works. Basically, unfold
> autoconf
> conditions manually. That's the idea. I'm not sure if this will help,
> but worth to start from there.
> 
> --
> ,,,^..^,,,
> 

Re: Compiling snappy under Windows

Posted by Alexander Shorin <kx...@gmail.com>.
On Tue, Jan 19, 2016 at 8:05 PM, Nick North <no...@gmail.com> wrote:
> I'm not exactly sure what you are proposing here. Are you saying we should
> run autoconf for the snappy code? There is an earlier commit in
> couchdb-snappy repository that removed autotools, saying they did not work
> well with snappy, which makes me a bit cautious about that. Apologies if
> I've misunderstood your suggestion,

That's the one of the solutions, but will require to:
1) integrate autoconf run from rebar
2) make autoconf as build dependency
3) ...
and all these just for a few C++ types?

I proposed to add preprocessor conditional to catch Windows case and
inject the right code to make snappy works. Basically, unfold autoconf
conditions manually. That's the idea. I'm not sure if this will help,
but worth to start from there.

--
,,,^..^,,,

Re: Compiling snappy under Windows

Posted by Nick North <no...@gmail.com>.
I'm not exactly sure what you are proposing here. Are you saying we should
run autoconf for the snappy code? There is an earlier commit in
couchdb-snappy repository that removed autotools, saying they did not work
well with snappy, which makes me a bit cautious about that. Apologies if
I've misunderstood your suggestion,

Nick

On Tue, 19 Jan 2016 at 16:42 Alexander Shorin <kx...@gmail.com> wrote:

> Hi Nick,
>
> That's my fault definitely. The fix should be simple, however.
>
> This is our file:
>
> https://github.com/apache/couchdb-snappy/blob/master/c_src/snappy/snappy-stubs-public.h
>
> This is their:
> https://github.com/google/snappy/blob/master/snappy-stubs-public.h.in
>
> Their rules:
> https://github.com/google/snappy/blob/master/configure.ac
>
> All what is need is to properly set preprocessor branch for the
> windows system. I didn't have a chance to do that as I couldn't check
> the result.
>
> However, I don't see any ssize_t related references. May be this won't
> work, but worth to try.
> --
> ,,,^..^,,,
>
>
> On Tue, Jan 19, 2016 at 7:24 PM, Nick North <no...@gmail.com> wrote:
> > I'm trying to compile up CouchDB 2.0 on Windows, using Joan Touzet's
> > PowerShell script. This used to work, but the 1.1.3 Snappy update in
> > October broke Windows compatibility, as it uses the ssize_t type, which
> MS
> > C++ does not understand.
> >
> > The original google/snappy repository code deals with this in autoconf,
> but
> > that is not in use in the CouchDB version. There is a work-around by
> > #including <BaseTsd.h>, but I'm not sure where the best place to put it
> > would be. The couchdb-snappy/c_src/snappy files are all directly lifted
> > from google/snappy, and it would be a shame to make CouchDB-specific
> > changes to them. Would it make sense to put the Windows code into
> > couchdb-snappy/c_src/snappy_nif.cc? If someone can suggest the best place
> > to put the work-around, I can submit a pull request.
> >
> > Thanks,
> >
> > Nick
>

Re: Compiling snappy under Windows

Posted by Alexander Shorin <kx...@gmail.com>.
Hi Nick,

That's my fault definitely. The fix should be simple, however.

This is our file:
https://github.com/apache/couchdb-snappy/blob/master/c_src/snappy/snappy-stubs-public.h

This is their:
https://github.com/google/snappy/blob/master/snappy-stubs-public.h.in

Their rules:
https://github.com/google/snappy/blob/master/configure.ac

All what is need is to properly set preprocessor branch for the
windows system. I didn't have a chance to do that as I couldn't check
the result.

However, I don't see any ssize_t related references. May be this won't
work, but worth to try.
--
,,,^..^,,,


On Tue, Jan 19, 2016 at 7:24 PM, Nick North <no...@gmail.com> wrote:
> I'm trying to compile up CouchDB 2.0 on Windows, using Joan Touzet's
> PowerShell script. This used to work, but the 1.1.3 Snappy update in
> October broke Windows compatibility, as it uses the ssize_t type, which MS
> C++ does not understand.
>
> The original google/snappy repository code deals with this in autoconf, but
> that is not in use in the CouchDB version. There is a work-around by
> #including <BaseTsd.h>, but I'm not sure where the best place to put it
> would be. The couchdb-snappy/c_src/snappy files are all directly lifted
> from google/snappy, and it would be a shame to make CouchDB-specific
> changes to them. Would it make sense to put the Windows code into
> couchdb-snappy/c_src/snappy_nif.cc? If someone can suggest the best place
> to put the work-around, I can submit a pull request.
>
> Thanks,
>
> Nick