r-spatial / lwgeom

bindings to the liblwgeom library
https://r-spatial.github.io/lwgeom/
58 stars 23 forks source link

liblwgeom.h:38:26: error: invalid token at start of a preprocessor expression when compliling for OS X #65

Closed izahn closed 3 years ago

izahn commented 3 years ago

I'm working to get the conda-forge build working and have hit a snag when building for OS X. The relevant portion of the log is reproduced below, and the full log is at https://dev.azure.com/conda-forge/84710dde-1620-425b-80d0-4cf5baca359d/_apis/build/builds/275815/logs/35

Any thoughts?

2021-02-09T19:10:09.3315860Z config.status: creating src/postgis_config.h
2021-02-09T19:10:09.4638060Z ** libs
2021-02-09T19:10:09.4836740Z x86_64-apple-darwin13.4.0-clang++ -std=gnu++11 -I"$PREFIX/lib/R/include" -DNDEBUG -DUSE_PROJ_H -I$PREFIX/include -DPOSTGIS_GEOS_VERSION=35 -I./liblwgeom -DHAVE_LIBGEOM_INTERNAL_H -I'$PREFIX/lib/R/library/Rcpp/include' -I'$PREFIX/lib/R/library/sf/include' -D_FORTIFY_SOURCE=2 -isystem $PREFIX/include -mmacosx-version-min=10.9 -I$PREFIX/include   -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden  -fmessage-length=0 -isystem $PREFIX/include -fdebug-prefix-map=/Users/runner/miniforge3/conda-bld/r-base-split_1611775855546/work=/usr/local/src/conda/r-base-4.0.3 -fdebug-prefix-map=$PREFIX=/usr/local/src/conda-prefix  -c geodetic.cpp -o geodetic.o
2021-02-09T19:10:16.0090620Z In file included from geodetic.cpp:6:
2021-02-09T19:10:16.0120480Z ./liblwgeom/liblwgeom.h:38:26: error: invalid token at start of a preprocessor expression
2021-02-09T19:10:16.0222050Z #if POSTGIS_PROJ_VERSION < 60
2021-02-09T19:10:16.0235420Z                          ^
2021-02-09T19:10:16.0336720Z ./liblwgeom/liblwgeom.h:69:26: error: invalid token at start of a preprocessor expression
2021-02-09T19:10:16.0341140Z #if POSTGIS_PROJ_VERSION < 49
2021-02-09T19:10:16.0442620Z                          ^
2021-02-09T19:10:16.0461370Z ./liblwgeom/liblwgeom.h:2382:26: error: invalid token at start of a preprocessor expression
2021-02-09T19:10:16.0462710Z #if POSTGIS_PROJ_VERSION < 60
2021-02-09T19:10:16.0463760Z                          ^
2021-02-09T19:10:16.0464920Z ./liblwgeom/liblwgeom.h:2399:26: error: invalid token at start of a preprocessor expression
2021-02-09T19:10:16.0466330Z #if POSTGIS_PROJ_VERSION >= 60
2021-02-09T19:10:16.0467630Z                          ^
2021-02-09T19:10:16.6005880Z 4 errors generated.
2021-02-09T19:10:16.6109090Z make: *** [/Users/runner/miniforge3/conda-bld/r-lwgeom_1612897421165/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_/lib/R/etc/Makeconf:181: geodetic.o] Error 1
2021-02-09T19:10:16.6221620Z ERROR: compilation failed for package ‘lwgeom’
edzer commented 3 years ago

Does src/postgis_config.h have a line like

#define POSTGIS_PROJ_VERSION 72

in it?

izahn commented 3 years ago

Does src/postgis_config.h have a line like

#define POSTGIS_PROJ_VERSION 72

in it?

I don't have a local Mac to test on, and I have only a rudimentary understanding to the CI setup that conda-forge uses. In short I don't know how to check the answer to this question.

edzer commented 3 years ago

Just trying to help.

spittssj commented 3 years ago

@edzer could you reopen this? I do have OS X and can look into this issue, because it's related to this one. https://github.com/conda-forge/r-lwgeom-feedstock/issues/12

izahn commented 3 years ago

I figured out how to save the artifacts produced by the conda-forge CI. I see this in src/postgis_config.h:


/* PROJ library version */
#define POSTGIS_PROJ_VERSION 

i.e. there is no version number there. The full file is available here and the rest of the build artifacts are available at https://dev.azure.com/izahn/my-conda-tests/_build/results?buildId=14&view=artifacts&type=publishedArtifacts

edzer commented 3 years ago

I downloaded the artifacts you point to, and have really no clue where to look. So for you to find out is why this line does not contain a version number. It should be set here: https://github.com/r-spatial/lwgeom/blob/master/configure.ac#L373

izahn commented 3 years ago

Thanks for taking a look! In the end the problem was solved in https://github.com/conda-forge/r-lwgeom-feedstock/pull/17/ by setting LIBS environment variable.