Opened 12 years ago

Closed 12 years ago

#1655 closed defect (fixed)

problem compiling r.terraflow with g++ 4.7.0

Reported by: hamish Owned by: grass-dev@…
Priority: critical Milestone: 6.4.3
Component: Compiling Version: 6.4.2
Keywords: r.terraflow, libiostream Cc: frankie
CPU: x86-64 Platform: Linux

Description

Hi,

for 6.4.2 on Debian/sid we're getting the following fail to builds:

Errors in:
/home/hamish/dev/grass/git/grass/lib/iostream
/home/hamish/dev/grass/git/grass/raster/r.terraflow
--

lib/iostream is fixed by backporting r50130.

r.terraflow still fails with a number of "'foo' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]":

.../raster/r.terraflow$ make
mkdir -p OBJ.x86_64-pc-linux-gnu/FLOAT
c++ -c -I/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include  -g -O2   -DUSER=\"hamish\" -DNODATA_FIX -D_FILE_OFFSET_BITS=64   -DPACKAGE=\""grassmods"\" -DELEV_FLOAT main.cc -o OBJ.x86_64-pc-linux-gnu/FLOAT/main.o
In file included from /home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/empq_adaptive_impl.h:30:0,
                 from /home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/ami.h:41,
                 from common.h:27,
                 from main.cc:39:
/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/empq_adaptive.h: In constructor 'EMPQueueAdaptive<T, Key>::EMPQueueAdaptive(long int)':
/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/empq_adaptive.h:53:47: warning: delegating constructors only available with -std=c++11 or -std=gnu++11 [enabled by default]
c++ -c -I/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include  -g -O2   -DUSER=\"hamish\" -DNODATA_FIX -D_FILE_OFFSET_BITS=64   -DPACKAGE=\""grassmods"\" -DELEV_FLOAT common.cc -o OBJ.x86_64-pc-linux-gnu/FLOAT/common.o
In file included from /home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/empq_adaptive_impl.h:30:0,
                 from /home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/ami.h:41,
                 from common.h:27,
                 from common.cc:35:
/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/empq_adaptive.h: In constructor 'EMPQueueAdaptive<T, Key>::EMPQueueAdaptive(long int)':
/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/empq_adaptive.h:53:47: warning: delegating constructors only available with -std=c++11 or -std=gnu++11 [enabled by default]
c++ -c -I/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include  -g -O2   -DUSER=\"hamish\" -DNODATA_FIX -D_FILE_OFFSET_BITS=64   -DPACKAGE=\""grassmods"\" -DELEV_FLOAT stats.cc -o OBJ.x86_64-pc-linux-gnu/FLOAT/stats.o
In file included from /home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/empq_adaptive_impl.h:30:0,
                 from /home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/ami.h:41,
                 from stats.h:29,
                 from stats.cc:30:
/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/empq_adaptive.h: In constructor 'EMPQueueAdaptive<T, Key>::EMPQueueAdaptive(long int)':
/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/empq_adaptive.h:53:47: warning: delegating constructors only available with -std=c++11 or -std=gnu++11 [enabled by default]
c++ -c -I/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include  -g -O2   -DUSER=\"hamish\" -DNODATA_FIX -D_FILE_OFFSET_BITS=64   -DPACKAGE=\""grassmods"\" -DELEV_FLOAT fill.cc -o OBJ.x86_64-pc-linux-gnu/FLOAT/fill.o
In file included from /home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/empq_adaptive_impl.h:30:0,
                 from /home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/ami.h:41,
                 from fill.h:22,
                 from fill.cc:24:
/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/empq_adaptive.h: In constructor 'EMPQueueAdaptive<T, Key>::EMPQueueAdaptive(long int)':
/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/empq_adaptive.h:53:47: warning: delegating constructors only available with -std=c++11 or -std=gnu++11 [enabled by default]
c++ -c -I/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include  -g -O2   -DUSER=\"hamish\" -DNODATA_FIX -D_FILE_OFFSET_BITS=64   -DPACKAGE=\""grassmods"\" -DELEV_FLOAT types.cc -o OBJ.x86_64-pc-linux-gnu/FLOAT/types.o
c++ -c -I/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include  -g -O2   -DUSER=\"hamish\" -DNODATA_FIX -D_FILE_OFFSET_BITS=64   -DPACKAGE=\""grassmods"\" -DELEV_FLOAT ccforest.cc -o OBJ.x86_64-pc-linux-gnu/FLOAT/ccforest.o
In file included from /home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/empq_adaptive_impl.h:30:0,
                 from /home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/ami.h:41,
                 from ccforest.h:27,
                 from ccforest.cc:19:
/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/empq_adaptive.h: In constructor 'EMPQueueAdaptive<T, Key>::EMPQueueAdaptive(long int)':
/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/empq_adaptive.h:53:47: warning: delegatinghamish@sid-amd64-vm:~/dev/grass/git/grass/raster/r.terraflow$ make
mkdir -p OBJ.x86_64-pc-linux-gnu/FLOAT
c++ -c -I/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include  -g -O2   -DUSER=\"hamish\" -DNODATA_FIX -D_FILE_OFFSET_BITS=64   -DPACKAGE=\""grassmods"\" -DELEV_FLOAT main.cc -o OBJ.x86_64-pc-linux-gnu/FLOAT/main.o
In file included from /home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/empq_adaptive_impl.h:30:0,
                 from /home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/ami.h:41,
                 from common.h:27,
                 from main.cc:39:
/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/empq_adaptive.h: In constructor 'EMPQueueAdaptive<T, Key>::EMPQueueAdaptive(long int)':
/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/empq_adaptive.h:53:47: warning: delegating constructors only available with -std=c++11 or -std=gnu++11 [enabled by default]
c++ -c -I/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include  -g -O2   -DUSER=\"hamish\" -DNODATA_FIX -D_FILE_OFFSET_BITS=64   -DPACKAGE=\""grassmods"\" -DELEV_FLOAT common.cc -o OBJ.x86_64-pc-linux-gnu/FLOAT/common.o
In file included from /home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/empq_adaptive_impl.h:30:0,
                 from /home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/ami.h:41,
                 from common.h:27,
                 from common.cc:35:
/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/empq_adaptive.h: In constructor 'EMPQueueAdaptive<T, Key>::EMPQueueAdaptive(long int)':
/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/empq_adaptive.h:53:47: warning: delegating constructors only available with -std=c++11 or -std=gnu++11 [enabled by default]
c++ -c -I/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include  -g -O2   -DUSER=\"hamish\" -DNODATA_FIX -D_FILE_OFFSET_BITS=64   -DPACKAGE=\""grassmods"\" -DELEV_FLOAT stats.cc -o OBJ.x86_64-pc-linux-gnu/FLOAT/stats.o
In file included from /home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/empq_adaptive_impl.h:30:0,
                 from /home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/ami.h:41,
                 from stats.h:29,
                 from stats.cc:30:
/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/empq_adaptive.h: In constructor 'EMPQueueAdaptive<T, Key>::EMPQueueAdaptive(long int)':
/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/empq_adaptive.h:53:47: warning: delegating constructors only available with -std=c++11 or -std=gnu++11 [enabled by default]
c++ -c -I/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include  -g -O2   -DUSER=\"hamish\" -DNODATA_FIX -D_FILE_OFFSET_BITS=64   -DPACKAGE=\""grassmods"\" -DELEV_FLOAT fill.cc -o OBJ.x86_64-pc-linux-gnu/FLOAT/fill.o
In file included from /home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/empq_adaptive_impl.h:30:0,
                 from /home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/ami.h:41,
                 from fill.h:22,
                 from fill.cc:24:
/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/empq_adaptive.h: In constructor 'EMPQueueAdaptive<T, Key>::EMPQueueAdaptive(long int)':
/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/empq_adaptive.h:53:47: warning: delegating constructors only available with -std=c++11 or -std=gnu++11 [enabled by default]
c++ -c -I/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include  -g -O2   -DUSER=\"hamish\" -DNODATA_FIX -D_FILE_OFFSET_BITS=64   -DPACKAGE=\""grassmods"\" -DELEV_FLOAT types.cc -o OBJ.x86_64-pc-linux-gnu/FLOAT/types.o
c++ -c -I/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include  -g -O2   -DUSER=\"hamish\" -DNODATA_FIX -D_FILE_OFFSET_BITS=64   -DPACKAGE=\""grassmods"\" -DELEV_FLOAT ccforest.cc -o OBJ.x86_64-pc-linux-gnu/FLOAT/ccforest.o
In file included from /home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/empq_adaptive_impl.h:30:0,
                 from /home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/ami.h:41,
                 from ccforest.h:27,
                 from ccforest.cc:19:
/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/empq_adaptive.h: In constructor 'EMPQueueAdaptive<T, Key>::EMPQueueAdaptive(long int)':
/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/empq_adaptive.h:53:47: warning: delegating constructors only available with -std=c++11 or -std=gnu++11 [enabled by default]
In file included from /home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/empq.h:35:0,
                 from /home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/empq_impl.h:26,
                 from /home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/ami.h:39,
                 from ccforest.h:27,
                 from ccforest.cc:19:
/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/minmaxheap.h: In instantiation of 'HeapIndex MinMaxHeap<T>::fill(T*, HeapIndex) [with T = keyvalue<int>; HeapIndex = unsigned int]':
/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/empq_impl.h:674:67:   required from 'bool em_pqueue<T, Key>::min(T&) [with T = keyvalue<int>; Key = int]'
/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/empq_adaptive_impl.h:237:2:   required from 'bool EMPQueueAdaptive<T, Key>::min(T&) [with T = keyvalue<int>; Key = int]'
ccforest.cc:164:4:   required from 'void ccforest<T>::findAllRoots(int) [with T = int]'
ccforest.cc:340:16:   required from here
/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/minmaxheap.h:747:5: error: 'insert' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/minmaxheap.h:747:5: note: declarations in dependent base 'BasicMinMaxHeap<keyvalue<int> >' are not found by unqualified lookup
/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/minmaxheap.h:747:5: note: use 'this->insert' instead
/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/minmaxheap.h: In instantiation of 'void UnboundedMinMaxHeap<T>::grow() [with T = keyvalue<int>]':
ccforest.cc:340:38:   required from here
/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/minmaxheap.h:780:2: error: 'allocateHeap' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/minmaxheap.h:780:2: note: declarations in dependent base 'BasicMinMaxHeap<keyvalue<int> >' are not found by unqualified lookup
/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/minmaxheap.h:780:2: note: use 'this->allocateHeap' instead
/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/minmaxheap.h:786:2: error: 'freeHeap' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/minmaxheap.h:786:2: note: declarations in dependent base 'BasicMinMaxHeap<keyvalue<int> >' are not found by unqualified lookup
/home/hamish/dev/grass/git/grass/dist.x86_64-pc-linux-gnu/include/grass/iostream/minmaxheap.h:786:2: note: use 'this->freeHeap' instead
make: *** [OBJ.x86_64-pc-linux-gnu/FLOAT/ccforest.o] Error 1

?

  • Debian's gcc 4.7.0-8
  • Debian's eglibc 2.13-32

thanks, Hamish

Change History (4)

comment:1 by hamish, 12 years ago

as suggested by the error message, adding "this->" before 'insert', 'allocateHeap', and 'freeHeap' allowed it to compile.

interestingly it was taking the header file from dist.*/include/ not include/, so I had to edit both to get it to take.

any comments before committing the change? (I'm no C++ expert, just monkey see-monkey do in this case)

Hamish

comment:2 by hamish, 12 years ago

diff --git a/include/iostream/minmaxheap.h b/include/iostream/minmaxheap.h
index c3d057a..4991c22 100644
--- a/include/iostream/minmaxheap.h
+++ b/include/iostream/minmaxheap.h
@@ -744,7 +744,7 @@ HeapIndex MinMaxHeap<T>::fill(T* arr, HeapIndex n) {
   //heap must be empty
   assert(this->size()==0);
   for (i = 0; !full() && i<n; i++) {
-    insert(arr[i]);
+    this->insert(arr[i]);
   }
   if (i < n) {
     assert(i == this->maxsize);
@@ -777,13 +777,13 @@ void UnboundedMinMaxHeap<T>::grow() {
 
   if(old) {
        HeapIndex n = this->size();
-       this->A = allocateHeap(this->maxsize);  /* allocate a new array */
+       this->A = this->allocateHeap(this->maxsize);    /* allocate a new array */
        /* copy over the old values */
        assert(this->maxsize > n);
        for(HeapIndex i=0; i<=n; i++) { /* why extra value? -RW */
          this->A[i] = old[i];
        }       
-       freeHeap(old);                          /* free up old storage */
+       this->freeHeap(old);                    /* free up old storage */
   }
 
 }

in reply to:  1 comment:3 by glynn, 12 years ago

Replying to hamish:

any comments before committing the change?

It looks fine to me.

FWIW, this gcc bug allowed it to compile in older versions, but that has apparently been fixed in 4.7.0.

comment:4 by hamish, 12 years ago

Resolution: fixed
Status: newclosed

committed to trunk with r51633, and backported (along with r50130) to devbr6 and relbr64.

Hamish

Note: See TracTickets for help on using tickets.