junhewk / RcppMeCab

RcppMeCab: Rcpp Interface of CJK Morpheme Analyzer MeCab
25 stars 9 forks source link

Cannot build on Linux #7

Closed koheiw closed 4 years ago

koheiw commented 5 years ago

Hi @junhewk, I started using your package in my actual project, and I wanted to address #6 via a PR. However, I cannot build the package on my system because of an error to link to Mecab. I have seen this kind of error in my packages but could not solve. Any clue?

==> Rcpp::compileAttributes()

* Updated R/RcppExports.R

==> R CMD INSTALL --no-multiarch --with-keep.source RcppMeCab

* installing to library ‘/home/kohei/R/x86_64-pc-linux-gnu-library/3.6’
* installing *source* package ‘RcppMeCab’ ...
** using staged installation
make: Nothing to be done for 'all'.
** libs
installing to /home/kohei/R/x86_64-pc-linux-gnu-library/3.6/00LOCK-RcppMeCab/00new/RcppMeCab/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘RcppMeCab’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/home/kohei/R/x86_64-pc-linux-gnu-library/3.6/00LOCK-RcppMeCab/00new/RcppMeCab/libs/RcppMeCab.so':
  /home/kohei/R/x86_64-pc-linux-gnu-library/3.6/00LOCK-RcppMeCab/00new/RcppMeCab/libs/RcppMeCab.so: undefined symbol: mecab_strerror
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/kohei/R/x86_64-pc-linux-gnu-library/3.6/RcppMeCab’
* restoring previous ‘/home/kohei/R/x86_64-pc-linux-gnu-library/3.6/RcppMeCab’
> sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: KDE neon User Edition 5.15

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.so

locale:
 [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C               LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8    
 [5] LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8    LC_PAPER=en_GB.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_3.6.0 tools_3.6.0   
tetlabo commented 5 years ago

(Japanese) Ubuntu 18.04では、RcppMeCab/src/Makevars に以下を付け加えるとコンパイルできました。

PKG_LIBS += -lmecab

(English) In Ubuntu 18.04, I was able to compile by adding the following to RcppMeCab/src/Makevars.

PKG_LIBS += -lmecab