E3SM-Project / scorpio

A high-level Parallel I/O Library for structured grid applications
19 stars 16 forks source link

Fix some build errors when ADIOS and HDF5 are both enabled #511

Closed dqwu closed 1 year ago

dqwu commented 1 year ago

This PR adds the HDF5 C include path to tools/adios2pio-nm and resolves redefinition of strdup when ADIOS and HDF5 are both enabled. The custom version of strdup is renamed as spio_strdup for clarity, and it is defined only once.

dqwu commented 1 year ago

@jayeshkrishna FYI, build errors when ADIOS and HDF5 are both enabled:

In file included from scorpio/tools/adios2pio-nm/adios2pio-nm-lib.cxx:17:
scorpio/src/clib/pio.h:79:10: fatal error: hdf5.h: No such file or directory
   79 | #include <hdf5.h>
      |          ^~~~~~~~
compilation terminated.

...

scorpio/src/clib/pioc_support.c:588:7: error: redefinition of 'strdup'
  588 | char *strdup(const char *str)
      |       ^~~~~~
scorpio/src/clib/pioc_support.c:525:7: note: previous definition of 'strdup' with type 'char *(const char *)'
  525 | char *strdup(const char *str)
dqwu commented 1 year ago

@jayeshkrishna This PR has been updated to use spio_strdup() instead of pio_strdup() since there is no reason to name functions with pio* prefix now. Also, spio_strdup() fails (NULLs returned by the function) will be handled in a future PR.