Open aryoda opened 4 years ago
Perhaps switching to clang++ solves the problem, see:
http://r-pkgs.had.co.nz/src.html
Use clang instead of gcc to compile your C++ code: it gives much better error messages. You can make clang the default by creating a .R/Makevars (linux and mac) or .R/Makevars.win (windows) file in your home directory that contains: CXX=clang++
But a first try with a clean & rebuild of CppDebugHelper only (not Rcpp) didn't help (debugging/stepping works, but printing not):
(lldb) p dbg_print(x)
error: CppDebugHelper.so DWARF DIE at 0x00099d2f (class String) has a member variable 0x00099d44 (buffer) whose type is a forward declaration, not a complete definition.
Try compiling the source file with -fstandalone-debug
error: Couldn't lookup symbols:
Rcpp::Vector<16>::Vector(Rcpp::Vector<16> const&)
Rcpp::traits::proxy_cache<16>::~proxy_cache()
Rcpp::PreserveStorage<Rcpp::Vector<16> >::~PreserveStorage()
Some interesting links:
It seems that R and Rcpp must be recompiled completely with clang++ (but clang++ seems to be supported by R only on OSX/Mac) to avoid mixing compilers...
in general you CANNOT mix C++ code from different compilers
This Debugging compiled code in R with lldb video by Jim Hester show the lldb
does work within RStudio (on OSX/Mac)
It also gives good "how to debug" instructions via a live debugging session in RStudio
Direct link to the video: https://www.youtube.com/watch?v=R3-IMGyNJY4
Running
lldb
withand setting a breakpoint (same commands as in
gdb
so far) prints strange results:but SEXP printing does work:
Investigate this (low prio)...
See also: Is it possible to debug a gcc-compiled program using lldb, or debug a clang-compiled program using gdb?