Project

General

Profile

Compile error

Added by ep gupal over 1 year ago

I am getting build error, I think it is related to PROJ library. The following is the error message during the build process.

...
...
...
libtool: compile:  mpic++ -DHAVE_CONFIG_H -I. -I../libcdi/src -I../src/mpim_grid -DYAC_FOR_CDO -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include/udunits2 -DCDI_SIZE_TYPE=size_t -O3 -march=znver2 -fopenmp -pthread -MT mpim_grid/libcdo_la-grid_proj.lo -MD -MP -MF mpim_grid/.deps/libcdo_la-grid_proj.Tpo -c mpim_grid/grid_proj.cc  -fPIC -DPIC -o mpim_grid/.libs/libcdo_la-grid_proj.o
mpim_grid/grid_proj.cc:67:1: error: variable or field 'proj_fwd_xyvals' declared void
   67 | proj_fwd_xyvals(PJ *proj, size_t nvals, double *xvals, double *yvals)
      | ^~~~~~~~~~~~~~~
mpim_grid/grid_proj.cc:67:17: error: 'PJ' was not declared in this scope
   67 | proj_fwd_xyvals(PJ *proj, size_t nvals, double *xvals, double *yvals)
      |                 ^~
mpim_grid/grid_proj.cc:67:21: error: 'proj' was not declared in this scope
   67 | proj_fwd_xyvals(PJ *proj, size_t nvals, double *xvals, double *yvals)
      |                     ^~~~
mpim_grid/grid_proj.cc:67:34: error: expected primary-expression before 'nvals'
   67 | proj_fwd_xyvals(PJ *proj, size_t nvals, double *xvals, double *yvals)
      |                                  ^~~~~
mpim_grid/grid_proj.cc:67:41: error: expected primary-expression before 'double'
   67 | proj_fwd_xyvals(PJ *proj, size_t nvals, double *xvals, double *yvals)
      |                                         ^~~~~~
mpim_grid/grid_proj.cc:67:56: error: expected primary-expression before 'double'
   67 | proj_fwd_xyvals(PJ *proj, size_t nvals, double *xvals, double *yvals)
      |                                                        ^~~~~~
mpim_grid/grid_proj.cc:90:1: error: variable or field 'proj_inv_xyvals' declared void
   90 | proj_inv_xyvals(PJ *proj, size_t nvals, double *xvals, double *yvals)
      | ^~~~~~~~~~~~~~~
mpim_grid/grid_proj.cc:90:17: error: 'PJ' was not declared in this scope
   90 | proj_inv_xyvals(PJ *proj, size_t nvals, double *xvals, double *yvals)
      |                 ^~
mpim_grid/grid_proj.cc:90:21: error: 'proj' was not declared in this scope
   90 | proj_inv_xyvals(PJ *proj, size_t nvals, double *xvals, double *yvals)
      |                     ^~~~
mpim_grid/grid_proj.cc:90:34: error: expected primary-expression before 'nvals'
   90 | proj_inv_xyvals(PJ *proj, size_t nvals, double *xvals, double *yvals)
      |                                  ^~~~~
mpim_grid/grid_proj.cc:90:41: error: expected primary-expression before 'double'
   90 | proj_inv_xyvals(PJ *proj, size_t nvals, double *xvals, double *yvals)
      |                                         ^~~~~~
mpim_grid/grid_proj.cc:90:56: error: expected primary-expression before 'double'
   90 | proj_inv_xyvals(PJ *proj, size_t nvals, double *xvals, double *yvals)
      |                                                        ^~~~~~
mpim_grid/grid_proj.cc: In function 'int do_proj_fwd(const char*, size_t, double*, double*)':
mpim_grid/grid_proj.cc:117:27: error: 'PJ_DEFAULT_CTX' was not declared in this scope
  117 |   auto proj = proj_create(PJ_DEFAULT_CTX, params);
      |                           ^~~~~~~~~~~~~~
mpim_grid/grid_proj.cc:117:15: error: 'proj_create' was not declared in this scope
  117 |   auto proj = proj_create(PJ_DEFAULT_CTX, params);
      |               ^~~~~~~~~~~
mpim_grid/grid_proj.cc:118:23: error: 'proj_errno' was not declared in this scope
  118 |   const auto status = proj_errno(proj);
      |                       ^~~~~~~~~~
mpim_grid/grid_proj.cc:121:7: error: 'proj_fwd_xyvals' was not declared in this scope
  121 |       proj_fwd_xyvals(proj, nvals, xvals, yvals);
      |       ^~~~~~~~~~~~~~~
mpim_grid/grid_proj.cc:122:7: error: 'proj_destroy' was not declared in this scope
  122 |       proj_destroy(proj);
      |       ^~~~~~~~~~~~
mpim_grid/grid_proj.cc: In function 'int do_proj_inv(const char*, size_t, double*, double*)':
mpim_grid/grid_proj.cc:133:27: error: 'PJ_DEFAULT_CTX' was not declared in this scope
  133 |   auto proj = proj_create(PJ_DEFAULT_CTX, params);
      |                           ^~~~~~~~~~~~~~
mpim_grid/grid_proj.cc:133:15: error: 'proj_create' was not declared in this scope
  133 |   auto proj = proj_create(PJ_DEFAULT_CTX, params);
      |               ^~~~~~~~~~~
mpim_grid/grid_proj.cc:134:23: error: 'proj_errno' was not declared in this scope
  134 |   const auto status = proj_errno(proj);
      |                       ^~~~~~~~~~
mpim_grid/grid_proj.cc:137:7: error: 'proj_inv_xyvals' was not declared in this scope
  137 |       proj_inv_xyvals(proj, nvals, xvals, yvals);
      |       ^~~~~~~~~~~~~~~
mpim_grid/grid_proj.cc:138:7: error: 'proj_destroy' was not declared in this scope
  138 |       proj_destroy(proj);
      |       ^~~~~~~~~~~~
mpim_grid/grid_proj.cc: In function 'void lonlat_to_lcc(const CDI_GridProjParams&, size_t, double*, double*)':
mpim_grid/grid_proj.cc:236:51: error: 'proj_errno_string' was not declared in this scope
  236 |   if (status) cdo_abort("proj library error: %s", proj_errno_string(status));
      |                                                   ^~~~~~~~~~~~~~~~~
mpim_grid/grid_proj.cc: In function 'void lcc_to_lonlat(const CDI_GridProjParams&, size_t, double*, double*)':
mpim_grid/grid_proj.cc:272:51: error: 'proj_errno_string' was not declared in this scope
  272 |   if (status) cdo_abort("proj library error: %s", proj_errno_string(status));
      |                                                   ^~~~~~~~~~~~~~~~~
mpim_grid/grid_proj.cc: In function 'void lonlat_to_stere(const CDI_GridProjParams&, size_t, double*, double*)':
mpim_grid/grid_proj.cc:360:51: error: 'proj_errno_string' was not declared in this scope
  360 |   if (status) cdo_abort("proj library error: %s", proj_errno_string(status));
      |                                                   ^~~~~~~~~~~~~~~~~
mpim_grid/grid_proj.cc: In function 'void stere_to_lonlat(const CDI_GridProjParams&, size_t, double*, double*)':
mpim_grid/grid_proj.cc:395:51: error: 'proj_errno_string' was not declared in this scope
  395 |   if (status) cdo_abort("proj library error: %s", proj_errno_string(status));
      |                                                   ^~~~~~~~~~~~~~~~~
mpim_grid/grid_proj.cc: In function 'void cdo_sinu_to_lonlat(size_t, double*, double*)':
mpim_grid/grid_proj.cc:498:51: error: 'proj_errno_string' was not declared in this scope
  498 |   if (status) cdo_abort("proj library error: %s", proj_errno_string(status));
      |                                                   ^~~~~~~~~~~~~~~~~
mpim_grid/grid_proj.cc: In function 'void cdo_laea_to_lonlat(int, size_t, double*, double*)':
mpim_grid/grid_proj.cc:596:51: error: 'proj_errno_string' was not declared in this scope
  596 |   if (status) cdo_abort("proj library error: %s", proj_errno_string(status));
      |                                                   ^~~~~~~~~~~~~~~~~
mpim_grid/grid_proj.cc: In function 'void cdo_proj_to_lonlat(char*, size_t, double*, double*)':
mpim_grid/grid_proj.cc:609:51: error: 'proj_errno_string' was not declared in this scope
  609 |   if (status) cdo_abort("proj library error: %s", proj_errno_string(status));
      |                                                   ^~~~~~~~~~~~~~~~~
make[1]: *** [Makefile:2173: mpim_grid/libcdo_la-grid_proj.lo] Error 1
make[1]: Leaving directory '/temporary/aur.bld/cdo/src/cdo-2.1.1/src'
make: *** [Makefile:504: install-recursive] Error 1
==> ERROR: A failure occurred in package().
    Aborting...
...
...
...

By the way, my system is installed with PROJ version 9.2.0.

Thank you.


Replies (17)

RE: Compile error - Added by Estanislao Gavilan over 1 year ago

Hi ep gupal,

devs recommend to build cdo without proj. See post below

https://code.mpimet.mpg.de/boards/2/topics/14161?r=14172#message-14172

Kind regards,

Estanislao

RE: Compile error - Added by Ralf Mueller over 1 year ago

ep gupal wrote:

I am getting build error, I think it is related to PROJ library. The following is the error message during the build process.

[...]

By the way, my system is installed with PROJ version 9.2.0.

Thank you.

Do you use Arch Linux?

RE: Compile error - Added by ep gupal over 1 year ago

Yes. I do.

RE: Compile error - Added by ep gupal over 1 year ago

Estanislao Gavilan wrote in RE: Compile error:

Hi ep gupal,

devs recommend to build cdo without proj. See post below

https://code.mpimet.mpg.de/boards/2/topics/14161?r=14172#message-14172

Kind regards,

Estanislao

Compiling without PROJ worked! Thanks!

RE: Compile error - Added by Ralf Mueller over 1 year ago

ep gupal wrote in RE: Compile error:

Yes. I do.

In that case you use the CDO AUR package: https://aur.archlinux.org/packages/cdo

That does compile with proj

cheers
ralf

RE: Compile error - Added by ep gupal over 1 year ago

Ralf Mueller wrote in RE: Compile error:

ep gupal wrote in RE: Compile error:

Yes. I do.

In that case you use the CDO AUR package: https://aur.archlinux.org/packages/cdo

That does compile with proj

cheers
ralf

Yeah. But, for some reason, when I use different compiler it is giving me some issues. I am not using GCC.

RE: Compile error - Added by Ralf Mueller over 1 year ago

alright - AUR is designed for the system compiler. CDO does not use MPI btw

RE: Compile error - Added by ep gupal over 1 year ago

Yeah. Shouldn't CDO be compiled with a compiler that was used for netcdf? That was why I was using MPI.

RE: Compile error - Added by Ralf Mueller over 1 year ago

CDO only used the C-interface of netcdf, which is compiler independent. But if you netcdf library is installed with mpi, you have to provide all the linking flags,too. you can get them by calling nc-config from your netcdf installation. it is inside the bin directory of your netcdf installation path. --help should give you a list of options to chose from

RE: Compile error - Added by ep gupal over 1 year ago

Okay. But, I don't understand why it the build process is not pickuping the PROJ library, which I am clearly specifiying.

RE: Compile error - Added by Ralf Mueller over 1 year ago

on my system is a second proj.h head file in `/usr/include/proj6`. Try adding -I/usr/include/proj6/ to the CPPFLAGS to the configure call and rerun make afterwards. worth a shot

RE: Compile error - Added by Ralf Mueller over 1 year ago

maybe you have to update he libproj installation, too. AUR does not handle version updates because there is not minimal version specified in the CDO AUR definition. I test the build of any AUR update with the most recent versions of all dependencies

RE: Compile error - Added by ep gupal over 1 year ago

Looking at the compilation command,

libtool: compile:  mpic++ -std=gnu++17 -DHAVE_CONFIG_H -I. -I../libcdi/src -I../src/mpim_grid -DYAC_FOR_CDO -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include/udunits2 -DCDI_SIZE_TYPE=size_t -g -O3 -march=znver2 -Wall -fopenmp -pthread -MT libcdo_la-util_string.lo -MD -MP -MF .deps/libcdo_la-util_string.Tpo -c util_string.cc -o libcdo_la-util_string.o >/dev/null 2>&1

it is not picking up the HAVE_PROJ_H preprocessor in the code src/mpim_grid/grid_proj.cc. While, during the configuration step it is clearly recognizing the PROJ and the corresponding config.h file does indeed say #define HAVE_PROJ_H 1. I am guessing something in the build script is at fault?

RE: Compile error - Added by ep gupal over 1 year ago

Yeah. Forcibly commenting out the following part of src/mpim_grid/grid_proj.cc preprocessor worked.

//#ifdef HAVE_CONFIG_H
//#include "config.h" 
//#endif

//#ifdef HAVE_PROJ_H
#include "proj.h" 
//#endif

RE: Compile error - Added by Ralf Mueller over 1 year ago

usually these defines are all collected in ./src/config.h, which is activated with the -DHAVE_CONFIG_H flag. you can check its content after a successful configure run

RE: Compile error - Added by ep gupal over 1 year ago

Like I mentioned above, upon checking the ./src/config.h it does contain #define HAVE_PROJ_H 1. So, looking at the ./src/mpim_grid/grid_proj.cc

#ifdef HAVE_CONFIG_H
#include "config.h" 
#endif

#ifdef HAVE_PROJ_H
#include "proj.h" 
#endif

#include <cstdio>
#include <cstdarg> /* va_list */

#include <atomic>
#include <vector>

#include <cdi.h>
#include "cdo_options.h" 
#include "grid_proj.h" 
#include "grid_healpix.h" 
#include "cdo_output.h" 
#include "compare.h" 

with -DHAVE_CONFIG_H flag in the compilation command, it should include "config.h" which contains the #define HAVE_PROJ_H 1 which in turn will invoke #define proj.h. But, this is not working as expected.

RE: Compile error - Added by ep gupal over 1 year ago

ep gupal wrote in RE: Compile error:

Like I mentioned above, upon checking the ./src/config.h it does contain #define HAVE_PROJ_H 1. So, looking at the ./src/mpim_grid/grid_proj.cc

[...]

with -DHAVE_CONFIG_H flag in the compilation command, it should include "config.h" which contains the #define HAVE_PROJ_H 1 which in turn will invoke #define proj.h. But, this is not working as expected.

Meant to say #include "proj.h" not #define proj.h

    (1-17/17)