Bug#742148: shapelib: FTBFS on powerpc (Both BIG_ENDIAN and LITTLE_ENDIAN defined!

2014-03-26 Thread Cyril Brulebois
Control: tag -1 patch

Julien Cristau jcris...@debian.org (2014-03-19):
 Source: shapelib
 Version: 1.3.0-2
 Severity: serious
 Justification: fails to build from source (but built successfully in the past)
 
 Hi,
 
 your package no longer builds on powerpc:
  cc -g -I.. -I/sbuild-nonexistent/bld/include -DPROJ4 -D_LITTLE_ENDIAN 
  -DDEBUG -DDEBUG2  shpdxf.c ../shpopen.o ../dbfopen.o ../safileio.o  -o 
  shpdxf
  In file included from /usr/include/endian.h:36:0,
   from /usr/include/powerpc-linux-gnu/bits/waitstatus.h:64,
   from /usr/include/stdlib.h:42,
   from shpdxf.c:40:
  /usr/include/powerpc-linux-gnu/bits/endian.h:26:4: error: #error Both 
  BIG_ENDIAN and LITTLE_ENDIAN defined!
   #  error Both BIG_ENDIAN and LITTLE_ENDIAN defined!
  ^
  make[2]: *** [shpdxf] Error 1
 
 See
 https://buildd.debian.org/status/fetch.php?pkg=shapelibarch=powerpcver=1.3.0-2stamp=1395181820
 
 Cheers,
 Julien

Here's a patch; confirmed by first reproducing the FTBFS on partch, and
then seeing it go away once it's applied.

Mraw,
KiBi.
diff -Nru shapelib-1.3.0/debian/changelog shapelib-1.3.0/debian/changelog
--- shapelib-1.3.0/debian/changelog	2014-03-18 22:47:55.0 +0100
+++ shapelib-1.3.0/debian/changelog	2014-03-26 10:52:01.0 +0100
@@ -1,3 +1,12 @@
+shapelib (1.3.0-2.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTBFS on powerpc by prefixing _{BIG,LITTLE}_ENDIAN with
+LIBSHAPE. (Names starting with an underscore are reserved.)
+(Closes: #742148)
+
+ -- Cyril Brulebois k...@debian.org  Wed, 26 Mar 2014 10:38:30 +0100
+
 shapelib (1.3.0-2) unstable; urgency=medium
 
   * Moved to DEP5 copyright format and annotated double licensing,
diff -Nru shapelib-1.3.0/debian/patches/0006-Fix-FTBFS-avoid-clash-with-_ENDIAN-defines.patch shapelib-1.3.0/debian/patches/0006-Fix-FTBFS-avoid-clash-with-_ENDIAN-defines.patch
--- shapelib-1.3.0/debian/patches/0006-Fix-FTBFS-avoid-clash-with-_ENDIAN-defines.patch	1970-01-01 01:00:00.0 +0100
+++ shapelib-1.3.0/debian/patches/0006-Fix-FTBFS-avoid-clash-with-_ENDIAN-defines.patch	2014-03-26 10:52:12.0 +0100
@@ -0,0 +1,39 @@
+Description: Avoid clashing with _*_ENDIAN.
+Author: Cyril Brulebois k...@debian.org
+
+Defining _{LITTLE,BIG}_ENDIAN is a bad idea since it can clash with
+architecture-specific #define's. So prefix those with LIBSHAPE to
+avoid name clashing.
+---
+Origin: Debian
+Bug-Debian: http://bugs.debian.org/742148
+Last-Update: 2014-03-26
+
+--- a/contrib/Makefile
 b/contrib/Makefile
+@@ -2,8 +2,8 @@
+ #LINKOPT	=	/usr/local/lib/libdbmalloc.a
+ #CFLAGS	=	-g
+ 
+-# Endian: define either _LITTLE_ENDIAN or _BIG_ENDIAN
+-ENDIAN	=	-D_LITTLE_ENDIAN
++# Endian: define either LIBSHAPE_LITTLE_ENDIAN or LIBSHAPE_BIG_ENDIAN
++ENDIAN	=	-DLIBSHAPE_LITTLE_ENDIAN
+ 
+ CFLAGS	=	-g -I.. -I$(HOME)/bld/include -DPROJ4 $(ENDIAN) -DDEBUG -DDEBUG2 
+ 
+--- a/contrib/my_nan.h
 b/contrib/my_nan.h
+@@ -26,10 +26,10 @@
+ 
+ /* IEEE Not A Number.  */
+ 
+-#ifdef _BIG_ENDIAN
++#ifdef LIBSHAPE_BIG_ENDIAN
+ #  define	__nan_bytes		{ 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 }
+ #endif
+-#ifdef _LITTLE_ENDIAN
++#ifdef LIBSHAPE_LITTLE_ENDIAN
+ #  define	__nan_bytes		{ 0, 0, 0, 0, 0, 0, 0xf8, 0x7f }
+ #endif
+ 
diff -Nru shapelib-1.3.0/debian/patches/series shapelib-1.3.0/debian/patches/series
--- shapelib-1.3.0/debian/patches/series	2014-03-18 22:47:55.0 +0100
+++ shapelib-1.3.0/debian/patches/series	2014-03-26 10:38:26.0 +0100
@@ -2,3 +2,4 @@
 0003-Properly-use-libtool.patch
 0004-Dynamically-link-the-shp-binaries-to-libshp.patch
 0005-Stop-setting-CFLAGS-and-PREFIX-in-the-Makefile.patch
+0006-Fix-FTBFS-avoid-clash-with-_ENDIAN-defines.patch


signature.asc
Description: Digital signature
___
Pkg-grass-devel mailing list
Pkg-grass-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-grass-devel

Processed: Re: Bug#742148: shapelib: FTBFS on powerpc (Both BIG_ENDIAN and LITTLE_ENDIAN defined!

2014-03-26 Thread Debian Bug Tracking System
Processing control commands:

 tag -1 patch
Bug #742148 [src:shapelib] shapelib: FTBFS on powerpc (Both BIG_ENDIAN and 
LITTLE_ENDIAN defined!
Added tag(s) patch.

-- 
742148: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=742148
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems

___
Pkg-grass-devel mailing list
Pkg-grass-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-grass-devel


Bug#742148: shapelib: FTBFS on powerpc (Both BIG_ENDIAN and LITTLE_ENDIAN defined!

2014-03-26 Thread Francesco P. Lovergine
While I accepted the patch a few minutes ago, indeed I seriously now doubt that
the fix is correct.

It seems to me that in the original program the LITTLE_ENDIAN should be
intended as a static build-time definition for the host where the program is 
built.

So the NAN definition should be intended instead as nan(). That's because
the shapefile format is endianess-independent and shapelib reads/writes fields 
on the
basis of the host platform to respect the format. So the NAN should be
intended as the *host* NaN format, indeed (to be translated in the shp format 
NaN, i.e. little endian). 
That poses a problem on the pcc architecture for instance: __nan_bytes will be 
not the 
correct NaN value and will result as a big endian in the file.

See http://dl.maptools.org/dl/shapelib/shapefile.pdf for format.

Do you agree?


On Wed, Mar 26, 2014 at 10:53:17AM +0100, Cyril Brulebois wrote:
 Control: tag -1 patch
 
 Julien Cristau jcris...@debian.org (2014-03-19):
  Source: shapelib
  Version: 1.3.0-2
  Severity: serious
  Justification: fails to build from source (but built successfully in the 
  past)
  
  Hi,
  
  your package no longer builds on powerpc:
   cc -g -I.. -I/sbuild-nonexistent/bld/include -DPROJ4 -D_LITTLE_ENDIAN 
   -DDEBUG -DDEBUG2  shpdxf.c ../shpopen.o ../dbfopen.o ../safileio.o  -o 
   shpdxf
   In file included from /usr/include/endian.h:36:0,
from /usr/include/powerpc-linux-gnu/bits/waitstatus.h:64,
from /usr/include/stdlib.h:42,
from shpdxf.c:40:
   /usr/include/powerpc-linux-gnu/bits/endian.h:26:4: error: #error Both 
   BIG_ENDIAN and LITTLE_ENDIAN defined!
#  error Both BIG_ENDIAN and LITTLE_ENDIAN defined!
   ^
   make[2]: *** [shpdxf] Error 1
  
  See
  https://buildd.debian.org/status/fetch.php?pkg=shapelibarch=powerpcver=1.3.0-2stamp=1395181820
  
  Cheers,
  Julien
 
 Here's a patch; confirmed by first reproducing the FTBFS on partch, and
 then seeing it go away once it's applied.
 
 Mraw,
 KiBi.

 diff -Nru shapelib-1.3.0/debian/changelog shapelib-1.3.0/debian/changelog
 --- shapelib-1.3.0/debian/changelog   2014-03-18 22:47:55.0 +0100
 +++ shapelib-1.3.0/debian/changelog   2014-03-26 10:52:01.0 +0100
 @@ -1,3 +1,12 @@
 +shapelib (1.3.0-2.1) UNRELEASED; urgency=medium
 +
 +  * Non-maintainer upload.
 +  * Fix FTBFS on powerpc by prefixing _{BIG,LITTLE}_ENDIAN with
 +LIBSHAPE. (Names starting with an underscore are reserved.)
 +(Closes: #742148)
 +
 + -- Cyril Brulebois k...@debian.org  Wed, 26 Mar 2014 10:38:30 +0100
 +
  shapelib (1.3.0-2) unstable; urgency=medium
  
* Moved to DEP5 copyright format and annotated double licensing,
 diff -Nru 
 shapelib-1.3.0/debian/patches/0006-Fix-FTBFS-avoid-clash-with-_ENDIAN-defines.patch
  
 shapelib-1.3.0/debian/patches/0006-Fix-FTBFS-avoid-clash-with-_ENDIAN-defines.patch
 --- 
 shapelib-1.3.0/debian/patches/0006-Fix-FTBFS-avoid-clash-with-_ENDIAN-defines.patch
1970-01-01 01:00:00.0 +0100
 +++ 
 shapelib-1.3.0/debian/patches/0006-Fix-FTBFS-avoid-clash-with-_ENDIAN-defines.patch
2014-03-26 10:52:12.0 +0100
 @@ -0,0 +1,39 @@
 +Description: Avoid clashing with _*_ENDIAN.
 +Author: Cyril Brulebois k...@debian.org
 +
 +Defining _{LITTLE,BIG}_ENDIAN is a bad idea since it can clash with
 +architecture-specific #define's. So prefix those with LIBSHAPE to
 +avoid name clashing.
 +---
 +Origin: Debian
 +Bug-Debian: http://bugs.debian.org/742148
 +Last-Update: 2014-03-26
 +
 +--- a/contrib/Makefile
  b/contrib/Makefile
 +@@ -2,8 +2,8 @@
 + #LINKOPT=   /usr/local/lib/libdbmalloc.a
 + #CFLAGS =   -g
 + 
 +-# Endian: define either _LITTLE_ENDIAN or _BIG_ENDIAN
 +-ENDIAN  =   -D_LITTLE_ENDIAN
 ++# Endian: define either LIBSHAPE_LITTLE_ENDIAN or LIBSHAPE_BIG_ENDIAN
 ++ENDIAN  =   -DLIBSHAPE_LITTLE_ENDIAN
 + 
 + CFLAGS  =   -g -I.. -I$(HOME)/bld/include -DPROJ4 $(ENDIAN) -DDEBUG 
 -DDEBUG2 
 + 
 +--- a/contrib/my_nan.h
  b/contrib/my_nan.h
 +@@ -26,10 +26,10 @@
 + 
 + /* IEEE Not A Number.  */
 + 
 +-#ifdef _BIG_ENDIAN
 ++#ifdef LIBSHAPE_BIG_ENDIAN
 + #  define   __nan_bytes { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 }
 + #endif
 +-#ifdef _LITTLE_ENDIAN
 ++#ifdef LIBSHAPE_LITTLE_ENDIAN
 + #  define   __nan_bytes { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f }
 + #endif
 + 
 diff -Nru shapelib-1.3.0/debian/patches/series 
 shapelib-1.3.0/debian/patches/series
 --- shapelib-1.3.0/debian/patches/series  2014-03-18 22:47:55.0 
 +0100
 +++ shapelib-1.3.0/debian/patches/series  2014-03-26 10:38:26.0 
 +0100
 @@ -2,3 +2,4 @@
  0003-Properly-use-libtool.patch
  0004-Dynamically-link-the-shp-binaries-to-libshp.patch
  0005-Stop-setting-CFLAGS-and-PREFIX-in-the-Makefile.patch
 +0006-Fix-FTBFS-avoid-clash-with-_ENDIAN-defines.patch




 ___
 Pkg-grass-devel mailing list
 Pkg-grass-devel@lists.alioth.debian.org
 

Bug#742148: shapelib: FTBFS on powerpc (Both BIG_ENDIAN and LITTLE_ENDIAN defined!

2014-03-26 Thread Cyril Brulebois
Francesco P. Lovergine fran...@debian.org (2014-03-26):
 While I accepted the patch a few minutes ago, indeed I seriously now doubt 
 that
 the fix is correct.
 
 It seems to me that in the original program the LITTLE_ENDIAN should be
 intended as a static build-time definition for the host where the program is 
 built.
 
 So the NAN definition should be intended instead as nan(). That's because
 the shapefile format is endianess-independent and shapelib reads/writes 
 fields on the
 basis of the host platform to respect the format. So the NAN should be
 intended as the *host* NaN format, indeed (to be translated in the shp format 
 NaN, i.e. little endian). 
 That poses a problem on the pcc architecture for instance: __nan_bytes will 
 be not the 
 correct NaN value and will result as a big endian in the file.
 
 See http://dl.maptools.org/dl/shapelib/shapefile.pdf for format.
 
 Do you agree?

To be frank I didn't quite get why it was considered a good idea to
hardcode setting -Dfoo in contrib/Makefile unconditionally instead of
looking at the relevant arch-specific bits. So I assumed this was
deliberate and that this setting was orthogonal to what's in system
headers, that's why I proposed the patch you saw.

(From a quick look between last two upstream releases, this part didn't
change; I guess this issue popped up due to updated system headers, but
I didn't look into it to see what exactly triggered it.)

I guess looking at __BYTE_ORDER would be a better way to actually check
a system's endianness, #error-ing if it's neither __LITTLE_ENDIAN or
__BIG_ENDIAN; I have no idea how much that is portable, but upstream
should probably now a bit about msvc and advise whether that's a viable
option.

Mraw,
KiBi.


signature.asc
Description: Digital signature
___
Pkg-grass-devel mailing list
Pkg-grass-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-grass-devel

Bug#742148: shapelib: FTBFS on powerpc (Both BIG_ENDIAN and LITTLE_ENDIAN defined!

2014-03-26 Thread Francesco P. Lovergine
On Wed, Mar 26, 2014 at 02:17:50PM +0100, Cyril Brulebois wrote:
 Francesco P. Lovergine fran...@debian.org (2014-03-26):
  While I accepted the patch a few minutes ago, indeed I seriously now doubt 
  that
  the fix is correct.
  
  It seems to me that in the original program the LITTLE_ENDIAN should be
  intended as a static build-time definition for the host where the program 
  is built.
  
  So the NAN definition should be intended instead as nan(). That's because
  the shapefile format is endianess-independent and shapelib reads/writes 
  fields on the
  basis of the host platform to respect the format. So the NAN should be
  intended as the *host* NaN format, indeed (to be translated in the shp 
  format NaN, i.e. little endian). 
  That poses a problem on the pcc architecture for instance: __nan_bytes will 
  be not the 
  correct NaN value and will result as a big endian in the file.
  
  See http://dl.maptools.org/dl/shapelib/shapefile.pdf for format.
  
  Do you agree?
 
 To be frank I didn't quite get why it was considered a good idea to
 hardcode setting -Dfoo in contrib/Makefile unconditionally instead of
 looking at the relevant arch-specific bits. So I assumed this was
 deliberate and that this setting was orthogonal to what's in system
 headers, that's why I proposed the patch you saw.
 
 (From a quick look between last two upstream releases, this part didn't
 change; I guess this issue popped up due to updated system headers, but
 I didn't look into it to see what exactly triggered it.)
 

I guess the contrib stuff is not so well maintained and probably not
too much coherent.

 I guess looking at __BYTE_ORDER would be a better way to actually check
 a system's endianness, #error-ing if it's neither __LITTLE_ENDIAN or
 __BIG_ENDIAN; I have no idea how much that is portable, but upstream
 should probably now a bit about msvc and advise whether that's a viable
 option.
 

Well, I would avoid to upset the upstream code that much, a simple use of nan()
instead of NAN could propagate correctly. My only doubt is about the possible 
inclusion of special IEEE values within the final shapefile, a condition that
should not be admitted on the basis of the specs. But this is bread for
upstream's teeth.

-- 
Francesco P. Lovergine

___
Pkg-grass-devel mailing list
Pkg-grass-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-grass-devel


Bug#742148: shapelib: FTBFS on powerpc (Both BIG_ENDIAN and LITTLE_ENDIAN defined!

2014-03-20 Thread Julien Cristau
Source: shapelib
Version: 1.3.0-2
Severity: serious
Justification: fails to build from source (but built successfully in the past)

Hi,

your package no longer builds on powerpc:
 cc -g -I.. -I/sbuild-nonexistent/bld/include -DPROJ4 -D_LITTLE_ENDIAN -DDEBUG 
 -DDEBUG2  shpdxf.c ../shpopen.o ../dbfopen.o ../safileio.o  -o shpdxf
 In file included from /usr/include/endian.h:36:0,
  from /usr/include/powerpc-linux-gnu/bits/waitstatus.h:64,
  from /usr/include/stdlib.h:42,
  from shpdxf.c:40:
 /usr/include/powerpc-linux-gnu/bits/endian.h:26:4: error: #error Both 
 BIG_ENDIAN and LITTLE_ENDIAN defined!
  #  error Both BIG_ENDIAN and LITTLE_ENDIAN defined!
 ^
 make[2]: *** [shpdxf] Error 1

See
https://buildd.debian.org/status/fetch.php?pkg=shapelibarch=powerpcver=1.3.0-2stamp=1395181820

Cheers,
Julien


signature.asc
Description: Digital signature
___
Pkg-grass-devel mailing list
Pkg-grass-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-grass-devel