i386/150046: exact-image-0.8.1 does not compile on i386.

Red Legion redlegion at gmail.com
Fri Aug 27 17:00:11 UTC 2010


>Number:         150046
>Category:       i386
>Synopsis:       exact-image-0.8.1 does not compile on i386.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-i386
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Aug 27 17:00:10 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Red Legion
>Release:        8.1-RELEASE
>Organization:
>Environment:
FreeBSD qhell.legion 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Mon Jul 19 02:55:53 UTC 2010     root at almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386

>Description:
exact-image-0.8.1 does not compile on i386. It generates this output when attempting to compile:


  C++       objdir/lib/Colorspace.o
In file included from lib/Colorspace.cc:24:
lib/ImageIterator2.hh: In member function 'rgb16_iterator::accu& rgb16_iterator::accu::abs()':
lib/ImageIterator2.hh:358: error: call of overloaded 'abs(int64_t&)' is ambiguous
/usr/include/stdlib.h:83: note: candidates are: int abs(int)
/usr/include/c++/4.2/cstdlib:143: note:                 long int std::abs(long int)
lib/ImageIterator2.hh:359: error: call of overloaded 'abs(int64_t&)' is ambiguous
/usr/include/stdlib.h:83: note: candidates are: int abs(int)
/usr/include/c++/4.2/cstdlib:143: note:                 long int std::abs(long int)
lib/ImageIterator2.hh:360: error: call of overloaded 'abs(int64_t&)' is ambiguous
/usr/include/stdlib.h:83: note: candidates are: int abs(int)
/usr/include/c++/4.2/cstdlib:143: note:                 long int std::abs(long int)
lib/ImageIterator2.hh: In member function 'gray16_iterator::accu& gray16_iterator::accu::abs()':
lib/ImageIterator2.hh:637: error: call of overloaded 'abs(int64_t&)' is ambiguous
/usr/include/stdlib.h:83: note: candidates are: int abs(int)
/usr/include/c++/4.2/cstdlib:143: note:                 long int std::abs(long int)
gmake: *** [objdir/lib/Colorspace.o] Error 1

>How-To-Repeat:
make install of /usr/ports/graphics/exact-image
>Fix:
Zao of ##freebsd on Freenode suggested a std::abs template in detail namespace, which is included in the patch submitted. Actually works.

Patch attached with submission follows:

*** ImageIterator2.hh	Fri Aug 27 12:36:23 2010
--- temp/ImageIterator2.hh	Fri Aug 27 12:33:52 2010
***************
*** 17,26 ****
--- 17,33 ----
  
  #include "Image.hh"
  
  #include <algorithm>
  
+ namespace detail
+ {
+     template <typename T> T abs(T const& n) {
+         return (n < (T)0 ? -n : n);
+     }
+ }
+ 
  class rgb_iterator
  {
  public:
    uint8_t* ptr;
    uint8_t* ptr_begin;
***************
*** 351,365 ****
      static accu one () {
        accu a;
        a.v1 = a.v2 = a.v3 = 0xffff;
        return a;
      }
!     
      accu& abs() {
!       v1 = std::abs(v1);
!       v2 = std::abs(v2);
!       v3 = std::abs(v3);
        return *this;
      }
  
      void saturate () {
        v1 = std::min (std::max (v1, (vtype)0), (vtype)0xffff);
--- 358,372 ----
      static accu one () {
        accu a;
        a.v1 = a.v2 = a.v3 = 0xffff;
        return a;
      }
! 
      accu& abs() {
!       v1 = detail::abs(v1);
!       v2 = detail::abs(v2);
!       v3 = detail::abs(v3);
        return *this;
      }
  
      void saturate () {
        v1 = std::min (std::max (v1, (vtype)0), (vtype)0xffff);
***************
*** 632,642 ****
        a.v1 = 0xffff;
        return a;
      }
      
      accu& abs() {
!       v1 = std::abs(v1);
        return *this;
      }
  
      void saturate () {
        v1 = std::min (std::max (v1, (vtype)0), (vtype)0xffff);
--- 639,649 ----
        a.v1 = 0xffff;
        return a;
      }
      
      accu& abs() {
!       v1 = detail::abs(v1);
        return *this;
      }
  
      void saturate () {
        v1 = std::min (std::max (v1, (vtype)0), (vtype)0xffff);


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-i386 mailing list