Unidata / netcdf-c

Official GitHub repository for netCDF-C libraries and utilities.
BSD 3-Clause "New" or "Revised" License
521 stars 262 forks source link

VPATH issue with netcdf-c-4.8.0? #2029

Open gus-correa opened 3 years ago

gus-correa commented 3 years ago

netcdf-c-4.8.0 on Linux CentOS 7.9 with gcc 4.8.5.

I am trying to build off the source tree, assuming that it can handle VPATH. $ cd build_gnu-4.8.5

$ ../netcdf-c-4.8.0/configure --prefix=/opt/swinst/netCDF/C/netcdf-c-4.8.0-gnu-4.8.5 [... configure output. It seems to be successful.]

$ make make all-recursive ... make[2]: Entering directory /opt/swinst/netCDF/C/build_gnu-4.8.5/libdispatch' /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../netcdf-c-4.8.0/libdispatch -I.. -I../../netcdf-c-4.8.0/include -I../../netcdf-c-4.8.0/oc2 -MT libdispatch_la-dparallel.lo -MD -MP -MF .deps/libdispatch_la-dparallel.Tpo -c -o libdispatch_la-dparallel.lotest -f 'dparallel.c' || echo '../../netcdf-c-4.8.0/libdispatch/'`dparallel.c libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../netcdf-c-4.8.0/libdispatch -I.. -I../../netcdf-c-4.8.0/include -I../../netcdf-c-4.8.0/oc2 -MT libdispatch_la-dparallel.lo -MD -MP -MF .deps/libdispatch_la-dparallel.Tpo -c ../../netcdf-c-4.8.0/libdispatch/dparallel.c -fPIC -DPIC -o .libs/libdispatch_la-dparallel.o In file included from ../../netcdf-c-4.8.0/libdispatch/dparallel.c:9:0: ../../netcdf-c-4.8.0/include/ncdispatch.h:30:29: fatal error: netcdf_dispatch.h: No such file or directory

include "netcdf_dispatch.h"

                         ^

compilation terminated. make[2]: [libdispatch_la-dparallel.lo] Error 1 make[2]: Leaving directory `/opt/swinst/netCDF/C/build_gnu-4.8.5/libdispatch' make[1]: [all-recursive] Error 1 make[1]: Leaving directory `/opt/swinst/netCDF/C/build_gnu-4.8.5' make: *** [all] Error 2

** It created netcdf_dispatch.h in build_gnu-4.8.5/include. However, it doesn't seem to be looking for it there. The compilation command doesn't have build_gnu-4.8.5/include among the include search directories. Am I missing something maybe?

Thank you, Gus Correa

To report a non-security related issue, please provide:

If you have a general question about the software, please view our Suggested Support Process.

gnw3 commented 3 years ago

Trying to build the Fedora 33 RPM's, the spec file also creates a build directory (netcdf-c-4.8.0/build), and also gives:

netcdf_dispatch.h: No such file or directory #include "netcdf_dispatch.h"

A workaround is to make a symbolic link for netcdf-c-4.8.0/include/netcdf_dispatch.h to <build_dir>/include/netcdf_dispatch.h.

edwardhartnett commented 3 years ago

@DennisHeimbigner and @WardF this is perhaps related to the recent changes to have the dispatch version in one place, and generate the .h file? Apparently the build systems are not putting the generated file where it needs to go?

DennisHeimbigner commented 3 years ago

The -I flags from above are:

-I -I../../netcdf-c-4.8.0/libdispatch -I.. -I../../netcdf-c-4.8.0/include -I../../netcdf-c-4.8.0/oc2

These are generated from netcdf-c/lib_flags.am, which has this line:

AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include

I suspect that top_builddir is not being properly set.

DennisHeimbigner commented 3 years ago

You might look at include/Makefile and see what value is being assigned to AM_CPPFLAGS.

edwardhartnett commented 2 years ago

@gnw3 is this issue still active? Have you tried release 4.8.1?