Rapporter / pander

An R Pandoc Writer: Convert arbitrary R objects into markdown
http://rapporter.github.io/pander/
Open Software License 3.0
294 stars 66 forks source link

Problem when building a fork on Rstudio (pander.so: undefined symbol: pander_splitLine_cpp) #319

Closed adamryczkowski closed 5 years ago

adamryczkowski commented 6 years ago

I want to write a little enhancement to the pander (to make it support markdown extensions). For this I forked it and opened the project with Rstudio on my Ubuntu 16.04 64bit notebook. Build fails with the following error:

==> Rcpp::compileAttributes()

* Updated src/RcppExports.cpp
* Updated R/RcppExports.R

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

* installing to library ‘/home/adam/R/x86_64-pc-linux-gnu-library/3.4’
* installing *source* package ‘pander’ ...
g++  -I/usr/share/R/include -DNDEBUG  -I"/home/adam/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include"    -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c RcppExports.cpp -o RcppExports.o
** libs
g++  -I/usr/share/R/include -DNDEBUG  -I"/home/adam/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include"    -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c helpers.cpp -o helpers.o
g++  -I/usr/share/R/include -DNDEBUG  -I"/home/adam/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include"    -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c pandoc.cpp -o pandoc.o
g++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o pander.so RcppExports.o helpers.o pandoc.o -L/usr/lib/R/lib -lR
installing to /home/adam/R/x86_64-pc-linux-gnu-library/3.4/pander/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
   ‘evals.Rmd’ using ‘UTF-8’ 
   ‘knitr.Rmd’ using ‘UTF-8’ 
   ‘pander.Rmd’ using ‘UTF-8’ 
   ‘pandoc_table.Rmd’ using ‘UTF-8’ 
** testing if installed package can be loaded
Error: package or namespace load failed for ‘pander’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/home/adam/R/x86_64-pc-linux-gnu-library/3.4/pander/libs/pander.so':
  /home/adam/R/x86_64-pc-linux-gnu-library/3.4/pander/libs/pander.so: undefined symbol: pander_splitLine_cpp
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/adam/R/x86_64-pc-linux-gnu-library/3.4/pander’
* restoring previous ‘/home/adam/R/x86_64-pc-linux-gnu-library/3.4/pander’

Exited with status 1.

Pandoc installed with devtools::install_github('Rapporter/pander') builds OK. Can anyone tell me, what is the problem?

daroczig commented 6 years ago

I tested #326 in a Windows VM started and seems to do the trick, but please confirm.

dcomtois commented 5 years ago

Same issue here; tested #326 both on windows and Linux, doesn't help unfortunately.

daroczig commented 5 years ago

Can you pls check again?

dcomtois commented 5 years ago

Installing with devtools::install() worked. It doesn't seem to support breakpoints in RStudio though, but inserting browser() in the code makes it possible to enter debugging mode.

Also it seems the problem is averted by using "Configure Build Tools" in RStudio and using "Makefile" with option "install", instead of the "standard" Install and Restart in RStudio.

Tested on both Linux (Ubuntu 18.04) and Windows 10.

Note: If a first attemp with "regular build" has been made, make sure to revert the changes made to files (Pandoc.R and another R script, don't recall which one) during this failed build before attempting to reinstall with devtools or with Makefile.

daroczig commented 5 years ago

Thanks a lot for the investigation, @dcomtois, and I'm glad you figured this out -- I'm closing this, as I cannot really help with this at this point.

dcomtois commented 5 years ago

You're welcome!

Side-note: When building / installing with Makefile (as opposed to devtools::install()), we can actually debug adequately (meaning we can "follow" the code execution, although we still need to insert browser()).

CGMossa commented 4 years ago

I am also facing this issue.

==> Rcpp::compileAttributes()

* Updated R/RcppExports.R

==> Rcmd.exe INSTALL --no-multiarch --with-keep.source pander

* installing to library '[redacted]/R/win-library/3.6'
* installing *source* package 'pander' ...
** using staged installation
** libs
C:/Rtools/mingw_64/bin/g++ -shared -s -static-libgcc -o pander.dll tmp.def RcppExports.o helpers.o pandoc.o -LC:/PROGRA~1/R/R-36~1.1/bin/x64 -lR
RcppExports.o:RcppExports.cpp:(.rdata+0x7f8): undefined reference to `pander_splitLine_cpp'
RcppExports.o:RcppExports.cpp:(.rdata+0x810): undefined reference to `pander_tableExpand_cpp'
collect2.exe: error: ld returned 1 exit status
no DLL was created
ERROR: compilation failed for package 'pander'
* removing '[redacted]/R/win-library/3.6/pander'
* restoring previous '[redacted]/R/win-library/3.6/pander'

Exited with status 1.