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

When gdal not present, configure does not complain, but build fails (same with hdf5) #436

Open
captainkirk99 opened this issue Dec 5, 2020 · 0 comments

Comments

@captainkirk99
Copy link
Collaborator

captainkirk99 commented Dec 5, 2020

Building without gdal, I see that configure.ac correctly determined that gdal was not present:

configure: Looking for GDAL.
checking for gdal-config... no
configure: WARNING: gdal-config does not exist or it is not an exectuable file
no

However, the build then breaks:

DapFunctions.cc:29:10: fatal error: gdal.h: No such file or directory
   29 | #include <gdal.h>   // needed for scale_{grid,array}
      |          ^~~~~~~~
compilation terminated.

This is because DapFunctions includes gdal.h in an unprotected way:

#include "config.h"

#include <iostream>

#include <gdal.h>   // needed for scale_{grid,array}

#include <ServerFunctionsList.h>

I tried wrapping this in ifdefs for HAVE_GDAL, and that helps, but eventually we fail like this:

In file included from DapFunctions.cc:55:
ScaleGrid.h:72:13: error: ‘GDAL_GCP’ was not declared in this scope
   72 | std::vector<GDAL_GCP> get_gcp_data(libdap::Array *x, libdap::Array *y, int sample_x = 1, int sample_y = 1);
      |             ^~~~~~~~
ScaleGrid.h:72:21: error: template argument 1 is invalid
   72 | std::vector<GDAL_GCP> get_gcp_data(libdap::Array *x, libdap::Array *y, int sample_x = 1, int sample_y = 1);
      |                     ^
ScaleGrid.h:72:21: error: template argument 2 is invalid

So either more code needs to be protected, or gdal needs to be required, and configure.ac should error out if gdal is not found.

Similarly, if HDF5 is not found, the build proceeds, then errors like this:

make[5]: Entering directory '/home/ed/bes/modules/dmrpp_module'
g++ -DHAVE_CONFIG_H -I. -I../..  -I../.. -I../../dispatch -I../../dap -I../../http -I/usr/include/libdap -I/usr/include/libxml2 -I/usr/local/opt/openssl/include -DMODULE_NAME=\"dmrpp_module\" -DMODULE_VERSION=\"1.1.2\"  -I./../hdf5_handler -I/include -Wno-vla-extension -g -O2 --pedantic --std=c++11 -MT build_dmrpp-build_dmrpp.o -MD -MP -MF .deps/build_dmrpp-build_dmrpp.Tpo -c -o build_dmrpp-build_dmrpp.o `test -f 'build_dmrpp.cc' || echo './'`build_dmrpp.cc
build_dmrpp.cc:40:10: fatal error: H5Ppublic.h: No such file or directory
   40 | #include <H5Ppublic.h>
      |          ^~~~~~~~~~~~~
compilation terminated.
ma
@captainkirk99 captainkirk99 changed the title When gdal not present, configure does not complain, but build fails When gdal not present, configure does not complain, but build fails (same with hdf5) Dec 5, 2020
jgallagher59701 pushed a commit that referenced this issue Jan 7, 2022
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

1 participant