Skip Menu |

This queue is for tickets about the Compress-Snappy CPAN distribution.

Report information
The Basics
Id: 72859
Status: resolved
Priority: 0/
Queue: Compress-Snappy

People
Owner: Nobody in particular
Requestors: bnjf [...] bnjf.id.au
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: building Compress-Snappy on Solaris with Sun Studio
Date: Thu, 1 Dec 2011 10:46:30 +1100
To: gray [...] cpan.org, bug-Compress-Snappy [...] rt.cpan.org
From: Brad Forschinger <bnjf [...] bnjf.id.au>
Hi, cc barfs with -Wall, and sizeof()ing a void looks like it only works in gcc. Here's a diff: <diff> diff -ur Compress-Snappy-0.12/Makefile.PL Compress-Snappy-0.12-bnjf/Makefile.PL --- Compress-Snappy-0.12/Makefile.PL 2011-04-18 19:40:30.000000000 +1000 +++ Compress-Snappy-0.12-bnjf/Makefile.PL 2011-12-01 10:18:55.808795000 +1100 @@ -19,7 +19,7 @@ }, }, - CCFLAGS => '-Wall', + #CCFLAGS => '-Wall', DEFINE => pack('L', 1) ne pack('N', 1) ? '-D__LITTLE_ENDIAN' : '-D__BIG_ENDIAN', diff -ur Compress-Snappy-0.12/Snappy.xs Compress-Snappy-0.12-bnjf/Snappy.xs --- Compress-Snappy-0.12/Snappy.xs 2011-04-20 13:42:20.000000000 +1000 +++ Compress-Snappy-0.12-bnjf/Snappy.xs 2011-12-01 10:38:02.622454000 +1100 @@ -30,7 +30,7 @@ max_compressed_len = csnappy_max_compressed_length(len); RETVAL = newSV(max_compressed_len); if (! RETVAL) XSRETURN_UNDEF; - Newx(working_memory, CSNAPPY_WORKMEM_BYTES, void); + Newx(working_memory, CSNAPPY_WORKMEM_BYTES, char); if (! working_memory) XSRETURN_UNDEF; csnappy_compress(str, len, SvPVX(RETVAL), &compressed_len, working_memory, CSNAPPY_WORKMEM_BYTES_POWER_OF_TWO); diff -ur Compress-Snappy-0.12/ppport.h Compress-Snappy-0.12-bnjf/ppport.h --- Compress-Snappy-0.12/ppport.h 2011-04-11 07:07:38.000000000 +1000 +++ Compress-Snappy-0.12-bnjf/ppport.h 2011-12-01 10:35:57.160513000 +1100 @@ -3125,3 +3125,6 @@ #endif #endif #endif +#if (!defined(_GNUC) || __GNUC_ < 3) && (!defined(_IBMC) || __IBMC_ < 900) +#define __builtin_expect(x, y) x +#endif diff -ur Compress-Snappy-0.12/src/csnappy_internal_userspace.h Compress-Snappy-0.12-bnjf/src/csnappy_internal_userspace.h --- Compress-Snappy-0.12/src/csnappy_internal_userspace.h 2011-04-30 05:21:44.000000000 +1000 +++ Compress-Snappy-0.12-bnjf/src/csnappy_internal_userspace.h 2011-12-01 10:28:56.092213000 +1100 @@ -162,6 +162,11 @@ #define bswap_16(x) OSSwapInt16(x) #define bswap_32(x) OSSwapInt32(x) #define bswap_64(x) OSSwapInt64(x) +#elif defined(__sun) +#include <sys/byteorder.h> +#define bswap_16(x) BSWAP_16(x) +#define bswap_32(x) BSWAP_32(x) +#define bswap_64(x) BSWAP_64(x) #else #include <byteswap.h> #endif </diff> Brad
On Wed Nov 30 18:46:39 2011, bnjf@bnjf.id.au wrote: Show quoted text
> Hi, > > cc barfs with -Wall, and sizeof()ing a void looks like it only works > in gcc. Here's a diff:
thanks. Show quoted text
> diff -ur Compress-Snappy-0.12/Makefile.PL Compress-Snappy-0.12- > - CCFLAGS => '-Wall', > + #CCFLAGS => '-Wall',
yeah, i noticed a few test reports so made the change in my repo, but never pushed out a new version. Show quoted text
> diff -ur Compress-Snappy-0.12/ppport.h Compress-Snappy-0.12- > bnjf/ppport.h > --- Compress-Snappy-0.12/ppport.h 2011-04-11 07:07:38.000000000 > +1000 > +++ Compress-Snappy-0.12-bnjf/ppport.h 2011-12-01 10:35:57.160513000 > +1100 > @@ -3125,3 +3125,6 @@ > #endif > #endif > #endif > +#if (!defined(_GNUC) || __GNUC_ < 3) && (!defined(_IBMC) || __IBMC_ < > 900) > +#define __builtin_expect(x, y) x > +#endif
any change to ppport.h should be submitted as a ticket to the Devel-PPPort distribution, but i'm guessing that your change should actually be made somewhere in the csnappy source. Show quoted text
> diff -ur Compress-Snappy-0.12/src/csnappy_internal_userspace.h > Compress-Snappy-0.12-bnjf/src/csnappy_internal_userspace.h > --- Compress-Snappy-0.12/src/csnappy_internal_userspace.h > 2011-04-30 05:21:44.000000000 +1000 > +++ Compress-Snappy-0.12-bnjf/src/csnappy_internal_userspace.h > 2011-12-01 10:28:56.092213000 +1100 > @@ -162,6 +162,11 @@ > #define bswap_16(x) OSSwapInt16(x) > #define bswap_32(x) OSSwapInt32(x) > #define bswap_64(x) OSSwapInt64(x) > +#elif defined(__sun) > +#include <sys/byteorder.h> > +#define bswap_16(x) BSWAP_16(x) > +#define bswap_32(x) BSWAP_32(x) > +#define bswap_64(x) BSWAP_64(x) > #else > #include <byteswap.h> > #endif
because everything under the src/ directory is from the csnappy distribution, can you report those changes as an issue on that github repo: https://github.com/zeevt/csnappy/issues . i don't have access to your platform and the author may need to follow up for testing purposes. i'll then pull any change from his repo downstream. thanks.
On Wed Nov 30 18:46:39 2011, bnjf@bnjf.id.au wrote: Show quoted text
> Hi, > > cc barfs with -Wall, and sizeof()ing a void looks like it only works > in gcc. Here's a diff:
i think sizeof(void *) should work also: diff --git a/Snappy.xs b/Snappy.xs index 50ebb3b..4133e33 100644 --- a/Snappy.xs +++ b/Snappy.xs @@ -36 +36 @@ CODE: - Newx(working_memory, CSNAPPY_WORKMEM_BYTES, void); + Newx(working_memory, CSNAPPY_WORKMEM_BYTES, void *); there are even a couple of examples of this in the perl source
Subject: Re: [rt.cpan.org #72859] building Compress-Snappy on Solaris with Sun Studio
Date: Fri, 2 Dec 2011 10:25:16 +1100
To: bug-Compress-Snappy [...] rt.cpan.org
From: Brad Forschinger <bnjf [...] bnjf.id.au>
On Fri, Dec 2, 2011 at 07:42, gray via RT <bug-Compress-Snappy@rt.cpan.org> wrote: Show quoted text
> i think sizeof(void *) should work also:
[snip] Yeah, that's a different size though. The gcc-ism (afaik it's only gcc, correct me if I'm wrong!) is that sizeof(void) == 1. Brad
On Wed Nov 30 18:46:39 2011, bnjf@bnjf.id.au wrote: Show quoted text
> cc barfs with -Wall, and sizeof()ing a void looks like it only works > in gcc. Here's a diff:
please test the newly released version 0.14 and let me know if this resolves your issue.
Subject: Re: [rt.cpan.org #72859] building Compress-Snappy on Solaris with Sun Studio
Date: Tue, 13 Mar 2012 11:22:10 +1100
To: bug-Compress-Snappy [...] rt.cpan.org
From: Brad Forschinger <bnjf [...] bnjf.id.au>
Almost! $ diff -u csnappy.h csnappy.h.new --- csnappy.h Tue Mar 13 11:20:46 2012 +++ csnappy.h.new Tue Mar 13 11:20:37 2012 @@ -13,6 +13,11 @@ #define CSNAPPY_WORKMEM_BYTES_POWER_OF_TWO 15 #define CSNAPPY_WORKMEM_BYTES (1 << CSNAPPY_WORKMEM_BYTES_POWER_OF_TWO) +#ifndef __GNUC__ +#define __attribute__(x) /*NOTHING*/ +#define __builtin_expect(a,b) a +#endif + /* * Returns the maximal size of the compressed representation of * input data that is "source_len" bytes in length; $ On Sat, Mar 3, 2012 at 03:29, gray via RT <bug-Compress-Snappy@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=72859 > > > On Wed Nov 30 18:46:39 2011, bnjf@bnjf.id.au wrote:
>> cc barfs with -Wall, and sizeof()ing a void looks like it only works >> in gcc.  Here's a diff:
> > please test the newly released version 0.14 and let me know if this > resolves your issue.
On Mon Mar 12 20:22:19 2012, bnjf@bnjf.id.au wrote: Show quoted text
> Almost!
Show quoted text
> +#ifndef __GNUC__ > +#define __attribute__(x) /*NOTHING*/ > +#define __builtin_expect(a,b) a > +#endif
It looks like you forgot to include that in your issue on the csnappy project. Please either reopen the ticket there with the new info or create a new ticket. Thanks.
Subject: Re: [rt.cpan.org #72859] building Compress-Snappy on Solaris with Sun Studio
Date: Tue, 13 Mar 2012 13:49:41 +1100
To: bug-Compress-Snappy [...] rt.cpan.org
From: Brad Forschinger <bnjf [...] bnjf.id.au>
Done. On Tue, Mar 13, 2012 at 13:32, gray via RT <bug-Compress-Snappy@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=72859 > > > On Mon Mar 12 20:22:19 2012, bnjf@bnjf.id.au wrote:
>> Almost!
>
>> +#ifndef __GNUC__ >> +#define __attribute__(x) /*NOTHING*/ >> +#define __builtin_expect(a,b) a >> +#endif
> > It looks like you forgot to include that in your issue on the csnappy > project. Please either reopen the ticket there with the new info or > create a new ticket. Thanks.
0.16 includes the latest csnappy, so this should resolve this ticket.