Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop branch is broken #154

Closed
alexbruy opened this issue Jan 13, 2018 · 14 comments
Closed

Develop branch is broken #154

alexbruy opened this issue Jan 13, 2018 · 14 comments

Comments

@alexbruy
Copy link
Contributor

I tried to improve build system a bit in Develop branch, but looks like it is broken

In file included from /home/alex/devel/TauDEM/src/commonLib.h:101:0,
                 from /home/alex/devel/TauDEM/src/tiffIO.h:49,
                 from /home/alex/devel/TauDEM/src/tiffIO.cpp:47:
/home/alex/devel/TauDEM/src/linearpart.h: In member function ‘void linearpart<datatype>::savedxdyc(tiffIO&)’:
/home/alex/devel/TauDEM/src/linearpart.h:523:16: error: invalid use of incomplete type ‘class tiffIO’
      dxc[i]=obj.getdxc(globalY);
                ^
In file included from /home/alex/devel/TauDEM/src/linearpart.h:42:0,
                 from /home/alex/devel/TauDEM/src/commonLib.h:101,
                 from /home/alex/devel/TauDEM/src/tiffIO.h:49,
                 from /home/alex/devel/TauDEM/src/tiffIO.cpp:47:
/home/alex/devel/TauDEM/src/partition.h:46:7: note: forward declaration of ‘class tiffIO’
 class tiffIO;
       ^
In file included from /home/alex/devel/TauDEM/src/commonLib.h:101:0,
                 from /home/alex/devel/TauDEM/src/tiffIO.h:49,
                 from /home/alex/devel/TauDEM/src/tiffIO.cpp:47:
/home/alex/devel/TauDEM/src/linearpart.h:524:13: error: invalid use of incomplete type ‘class tiffIO’
   dyc[i]=obj.getdyc(globalY);
             ^
In file included from /home/alex/devel/TauDEM/src/linearpart.h:42:0,
                 from /home/alex/devel/TauDEM/src/commonLib.h:101,
                 from /home/alex/devel/TauDEM/src/tiffIO.h:49,
                 from /home/alex/devel/TauDEM/src/tiffIO.cpp:47:
/home/alex/devel/TauDEM/src/partition.h:46:7: note: forward declaration of ‘class tiffIO’
 class tiffIO;
@dtarb
Copy link
Owner

dtarb commented Jan 13, 2018

What system and compiler are you working on. I just verified that I am able to rebuild and successfully execute the test suite on a PC. This Tiffio class has been successfully used for a while and has not changed recently.

@alexbruy
Copy link
Contributor Author

I'm on LInux. Trying to build with GCC 5.4.0 got error posted in the first message.

@dtarb
Copy link
Owner

dtarb commented Jan 14, 2018

Does your pull request #155 resolve this, or is this still a problem.

@alexbruy
Copy link
Contributor Author

#155 is a completely dufferent thing, it is about missed tools in the CMakeLists.txt

@dtarb
Copy link
Owner

dtarb commented Jan 14, 2018

OK. I do not know how to change the code to fix this, and it works for my current PC visual studio setup.

@twilkinson
Copy link

Hi @alexbruy, did you ever get a solution to this problem? I'm running into the same thing trying to build the Develop branch on Linux (CentOS 7.4).

In fact, even to get this far, I've also had to work around #166 by removing all references to SetRegion and SetRegionmn in CMakeLists.txt.

Any suggestions?

Terry

@dtarb
Copy link
Owner

dtarb commented May 27, 2018

I've just today pushed new code and build information for both make and cmake to the develop branch.. I was able to compile all code on linux. I will close this issue, but feel free to reopen, or open another one if there are still problems.

@dtarb dtarb closed this as completed May 27, 2018
@twilkinson
Copy link

twilkinson commented May 27, 2018

@dtarb , what version of Linux are you using? Are you using any special compiler switches? I'm using Ubuntu 14.04 LTS and with default installation of C and C++.

I cloned a new copy of the Develop branch, did the cmake, and make as follows, and I'm getting these errors (I think same as @alexbruy describes above in the OP). It seems to be having trouble compiling tiffIO.cpp

vagrant@vagrant-ubuntu-trusty-64:~/TauDEM-Develop/src/build$ cmake ..
-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found MPI_C: /usr/lib/x86_64-linux-gnu/libmpich.so;/usr/lib/x86_64-linux-gnu/libopa.so;/usr/lib/x86_64-linux-gnu/libmpl.so;/usr/lib/x86_64-linux-gnu/librt.so;/usr
/lib/libcr.so;/usr/lib/x86_64-linux-gnu/libpthread.so
-- Found MPI_CXX: /usr/lib/x86_64-linux-gnu/libmpichcxx.so;/usr/lib/x86_64-linux-gnu/libmpich.so;/usr/lib/x86_64-linux-gnu/libopa.so;/usr/lib/x86_64-linux-gnu/libmpl
.so;/usr/lib/x86_64-linux-gnu/librt.so;/usr/lib/libcr.so;/usr/lib/x86_64-linux-gnu/libpthread.so
-- Found GDAL: /usr/lib/libgdal.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/vagrant/TauDEM-Develop/src/build

    vagrant@vagrant-ubuntu-trusty-64:~/TauDEM-Develop/src/build$ make
Scanning dependencies of target aread8
[  0%] Building CXX object CMakeFiles/aread8.dir/aread8mn.cpp.o
[  1%] Building CXX object CMakeFiles/aread8.dir/aread8.cpp.o
[  1%] Building CXX object CMakeFiles/aread8.dir/commonLib.cpp.o
[  2%] Building CXX object CMakeFiles/aread8.dir/tiffIO.cpp.o
In file included from /home/vagrant/TauDEM-Develop/src/commonLib.h:102:0,
                 from /home/vagrant/TauDEM-Develop/src/tiffIO.h:49,
                 from /home/vagrant/TauDEM-Develop/src/tiffIO.cpp:47:
/home/vagrant/TauDEM-Develop/src/linearpart.h: In member function ‘void linearpart<datatype>::savedxdyc(tiffIO&)’:
/home/vagrant/TauDEM-Develop/src/linearpart.h:523:16: error: invalid use of incomplete type ‘class tiffIO’
      dxc[i]=obj.getdxc(globalY);
                ^
In file included from /home/vagrant/TauDEM-Develop/src/linearpart.h:42:0,
                 from /home/vagrant/TauDEM-Develop/src/commonLib.h:102,
                 from /home/vagrant/TauDEM-Develop/src/tiffIO.h:49,
                 from /home/vagrant/TauDEM-Develop/src/tiffIO.cpp:47:
/home/vagrant/TauDEM-Develop/src/partition.h:46:7: error: forward declaration of ‘class tiffIO’
 class tiffIO;
       ^
In file included from /home/vagrant/TauDEM-Develop/src/commonLib.h:102:0,
                 from /home/vagrant/TauDEM-Develop/src/tiffIO.h:49,
                 from /home/vagrant/TauDEM-Develop/src/tiffIO.cpp:47:
/home/vagrant/TauDEM-Develop/src/linearpart.h:524:13: error: invalid use of incomplete type ‘class tiffIO’
   dyc[i]=obj.getdyc(globalY);
             ^
In file included from /home/vagrant/TauDEM-Develop/src/linearpart.h:42:0,
                 from /home/vagrant/TauDEM-Develop/src/commonLib.h:102,
                 from /home/vagrant/TauDEM-Develop/src/tiffIO.h:49,
                 from /home/vagrant/TauDEM-Develop/src/tiffIO.cpp:47:
/home/vagrant/TauDEM-Develop/src/partition.h:46:7: error: forward declaration of ‘class tiffIO’
 class tiffIO;
       ^
/home/vagrant/TauDEM-Develop/src/tiffIO.cpp: In member function ‘void tiffIO::read(long int, long int, long int, long int, void*)’:
/home/vagrant/TauDEM-Develop/src/tiffIO.cpp:250:8: warning: ignoring return value of ‘CPLErr GDALRasterIO(GDALRasterBandH, GDALRWFlag, int, int, int, int, void*, int
, int, GDALDataType, int, int)’, declared with attribute warn_unused_result [-Wunused-result]
   0, 0);
        ^
/home/vagrant/TauDEM-Develop/src/tiffIO.cpp: In member function ‘void tiffIO::write(long int, long int, long int, long int, void*)’:
/home/vagrant/TauDEM-Develop/src/tiffIO.cpp:370:9: warning: ignoring return value of ‘CPLErr GDALRasterIO(GDALRasterBandH, GDALRWFlag, int, int, int, int, void*, int
, int, GDALDataType, int, int)’, declared with attribute warn_unused_result [-Wunused-result]
    0, 0);
         ^
/home/vagrant/TauDEM-Develop/src/tiffIO.cpp:408:9: warning: ignoring return value of ‘CPLErr GDALRasterIO(GDALRasterBandH, GDALRWFlag, int, int, int, int, void*, int
, int, GDALDataType, int, int)’, declared with attribute warn_unused_result [-Wunused-result]
    0, 0);
         ^
make[2]: *** [CMakeFiles/aread8.dir/tiffIO.cpp.o] Error 1
make[1]: *** [CMakeFiles/aread8.dir/all] Error 2
make: *** [all] Error 2
vagrant@vagrant-ubuntu-trusty-64:~/TauDEM-Develop/src/build$

Terry

@dtarb
Copy link
Owner

dtarb commented May 27, 2018

I am using ubuntu 16.04.4 LTS

The difference I would be most suspicious of is the compiler. I am using C compiler GNU 7.3.0. Your message above indicates GNU 4.8.4. I get similar messages to the ones you are getting, but they do not get reported as errors, rather they are given as warnings. For example the first one I get is

In file included from /home/dtarb/TauDEM/src/commonLib.h:102:0,
                 from /home/dtarb/TauDEM/src/tiffIO.h:49,
                 from /home/dtarb/TauDEM/src/tiffIO.cpp:47:
/home/dtarb/TauDEM/src/linearpart.h: In member function ‘void linearpart<datatype>::savedxdyc(tiffIO&)’:
/home/dtarb/TauDEM/src/linearpart.h:523:13: warning: invalid use of incomplete type ‘class tiffIO’
      dxc[i]=obj.getdxc(globalY);
             ^~~

It may take a C++ template classes guru to help us out with this.

Look at https://github.com/dtarb/TauDEM/blob/Develop/GCC.sh where I give the steps I used to upgrade the C++ compiler. I do not know if compiler version is the root cause of the warning/error problem or whether there is an error permissiveness setting somewhere that would help you. But I do think you may need the newer compiler for some other functionality that has been added.

@dtarb
Copy link
Owner

dtarb commented May 28, 2018

@twilkinson Try pull a copy of the HeaderRefactor branch. I thought I should try and address the problem that was giving me a warning and you an error and which when I investigated seemed to be due to a forward declaration error. I have tried to fix this in the new branch, and on my computer no longer get the compiler warning above. The strategy I took, in case you are curious is described in https://github.com/dtarb/TauDEM/blob/HeaderRefactor/UpdateNotes.txt. I'll merge this branch into Develop once it has been tested a bit more, but my tests seem to check out so far.

@dtarb dtarb reopened this May 28, 2018
@twilkinson
Copy link

@dtarb, thanks for this. The HeaderRefactor branch now works fine for me on both Ubuntu 14.04/C++v4.8.4 and Centos 7.4/C++v5.4.0. I did have to add the following (from https://stackoverflow.com/questions/10851247/how-to-activate-c-11-in-cmake) near the top of CMakeLists.txt to activate the C++ 11 standard:

macro(use_cxx11)
  if (CMAKE_VERSION VERSION_LESS "3.1")
    if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
      set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
    endif ()
  else ()
    set (CMAKE_CXX_STANDARD 11)
  endif ()
endmacro(use_cxx11)

use_cxx11()

Fyi, using this branch I was also able to remove the -netlyr logan switch (issue hydroshare/hydroshare-jupyterhub#113) from the commandline when running streamnet, so that issue seems to be fixed too.

AND the additional information in the github README.txt is very useful! Thanks.

@dtarb
Copy link
Owner

dtarb commented May 28, 2018

Glad it is working. Looking at that stack overflow answer it seems like the macro you added may be limited to GCC (for CMake versions <3.1). It would be simpler to just add set (CMAKE_CXX_STANDARD 11) and require CMake version >=3.1 (released 12/2014 which may be after Ubuntu 14.04). Would this be limiting? The current minimum required version is 2.8.9. My box has version 3.5.1 (released 3/2016 - which is consistent perhaps with Ubuntu 16.04).

I think that removing the -netlyr option should have been possible on the Develop branch since commit 951ed55 on Nov 18 https://github.com/dtarb/TauDEM/commits/Develop/src/streamnet.cpp, but perhaps you have not been able to compile since then.

@twilkinson
Copy link

Yes, it does look like the macro I got from stackoverflow will only work for GCC - luckily that's what I have :-). No problem upgrading cmake though (https://askubuntu.com/questions/610291/how-to-install-cmake-3-2-on-ubuntu), and then simply adding the one line set (CMAKE_CXX_STANDARD 11) to CMakeLists.txt.

And you are right about the -netlyr option - I've just not been able to compile the Develop branch until now.

Looks all good now.

@dtarb dtarb mentioned this issue May 28, 2018
@dtarb
Copy link
Owner

dtarb commented May 28, 2018

Thanks. I updated CMakeLists and merged this branch into develop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants