Opened 12 years ago

Closed 12 years ago

#1720 closed defect (fixed)

r.viewshed doesn't compile in GRASS 7

Reported by: cmbarton Owned by: grass-dev@…
Priority: normal Milestone: 7.0.0
Component: Compiling Version: svn-trunk
Keywords: r.viewshed Cc:
CPU: Unspecified Platform: Unspecified

Description

i don't know exactly when this started, but it is recent.

Last login: Mon Sep  3 13:55:06 on ttys000
Michaels-MacBook-Air:~ cmbarton$ cd /Users/Shared/grass_dev/grass70_dev/raster/r.viewshed
Michaels-MacBook-Air:r.viewshed cmbarton$ make
c++  -arch i386 -isysroot /Developer/SDKs/MacOSX10.6.sdk  -I/Users/Shared/grass_dev/grass70_dev/dist.x86_64-apple-darwin12.1.0/include -I/Users/Shared/grass_dev/grass70_dev/dist.x86_64-apple-darwin12.1.0/include  -D_FILE_OFFSET_BITS=64 -DUSER=\"cmbarton\" -Wno-sign-compare -DPACKAGE=\""grassmods"\"   -I/Users/Shared/grass_dev/grass70_dev/dist.x86_64-apple-darwin12.1.0/include -I/Users/Shared/grass_dev/grass70_dev/dist.x86_64-apple-darwin12.1.0/include -o OBJ.x86_64-apple-darwin12.1.0/distribute.o -c distribute.cpp
In file included from distribute.cpp:52:
In file included from /Users/Shared/grass_dev/grass70_dev/dist.x86_64-apple-darwin12.1.0/include/grass/iostream/ami.h:56:
In file included from /Users/Shared/grass_dev/grass70_dev/dist.x86_64-apple-darwin12.1.0/include/grass/iostream/empq_impl.h:43:
In file included from /Users/Shared/grass_dev/grass70_dev/dist.x86_64-apple-darwin12.1.0/include/grass/iostream/empq.h:51:
/Users/Shared/grass_dev/grass70_dev/dist.x86_64-apple-darwin12.1.0/include/grass/iostream/embuffer.h:1140:56: error: 
      default arguments cannot be added to an out-of-line definition of a member
      of a class template
long em_buffer<T,Key>::insert(AMI_STREAM<T>* str, long bos=0) {
                                                       ^   ~
In file included from distribute.cpp:52:
In file included from /Users/Shared/grass_dev/grass70_dev/dist.x86_64-apple-darwin12.1.0/include/grass/iostream/ami.h:56:
In file included from /Users/Shared/grass_dev/grass70_dev/dist.x86_64-apple-darwin12.1.0/include/grass/iostream/empq_impl.h:43:
In file included from /Users/Shared/grass_dev/grass70_dev/dist.x86_64-apple-darwin12.1.0/include/grass/iostream/empq.h:53:
/Users/Shared/grass_dev/grass70_dev/dist.x86_64-apple-darwin12.1.0/include/grass/iostream/minmaxheap.h:512:7: error: 
      reference to non-static member function must be called; did you mean to
      call it with no arguments?
  if (size) {
      ^~~~
          ()
distribute.cpp:89:15: warning: format string is not a string literal
      (potentially insecure) [-Wformat-security]
    G_message(_("Start distributed sweeping."));
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/Shared/grass_dev/grass70_dev/dist.x86_64-apple-darwin12.1.0/include/grass/glocale.h:10:16: note: 
      expanded from macro '_'
#define _(str) G_gettext(PACKAGE,(str))
               ^~~~~~~~~~~~~~~~~~~~~~~~
distribute.cpp:149:15: warning: format string is not a string literal
      (potentially insecure) [-Wformat-security]
    G_message(_("Distribution sweeping done."));
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/Shared/grass_dev/grass70_dev/dist.x86_64-apple-darwin12.1.0/include/grass/glocale.h:10:16: note: 
      expanded from macro '_'
#define _(str) G_gettext(PACKAGE,(str))
               ^~~~~~~~~~~~~~~~~~~~~~~~
2 warnings and 2 errors generated.
make: *** [OBJ.x86_64-apple-darwin12.1.0/distribute.o] Error 1
Michaels-MacBook-Air:r.viewshed cmbarton$ 

Change History (8)

comment:1 by glynn, 12 years ago

This is effectively a duplicate of #1714 (the issue is in the iostream headers, not r.terraflow or r.viewshed).

It should be fixed by r53077.

comment:2 by cmbarton, 12 years ago

Thanks. I will test tonight. If this solves the problem, it also needs to be backported to GRASS 6.x

Michael

comment:3 by cmbarton, 12 years ago

This does seem to solve the r.viewshed problem, but does not fix r.terraflow not compiling (#1714).

However, adding --with-CXX=/usr/bin/g++ to my configure string does seem to fix the r.terraflow problem. This switches from using c++ to g++. William Kyngesburye's suggestion.

Michaesl

comment:4 by cmbarton, 12 years ago

I was wrong about adding --with-CXX=/usr/bin/g++ to my configure string. That doesn't switch compilers in platform.make. I needed to hack platform make and change it manually. Then r.terraflow compiles

Michael

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

Replying to cmbarton:

This does seem to solve the r.viewshed problem, but does not fix r.terraflow not compiling (#1714).

With r53077, the compilation cannot fail with the errors in #1714. It could still fail for other reasons, but those would need to be stated.

in reply to:  4 comment:6 by glynn, 12 years ago

Replying to cmbarton:

I was wrong about adding --with-CXX=/usr/bin/g++ to my configure string. That doesn't switch compilers in platform.make.

A specific C++ compiler can be forced by setting the CXX environment variable, e.g.

CXX=/usr/bin/g++ ./configure ...

Similarly, CC, CPPFLAGS, CFLAGS, CXXFLAGS, and LDFLAGS can be set via environment variables; the configure script won't auto-detect the setting if the environment variable exists.

comment:7 by cmbarton, 12 years ago

Thanks. That's what I've done. Both r.terraflow and r.viewshed compile correctly now.

Michael

comment:8 by neteler, 12 years ago

Resolution: fixed
Status: newclosed

Backported to 6.4 and 6.5 in r53094 and r53095.

Closing since it should be fixed on all branches and trunk. Reopen if needed.

Note: See TracTickets for help on using tickets.