Open edbennett opened 5 years ago
It looks like https://github.com/r-spatial/lwgeom/pull/35 was in part trying to fix this issue, but given that configure.ac
exists, manually editing configure
seems like a suboptimal approach to fixing this issue.
Thanks. This approach works. Wondering if it could be solved upstream so that automatic detection works.
FYI, rather than editing src/Makevars
you can put the GEOS linker into ~/.R/Makevars
via
PKG_LIBS = -L/opt/spack/opt/spack/linux-centos7-x86_64/gcc-7.3.0/geos-3.6.2-2deshsxx4rhonyxbuhznmzyixdnfkqq4/lib -lgeos_c
I think this is a problem in the configure.ac
script. I made this change to configure.ac
$ diff configure.ac ../lwgeom.new/configure.ac
427c427
< AC_SUBST([PKG_LIBS], ["${PKG_LIBS} -lgeos_c"]),
---
> AC_SUBST([PKG_LIBS], ["${PKG_LIBS} ${GEOS_LIBS}"]),
You then have to run autoreconf -i
to regenerate the configure
script. Then if you want to be tidy, you should replace the MD5 sums in the MD5 file.
sed -i 's/.* \*configure$/b0353998496b776117a86b10d9107c0e *configure/;
s/.* \*configure.ac$/c4e63e6beff87ac335d1e206e498d728 *configure.ac/' \
MD5
At this point, tar
the lwgeom
back up into its tarball, and install from the tarball.
If you are in the lwgeom
directory and want to test, you can use (with suitably defined variables)
./configure --with-proj-include=$PROJ_INCLUDE --with-proj-lib=$PROJ_LIB --with-proj-share=$PROJ_SHARE/proj
and check that src/Makevars
contains
PKG_LIBS= -L/sw/specials/proj/4.9.2/lib -lproj -L/sw/specials/geos/3.5.0/lib -lgeos_c
I can turn this into a pull request if the maintainers would like.
When libgeos is installed in a location not in the default system search path (as it is on our HPC system, where it is loaded via a module), the
configure
script fails to add the correct linker flag to theMakeovers
file.Relevant section of
configure
output:But the final compilation step gives:
Manually editing the second line of
src/Makevars
to include the-L/apps/libraries/geos/3.7.0/el7/AVX512/intel-2018/lib
thatconfigure
already detected that it needs allows the library to link and install correctly.I'm not good at autoconf, so I can't tell whether this is
configure
using some C++/linker flags that are not then used byR CMD INSTALL
, or whether it's a logic bug inconfigure.ac
where a variable is forgotten to be set.