baddstats / polyclip

R package polyclip: a port of the Clipper library for polygon geometry
19 stars 6 forks source link

Problem compiling polyclip against system copy of polyclipping #12

Closed baddstats closed 5 years ago

baddstats commented 6 years ago

User @iembry posted the following message:

Hi, the CRAN version of polyclip on a GNU/Linux Ubuntu-based distribution has failed for me.

I have not tried the GitHub version yet.

> install.packages("polyclip")
Installing package into ‘library’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/polyclip_1.9-0.tar.gz'
Content type 'application/x-gzip' length 78996 bytes (77 KB)
==================================================
downloaded 77 KB

* installing *source* package ‘polyclip’ ...
** package ‘polyclip’ successfully unpacked and MD5 sums checked
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
compiling under C++11
Using PKG_CONFIG: pkg-config
Compiling against system copy of polyclipping library.
configure: creating ./config.status
config.status: creating src/Makevars
** libs
ccache gcc -I"/usr/share/R/include" -DNDEBUG -I/usr/include/polyclipping   -DPOLYCLIP_LONG64="signed long long" -DPOLYCLIP_ULONG64="unsigned long long"     -fpic  -std=gnu99 -Wall -pedantic -c init.c -o init.o
ccache g++ -std=c++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/polyclipping   -DPOLYCLIP_LONG64="signed long long" -DPOLYCLIP_ULONG64="unsigned long long"    -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c interface.cpp -o interface.o
ccache g++ -std=c++11 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o polyclip.so init.o interface.o -lpolyclipping -L/usr/lib/R/lib -lR
installing to library/polyclip/libs
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error: package or namespace load failed for ‘polyclip’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object 'library/polyclip/libs/polyclip.so':
  library/polyclip/libs/polyclip.so: undefined symbol: _ZN10ClipperLib12MinkowskiSumERKSt6vectorINS_8IntPointESaIS1_EERKS0_IS3_SaIS3_EERS7_b
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘library/polyclip’

The downloaded source packages are in
        ‘/tmp/Rtmp2qGS9a/downloaded_packages’
Warning message:
In install.packages("polyclip") :
  installation of package ‘polyclip’ had non-zero exit status
baddstats commented 6 years ago

The polyclip package includes all the required C++ code for the clipper library. However, if another version of the clipper C++ library (namely the polyclipping C++ library) is already installed on the system, then the installation will use the already-installed one. The output in the message from @iembry includes the line Compiling against system copy of polyclipping library which indicates that it is using an already-installed version of polyclipping. Apparently there is an incompatibility between that system-installed code and the R package polyclip. We have no control over this, unfortunately.

The option to compile against an already-installed library was added by a contributor. I will see if he is willing to help.

baddstats commented 6 years ago

@QuLogic, can you help?

QuLogic commented 6 years ago

What version of the library is installed?

$ echo _ZN10ClipperLib12MinkowskiSumERKSt6vectorINS_8IntPointESaIS1_EERKS0_IS3_SaIS3_EERS7_b | c++filt
ClipperLib::MinkowskiSum(std::vector<ClipperLib::IntPoint, std::allocator<ClipperLib::IntPoint> > const&, std::vector<std::vector<ClipperLib::IntPoint, std::allocator<ClipperLib::IntPoint> >, std::allocator<std::vector<ClipperLib::IntPoint, std::allocator<ClipperLib::IntPoint> > > > const&, std::vector<std::vector<ClipperLib::IntPoint, std::allocator<ClipperLib::IntPoint> >, std::allocator<std::vector<ClipperLib::IntPoint, std::allocator<ClipperLib::IntPoint> > > >&, bool)

MinkowskiSum was renamed from the erroneous MinkowkiSum in 6.1.0.

baddstats commented 6 years ago

@iembry, try updating your system installation of the polyclipping library to version 6.1.0 or later.

iembry commented 5 years ago

@baddstats @QuLogic

I'm sorry for my delayed response, but I was able to install polyclip. I removed the system polyclip library. Thank you both again.