-
Notifications
You must be signed in to change notification settings - Fork 262
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
configure does not check for STRDUP #1408
Comments
Thanks, we’ll get this addressed! |
configure.ac has an AC_CHECK_FUNCS for strdup (about line 823), |
Thanks! @DennisHeimbigner I can see now that indeed it does (I only grepped for HAVE_STRDUP which obviously didn' find this...). I have just tested this with 4.6.3 and 4.7.0, it only happens in 4.7.0... If you need anymore details, let me know! |
The reason that declaration is in ncconfigure.h is because it is needed
but later on, I see this:
I have no idea what #ifndef strcat does; is it assuming strcat is a macro? |
Agreed, in git blame it seems it entered around december 2018, so it could be the culprit. The fix is easy for me. I simply added |
The base problem is that for gcc, if you specify -ansi, then the headers |
Well since I probably caused the problem, I might as well try to fix it and |
As a test of my fix, I am attaching a modified copy of netcdf-c/include/ncconfigure.h. |
@DennisHeimbigner sadly I get the same error: I here show the full line for compilation for your convenience: libtool: compile: mpicc -DHAVE_CONFIG_H -I. -I../../libdispatch -I.. -I../../include -I../../oc2 -I/opt/generic/build-tools/1.0/include -I/opt/generic/gcc/9.1.0/include -I/opt/generic/gcc/9.1.0/include -I/opt/gnu/9.1.0/zlib/1.2.11/include -I/opt/generic/numactl/2.0.12/include -I/opt/gnu/9.1.0/libxml2/2.9.9/include -I/opt/gnu/9.1.0/hwloc/2.0.3/include -I/opt/gnu/9.1.0/ucx/1.5.1/include -I/opt/gnu/9.1.0/openmpi/4.0.1/include -I/opt/gnu/9.1.0/szip/2.1.1/include -I/opt/gnu/9.1.0/hdf5/1.10.5/include -I/opt/gnu/9.1.0/pnetcdf/1.11.2/include -m64 -fPIC -O3 -ftree-vectorize -fexpensive-optimizations -funroll-loops -fprefetch-loop-arrays -march=native -L/opt/generic/build-tools/1.0/lib -L/opt/generic/gcc/9.1.0/lib -L/opt/generic/gcc/9.1.0/lib64 -L/opt/generic/gcc/9.1.0/lib -L/opt/generic/gcc/9.1.0/lib64 -L/opt/gnu/9.1.0/zlib/1.2.11/lib -L/opt/generic/numactl/2.0.12/lib -L/opt/gnu/9.1.0/libxml2/2.9.9/lib -L/opt/gnu/9.1.0/hwloc/2.0.3/lib -L/opt/gnu/9.1.0/ucx/1.5.1/lib -L/opt/gnu/9.1.0/openmpi/4.0.1/lib -L/opt/gnu/9.1.0/szip/2.1.1/lib -L/opt/gnu/9.1.0/hdf5/1.10.5/lib -L/opt/gnu/9.1.0/pnetcdf/1.11.2/lib -Wl,-rpath=/opt/generic/build-tools/1.0/lib -Wl,-rpath=/opt/generic/gcc/9.1.0/lib -Wl,-rpath=/opt/generic/gcc/9.1.0/lib64 -Wl,-rpath=/opt/generic/gcc/9.1.0/lib -Wl,-rpath=/opt/generic/gcc/9.1.0/lib64 -Wl,-rpath=/opt/gnu/9.1.0/zlib/1.2.11/lib -Wl,-rpath=/opt/generic/numactl/2.0.12/lib -Wl,-rpath=/opt/gnu/9.1.0/libxml2/2.9.9/lib -Wl,-rpath=/opt/gnu/9.1.0/hwloc/2.0.3/lib -Wl,-rpath=/opt/gnu/9.1.0/ucx/1.5.1/lib -Wl,-rpath=/opt/gnu/9.1.0/openmpi/4.0.1/lib -Wl,-rpath=/opt/gnu/9.1.0/szip/2.1.1/lib -Wl,-rpath=/opt/gnu/9.1.0/hdf5/1.10.5/lib -Wl,-rpath=/opt/gnu/9.1.0/pnetcdf/1.11.2/lib -MT libdispatch_la-nctime.lo -MD -MP -MF .deps/libdispatch_la-nctime.Tpo -c ../../libdispatch/nctime.c -fPIC -DPIC -o .libs/libdispatch_la-nctime.o
In file included from /usr/include/string.h:630,
from ../../libdispatch/nctime.c:23:
../../include/ncconfigure.h:41:14: error: expected identifier or '(' before '__extension__'
41 | extern char* strdup(const char*);
| ^~~~~~ |
As an additional information my config.log has this: configure:16022: checking for strdup
configure:16022: mpicc -o conftest -m64 -fPIC -O3 -ftree-vectorize -fexpensive-optimizations -funroll-loops -fprefetch-loop-arrays -march=native -L/opt/generic/build-tools/1.0/lib -L/opt/generic/gcc/9.1.0/lib -L/opt/generic/gcc/9.1.0/lib64 -L/opt/generic/gcc/9.1.0/lib -L/opt/generic/gcc/9.1.0/lib64 -L/opt/gnu/9.1.0/zlib/1.2.11/lib -L/opt/generic/numactl/2.0.12/lib -L/opt/gnu/9.1.0/libxml2/2.9.9/lib -L/opt/gnu/9.1.0/hwloc/2.0.3/lib -L/opt/gnu/9.1.0/ucx/1.5.1/lib -L/opt/gnu/9.1.0/openmpi/4.0.1/lib -L/opt/gnu/9.1.0/szip/2.1.1/lib -L/opt/gnu/9.1.0/hdf5/1.10.5/lib -L/opt/gnu/9.1.0/pnetcdf/1.11.2/lib -Wl,-rpath=/opt/generic/build-tools/1.0/lib -Wl,-rpath=/opt/generic/gcc/9.1.0/lib -Wl,-rpath=/opt/generic/gcc/9.1.0/lib64 -Wl,-rpath=/opt/generic/gcc/9.1.0/lib -Wl,-rpath=/opt/generic/gcc/9.1.0/lib64 -Wl,-rpath=/opt/gnu/9.1.0/zlib/1.2.11/lib -Wl,-rpath=/opt/generic/numactl/2.0.12/lib -Wl,-rpath=/opt/gnu/9.1.0/libxml2/2.9.9/lib -Wl,-rpath=/opt/gnu/9.1.0/hwloc/2.0.3/lib -Wl,-rpath=/opt/gnu/9.1.0/ucx/1.5.1/lib -Wl,-rpath=/opt/gnu/9.1.0/openmpi/4.0.1/lib -Wl,-rpath=/opt/gnu/9.1.0/szip/2.1.1/lib -Wl,-rpath=/opt/gnu/9.1.0/hdf5/1.10.5/lib -Wl,-rpath=/opt/gnu/9.1.0/pnetcdf/1.11.2/lib -I/opt/generic/build-tools/1.0/include -I/opt/generic/gcc/9.1.0/include -I/opt/generic/gcc/9.1.0/include -I/opt/gnu/9.1.0/zlib/1.2.11/include -I/opt/generic/numactl/2.0.12/include -I/opt/gnu/9.1.0/libxml2/2.9.9/include -I/opt/gnu/9.1.0/hwloc/2.0.3/include -I/opt/gnu/9.1.0/ucx/1.5.1/include -I/opt/gnu/9.1.0/openmpi/4.0.1/include -I/opt/gnu/9.1.0/szip/2.1.1/include -I/opt/gnu/9.1.0/hdf5/1.10.5/include -I/opt/gnu/9.1.0/pnetcdf/1.11.2/include -L/opt/generic/build-tools/1.0/lib -L/opt/generic/gcc/9.1.0/lib -L/opt/generic/gcc/9.1.0/lib64 -L/opt/generic/gcc/9.1.0/lib -L/opt/generic/gcc/9.1.0/lib64 -L/opt/gnu/9.1.0/zlib/1.2.11/lib -L/opt/generic/numactl/2.0.12/lib -L/opt/gnu/9.1.0/libxml2/2.9.9/lib -L/opt/gnu/9.1.0/hwloc/2.0.3/lib -L/opt/gnu/9.1.0/ucx/1.5.1/lib -L/opt/gnu/9.1.0/openmpi/4.0.1/lib -L/opt/gnu/9.1.0/szip/2.1.1/lib -L/opt/gnu/9.1.0/hdf5/1.10.5/lib -L/opt/gnu/9.1.0/pnetcdf/1.11.2/lib -Wl,-rpath=/opt/generic/build-tools/1.0/lib -Wl,-rpath=/opt/generic/gcc/9.1.0/lib -Wl,-rpath=/opt/generic/gcc/9.1.0/lib64 -Wl,-rpath=/opt/generic/gcc/9.1.0/lib -Wl,-rpath=/opt/generic/gcc/9.1.0/lib64 -Wl,-rpath=/opt/gnu/9.1.0/zlib/1.2.11/lib -Wl,-rpath=/opt/generic/numactl/2.0.12/lib -Wl,-rpath=/opt/gnu/9.1.0/libxml2/2.9.9/lib -Wl,-rpath=/opt/gnu/9.1.0/hwloc/2.0.3/lib -Wl,-rpath=/opt/gnu/9.1.0/ucx/1.5.1/lib -Wl,-rpath=/opt/gnu/9.1.0/openmpi/4.0.1/lib -Wl,-rpath=/opt/gnu/9.1.0/szip/2.1.1/lib -Wl,-rpath=/opt/gnu/9.1.0/hdf5/1.10.5/lib -Wl,-rpath=/opt/gnu/9.1.0/pnetcdf/1.11.2/lib conftest.c -lcurl >&5
conftest.c:87:6: warning: conflicting types for built-in function 'strdup'; expected 'char *(const char *)' [-Wbuiltin-declaration-mismatch]
87 | char strdup ();
| ^~~~~~ which seams to suggest some kind of mismatch? |
That is very odd. This decl "char strdup ();" cannot possibly |
In serial I get exactly the same error (without your patch): libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../libdispatch -I.. -I../../include -I../../oc2 -I/opt/generic/build-tools/1.0/include -I/opt/generic/gcc/9.1.0/include -I/opt/generic/gcc/9.1.0/include -I/opt/gnu/9.1.0/zlib/1.2.11/include -I/opt/gnu/9.1.0/szip/2.1.1/include -I/opt/gnu/9.1.0/hdf5-serial/1.10.5/include -m64 -fPIC -O3 -ftree-vectorize -fexpensive-optimizations -funroll-loops -fprefetch-loop-arrays -march=native -L/opt/generic/build-tools/1.0/lib -L/opt/generic/gcc/9.1.0/lib -L/opt/generic/gcc/9.1.0/lib64 -L/opt/generic/gcc/9.1.0/lib -L/opt/generic/gcc/9.1.0/lib64 -L/opt/gnu/9.1.0/zlib/1.2.11/lib -L/opt/gnu/9.1.0/szip/2.1.1/lib -L/opt/gnu/9.1.0/hdf5-serial/1.10.5/lib -Wl,-rpath=/opt/generic/build-tools/1.0/lib -Wl,-rpath=/opt/generic/gcc/9.1.0/lib -Wl,-rpath=/opt/generic/gcc/9.1.0/lib64 -Wl,-rpath=/opt/generic/gcc/9.1.0/lib -Wl,-rpath=/opt/generic/gcc/9.1.0/lib64 -Wl,-rpath=/opt/gnu/9.1.0/zlib/1.2.11/lib -Wl,-rpath=/opt/gnu/9.1.0/szip/2.1.1/lib -Wl,-rpath=/opt/gnu/9.1.0/hdf5-serial/1.10.5/lib -MT libdispatch_la-nctime.lo -MD -MP -MF .deps/libdispatch_la-nctime.Tpo -c ../../libdispatch/nctime.c -fPIC -DPIC -o .libs/libdispatch_la-nctime.o
In file included from /usr/include/string.h:630,
from ../../libdispatch/nctime.c:23:
../../include/ncconfigure.h:29:14: error: expected identifier or '(' before '__extension__'
29 | extern char* strdup(const char*);
| ^~~~~~
make[2]: *** [Makefile:1049: libdispatch_la-nctime.lo] Error 1
make[2]: Leaving directory '/home/nicpa/installation/bash-build/.compile/netcdf-c-4.7.0/build-tmp/libdispatch'
make[1]: *** [Makefile:700: all-recursive] Error 1
make[1]: Leaving directory '/home/nicpa/installation/bash-build/.compile/netcdf-c-4.7.0/build-tmp'
make: *** [Makefile:545: all] Error 2
|
In serial I get exactly the same error (with your patch): libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../libdispatch -I.. -I../../include -I../../oc2 -I/opt/generic/build-tools/1.0/include -I/opt/generic/gcc/9.1.0/include -I/opt/generic/gcc/9.1.0/include -I/opt/gnu/9.1.0/zlib/1.2.11/include -I/opt/gnu/9.1.0/szip/2.1.1/include -I/opt/gnu/9.1.0/hdf5-serial/1.10.5/include -m64 -fPIC -O3 -ftree-vectorize -fexpensive-optimizations -funroll-loops -fprefetch-loop-arrays -march=native -L/opt/generic/build-tools/1.0/lib -L/opt/generic/gcc/9.1.0/lib -L/opt/generic/gcc/9.1.0/lib64 -L/opt/generic/gcc/9.1.0/lib -L/opt/generic/gcc/9.1.0/lib64 -L/opt/gnu/9.1.0/zlib/1.2.11/lib -L/opt/gnu/9.1.0/szip/2.1.1/lib -L/opt/gnu/9.1.0/hdf5-serial/1.10.5/lib -Wl,-rpath=/opt/generic/build-tools/1.0/lib -Wl,-rpath=/opt/generic/gcc/9.1.0/lib -Wl,-rpath=/opt/generic/gcc/9.1.0/lib64 -Wl,-rpath=/opt/generic/gcc/9.1.0/lib -Wl,-rpath=/opt/generic/gcc/9.1.0/lib64 -Wl,-rpath=/opt/gnu/9.1.0/zlib/1.2.11/lib -Wl,-rpath=/opt/gnu/9.1.0/szip/2.1.1/lib -Wl,-rpath=/opt/gnu/9.1.0/hdf5-serial/1.10.5/lib -MT libdispatch_la-nctime.lo -MD -MP -MF .deps/libdispatch_la-nctime.Tpo -c ../../libdispatch/nctime.c -fPIC -DPIC -o .libs/libdispatch_la-nctime.o
In file included from /usr/include/string.h:630,
from ../../libdispatch/nctime.c:23:
../../include/ncconfigure.h:41:14: error: expected identifier or '(' before '__extension__'
41 | extern char* strdup(const char*);
| ^~~~~~ |
Ok, for the compiler to see that, the two preceding #if tests must be true.
Since this is linux, the first test is trivially true. |
As an experiment, you might try replacing the line:
This comes from looking at this page: |
In my /* Define to 1 if you have the `strdup' function. */
#define HAVE_STRDUP 1 OS: Linux nicpa-dtu 4.9.0-8-amd64 #1 SMP Debian 4.9.144-3.1 (2019-02-19) x86_64 GNU/Linux Custom binutils and latest GCC version. |
Ok, one more test: compile and run this program
|
I did this: $> gcc -dM -E - < /dev/null | grep STDC
#define __STDC_HOSTED__ 1
#define __STDC_UTF_16__ 1
#define __STDC_IEC_559__ 1
#define __STDC_ISO_10646__ 201605L
#define __STDC_NO_THREADS__ 1
#define _STDC_PREDEF_H 1
#define __STDC_IEC_559_COMPLEX__ 1
#define __STDC_VERSION__ 201710L
#define __GNUC_STDC_INLINE__ 1
#define __STDC_UTF_32__ 1
#define __STDC__ 1 |
I'll compile now, and yes it yields: |
ok, I guess that |
As noted previously it works with 4.6.X using the same procedure. |
That one worked. Everything ran through. :) |
ok, thanks. I must confess I cannot understand why functions like strdup |
It is indeed weird... |
re: #1408 1. Add some function tests to configure.ac; these are functions not defined with -ansi. 2. When using -ansi, fix include/ncconfigure.h to check for the possibilty that certain functions are being defined by macros. Apparently Debian does this for some reason. No idea why. Unrelated: modify the debug/cf.cmake debug shell script.
I believe this issue can be closed. |
configure
does not check forHAVE_STRDUP
which makes compilation fail.Environment Information
configure
)Summary of Issue
Configure script does not check for STRDUP.
Steps to reproduce the behavior
I used GCC 9.1.0 and compiled with
configure
(tried both serial and parallel), both fail.I guess
--enable-netcdf-4
is required. But.It is pretty clear that cmake checks for the
strdup
command, whileconfigure
does not.The text was updated successfully, but these errors were encountered: