OSGeo / libgeotiff

Official repository of the libgeotiff project
180 stars 69 forks source link

#define exported in geo_config.h conflict with other packages such as GDAL #61

Closed rouault closed 2 years ago

rouault commented 2 years ago
[13:54] <runette> rouault[m] as discussed elsewhere - I have been trying to get the cmake build working on local Mac and Windows machines and I seem to have a few problems that I am trying to get past one by one. On Mac - using dependencies loaded from Conda (I don't have brew installed) the generate phase seems to work fine but I get this error messge when building
[13:54] <runette> :
[13:54] <runette> In file included from /Users/paulharwood/documents/GitHub/gdal/frmts/pds/vicardataset.cpp:44:
[13:54] <runette> In file included from /Users/paulharwood/opt/miniconda3/envs/gdal/include/geotiff.h:52:
[13:54] <runette> #define HAVE_STRING_H
[13:54] <runette>         ^
[13:54] <runette> #define HAVE_STRING_H 1
[13:54] <runette> Any ideas?
[13:54] <runette> That snippet should have been
[13:54] <runette> `In file included from /Users/paulharwood/documents/GitHub/gdal/frmts/pds/vicardataset.cpp:44:
[13:54] <runette> In file included from /Users/paulharwood/opt/miniconda3/envs/gdal/include/geotiff.h:52:
[13:55] <runette> #define HAVE_STRING_H
[13:55] <runette>         ^
[13:55] <runette> #define HAVE_STRING_H 1`
[13:56] <runette> "/Users/paulharwood/documents/GitHub/gdal-build/port/cpl_config.h:78:9: note: previous definition is here
[13:56] <runette> #define HAVE_STRING_H 1"
[13:58] <even> runette: it is just a warning, not an error ?
[14:02] <even> I presume the geo_config.h from your libgeotiff must come from a libgeotiff CMake build since it has just #define HAVE_STRING_H with a libgeotiff autoconf build, it is #define HAVE_STRING_H 1
[14:03] <even> it is annoying that we export such stuff from both GDAL and libgeotiff. That should be fixed in both ideally
[14:04] <runette> It is an error - Libera was swallowing the lien - it was "/Users/paulharwood/opt/miniconda3/envs/gdal/include/geo_config.h:8:9: error: 'HAVE_STRING_H' macro redefined [-Werror,-Wmacro-redefined]"
[14:04] <even> or have it prefixed with GDAL_ or LIBGEOTIFF_
[14:04] <even> yes, if you build with -Werror. Without it, that should build despite the warning
[14:05] <runette> I will try that - thanks
[14:05] <even> as a workaround, can you try manually to edit  /Users/paulharwood/opt/miniconda3/envs/gdal/include/geotiff.h to add a " 1" at the end of the offending #define