ossimlabs / ossim-plugins

Contains all plugin libraries providing functional extensions to core OSSIM library
MIT License
12 stars 21 forks source link

build error on ubuntu 18.04 - gdal plugin #41

Open epifanio opened 5 years ago

epifanio commented 5 years ago

Hi,

trying to build the gdal plugin on ubuntu 18.04 default repository, gdal version 2.2.3 I got this error:

[ 98%] Built target ossim_fftw3_plugin
[ 98%] Building CXX object ossim-plugins/gdal/src/CMakeFiles/ossim_gdal_plugin.dir/ossimGdalPluginInit.cpp.o
/home/epinux/dev/OSSIM/ossim-plugins/gdal/src/ossimGdalPluginInit.cpp: In function ‘void setValidDrivers(const ossimKeywordlist&)’:
/home/epinux/dev/OSSIM/ossim-plugins/gdal/src/ossimGdalPluginInit.cpp:50:8: error: ‘function’ is not a member of ‘std’
   std::function<bool(GDALDriverH, ossimRegExp &)>
        ^~~~~~~~
/home/epinux/dev/OSSIM/ossim-plugins/gdal/src/ossimGdalPluginInit.cpp:50:8: note: suggested alternative: ‘is_function’
   std::function<bool(GDALDriverH, ossimRegExp &)>
        ^~~~~~~~
        is_function
/home/epinux/dev/OSSIM/ossim-plugins/gdal/src/ossimGdalPluginInit.cpp:50:48: error: expression list treated as compound expression in functional cast [-fpermissive]
   std::function<bool(GDALDriverH, ossimRegExp &)>
                                                ^
/home/epinux/dev/OSSIM/ossim-plugins/gdal/src/ossimGdalPluginInit.cpp:50:17: error: expected primary-expression before ‘bool’
   std::function<bool(GDALDriverH, ossimRegExp &)>
                 ^~~~
/home/epinux/dev/OSSIM/ossim-plugins/gdal/src/ossimGdalPluginInit.cpp:57:5: error: ‘isDriverEnabled’ was not declared in this scope
     isDriverEnabled = [](GDALDriverH driver, ossimRegExp &regExpression) -> bool { return regExpression.find(GDALGetDriverShortName(driver)); };
     ^~~~~~~~~~~~~~~
/home/epinux/dev/OSSIM/ossim-plugins/gdal/src/ossimGdalPluginInit.cpp:64:7: error: ‘isDriverEnabled’ was not declared in this scope
       isDriverEnabled = [](GDALDriverH driver, ossimRegExp &regExpression) -> bool { return !regExpression.find(GDALGetDriverShortName(driver)); };
       ^~~~~~~~~~~~~~~
/home/epinux/dev/OSSIM/ossim-plugins/gdal/src/ossimGdalPluginInit.cpp:73:7: error: ‘isDriverEnabled’ was not declared in this scope
       isDriverEnabled = [](GDALDriverH driver, ossimRegExp &regExpression) -> bool { return regExpression.find(GDALGetDriverShortName(driver)); };
       ^~~~~~~~~~~~~~~
/home/epinux/dev/OSSIM/ossim-plugins/gdal/src/ossimGdalPluginInit.cpp:80:9: error: ‘isDriverEnabled’ was not declared in this scope
         isDriverEnabled = [](GDALDriverH driver, ossimRegExp &regExpression) -> bool { return !regExpression.find(GDALGetDriverShortName(driver)); };
         ^~~~~~~~~~~~~~~
/home/epinux/dev/OSSIM/ossim-plugins/gdal/src/ossimGdalPluginInit.cpp:93:12: error: ‘isDriverEnabled’ was not declared in this scope
       if (!isDriverEnabled(driver, driverRegEx))
            ^~~~~~~~~~~~~~~
ossim-plugins/gdal/src/CMakeFiles/ossim_gdal_plugin.dir/build.make:278: recipe for target 'ossim-plugins/gdal/src/CMakeFiles/ossim_gdal_plugin.dir/ossimGdalPluginInit.cpp.o' failed
make[2]: *** [ossim-plugins/gdal/src/CMakeFiles/ossim_gdal_plugin.dir/ossimGdalPluginInit.cpp.o] Error 1
CMakeFiles/Makefile2:6958: recipe for target 'ossim-plugins/gdal/src/CMakeFiles/ossim_gdal_plugin.dir/all' failed
make[1]: *** [ossim-plugins/gdal/src/CMakeFiles/ossim_gdal_plugin.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
epifanio commented 5 years ago

I tried to add the following to my cmake configuration CMAKE_CXX_FLAGS=-std=c++0x but I wasn't able to fix the error.

DKlaren commented 5 years ago

I ran into this issue on Ubuntu 18.10 as well. It seems that the compiler installed on Ubuntu 18.XX (gcc 8.2.0) has some changes that affect the build while older versions do not. Building on CentOS7 which comes with gcc 4.8.5 this issue was not present, however it re-appeared when I updated gcc on CentOS to the newest version.

To solve the issue in Ubuntu I went into the ossimGdalPluginInit.cpp file and added:

#include <functional>

This allows the plugin to build. However I have yet to test to make sure it functions as intended.

gpotts commented 5 years ago

We are in the middle of a merge will add the include once the merge is complete