udunits2.h not found during make, but passes configure OK
Added by Gus Correa over 11 years ago
Dear CDO experts
When buiding CDO 1.6.1 on a CentOS 6.4 x86_64 computer, I get this error message:
gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../../src -I../../libcdi/src -I/usr/include/libxml2 -g -O2 -pthread -MT cdo-Setpartab.o -MD -MP -MF .deps/cdo-Setpartab.Tpo -c -o cdo-Setpartab.o `test -f 'Setpartab.c' || echo '../../src/'`Setpartab.c
../../src/Setpartab.c:29:24: error: udunits2.h: No such file or directory
../../src/Setpartab.c:67: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
../../src/Setpartab.c: In function ‘get_converter’:
...
I have udunits2, netcdf(4), hdf5, jasper, grib_api, libxml2 installed from packages (via yum).
My configure line is:
../configure \
--prefix=${MYINSTALLDIR} \
--with-hdf5=yes \
--with-udunits2=yes \
--with-netcdf=yes \
--with-jasper=yes \
--with-grib_api=yes \
--with-libxml2=yes \
2>&1 | tee configure.log
Configure passes with no problem at all.
However make fails with the error above.
The culprit line of code seems to be:
[root@master build_gnu-4.1.2]# grep -n udunits ../src/Setpartab.c
29:# include <udunits2.h>
I wonder if
- include "udunits2.h"
would be more adequate, maybe along with added CPPFLAGS (-I/usr/include/udunits2)?
Or perhaps the makefile(s) could/should seek deeper into the include directories?
On CentOS 6.4, udunits2.h is not in /usr/include, but in /usr/include/udunits2 directory.
(Several packages create subdirectories in /usr/include for their include files.)
I would appreciate any suggestions of a fix or of a workaround.
Thank you,
Gus Correa
Replies (3)
RE: udunits2.h not found during make, but passes configure OK - Added by Gus Correa over 11 years ago
A little follow up:
1. I fixed the problem I reported before, by adding:
export CPPFLAGS="-I/usr/include/udunits2"
to my configure script wrapper.
**
2. So, I've got encouraged to build CDI along with CDO,
and to enable ruby and python therein.
Now my configure line is:
../configure \
--prefix=${MYINSTALLDIR} \
--with-hdf5=yes \
--with-udunits2=yes \
--with-netcdf=yes \
--with-jasper=yes \
--with-grib_api=yes \
--with-libxml2=yes \
--enable-cdi-lib=yes \
--enable-python=yes \
--enable-ruby=yes \
2>&1 | tee configure.log
**
3. However, the Python.h include was not found during configure.
Nevertheless, extending the CPPFLAGS to:
export CPPFLAGS="-I/usr/include/udunits2 -I/usr/include/python2.6"
made it pass the configure and make steps.
Maybe there is a better fix for finding these include files using automake?
**
4. Unfortunately I hit an error during "make check",
which I report as asked:
**********************
...
make check-TESTS
make2: Entering directory `/data4/swinst/cdo/1.6.1/cdo-1.6.1/build_gnu-4.4.7/test'
E
======================================================================
ERROR: test_info (main.TestInfo)
----------------------------------------------------------------------
Traceback (most recent call last):
File "./../../test/test_info.py", line 10, in test_info
cdo = Cdo()
File "/data4/swinst/cdo/1.6.1/cdo-1.6.1/contrib/python/cdo.py", line 74, in init
self.libs = self.getSupportedLibs()
File "/data4/swinst/cdo/1.6.1/cdo-1.6.1/contrib/python/cdo.py", line 217, in getSupportedLibs
withs = re.findall('with: (.*)',retvals1)[0].split(' ')
IndexError: list index out of range
----------------------------------------------------------------------
Ran 1 test in 0.031s
FAILED (errors=1)
FAIL: ../../test/test_info.py
=================================================
1 of 1 test failed
Please report to http://code.zmaw.de/projects/cdo
=================================================
make2: *** [check-TESTS] Error 1
5. Is the error above a bug in the test only, or would it be a bug in the main code?
In any case, I did "make install", trusting it is an error in the test program only.
**
6. Finally, I tried to install the pdf and info documentation with:
make install-pdf
make install-info
but there was no effect.
**
Thank you,
Gus Correa
RE: udunits2.h not found during make, but passes configure OK - Added by Ralf Mueller over 11 years ago
Gus Correa wrote:
A little follow up:
1. I fixed the problem I reported before, by adding:
export CPPFLAGS="-I/usr/include/udunits2"
to my configure script wrapper.
**
2. So, I've got encouraged to build CDI along with CDO,
and to enable ruby and python therein.Now my configure line is:
../configure \n> --prefix=${MYINSTALLDIR} \n> --with-hdf5=yes \n> --with-udunits2=yes \n> --with-netcdf=yes \n> --with-jasper=yes \n> --with-grib_api=yes \n> --with-libxml2=yes \n> --enable-cdi-lib=yes \n> --enable-python=yes \n> --enable-ruby=yes \n> 2>&1 | tee configure.log
unless you really want a separate CDI installation, you you should skip the $--enable-cdi-lib=yes@ option. CDI is build and statically linked to the CDO binary during the build process. Only if you need the CDI library as an addition to be used by other applications, it makes sense to use this options. Do you need this?
3. However, the Python.h include was not found during configure.
Nevertheless, extending the CPPFLAGS to:export CPPFLAGS="-I/usr/include/udunits2 -I/usr/include/python2.6"
made it pass the configure and make steps.
Maybe there is a better fix for finding these include files using automake?
ruby/python bindings for CDI are experimental. They just provide a basic read-interface to CDI-compatible file input (ruby example, python example). Both do not provide the full functionality of CDI. I only tested things against python2.7.
btw I prefer giving the directories to look for libraries instead of yes.
**
4. Unfortunately I hit an error during "make check",
which I report as asked:**********************
...make check-TESTS
make2: Entering directory `/data4/swinst/cdo/1.6.1/cdo-1.6.1/build_gnu-4.4.7/test'
E ======================================================================
ERROR: test_info (main.TestInfo)
----------------------------------------------------------------------
Traceback (most recent call last):
File "./../../test/test_info.py", line 10, in test_info
cdo = Cdo()
File "/data4/swinst/cdo/1.6.1/cdo-1.6.1/contrib/python/cdo.py", line 74, in init
self.libs = self.getSupportedLibs()
File "/data4/swinst/cdo/1.6.1/cdo-1.6.1/contrib/python/cdo.py", line 217, in getSupportedLibs
withs = re.findall('with: (.*)',retvals1)[0].split(' ')
IndexError: list index out of range----------------------------------------------------------------------
Ran 1 test in 0.031sFAILED (errors=1)
FAIL: ../../test/test_info.py =================================================
1 of 1 test failed
Please report to http://code.zmaw.de/projects/cdo =================================================
make2: *** [check-TESTS] Error 1
I can check this, but it indicates a problem related to the python script - not CDO. If you need the ruby/python bindings to CDO, use pip for python and gem for ruby
...
5. Is the error above a bug in the test only, or would it be a bug in the main code?
test only.
In any case, I did "make install", trusting it is an error in the test program only.
Just check
cdo -Vafter installation. If it shows the new version number, everything should be ok.
**
6. Finally, I tried to install the pdf and info documentation with:
make install-pdf
make install-infobut there was no effect.
these are not implemented - CDO has no man-page, because:
- documentation is built-in:
cdo -h
- the pdf-docu comes with the source code (cdo.pdf)
**
Thank you,
Gus Correa
hth
ralf
RE: udunits2.h not found during make, but passes configure OK - Added by Uwe Schulzweida over 11 years ago
Thanks for this information! The check for the udunits2 include file will be improved in the next CDO release.