Hi,
I've been trying to integrate the mathGL plotting library into R with Rcpp, with the ultimate goal of rendering in the browser. ?So far, I've been successful with creating simple plotting test functions, compile with sourceCpp("myplotter.cpp") and output *.png and *.json files for browser 3D plotting.?
However, when I try to compile as an R package, I keep getting the following error:
** building package indices
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :?
? unable to load shared object '/usr/local/lib/R/site-library/mathGL/libs/mathGL.so':
? /usr/local/lib/R/site-library/mathGL/libs/mathGL.so: undefined symbol: _ZTIN4Rcpp14not_compatibleE
Error: loading failed
Execution halted
ERROR: loading failed
The mathGL.so library was created and exists. For reference, I'm using the following flags in the Makevars file:
PKG_CXXFLAGS=-"I/home/hp/Downloads/mathgl-2.1/include/mgl2" -lmgl
PKG_LIBS=-L/usr/local/lib/
Any ideas or thoughts as to what the "undefined symbol" error means and how to resolve this would be greatly appreciated.
Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130709/da0b7b2f/attachment.html>
[Rcpp-devel] (no subject)
7 messages · Dirk Eddelbuettel, Krzysztof Sakrejda, Jules Archer
Hi Jules,
On 9 July 2013 at 22:16, Jules Archer wrote:
| Hi,
|
| I've been trying to integrate the mathGL plotting library into R with Rcpp,
| with the ultimate goal of rendering in the browser. So far, I've been
| successful with creating simple plotting test functions, compile with sourceCpp
| ("myplotter.cpp") and output *.png and *.json files for browser 3D plotting.
Cool.
| However, when I try to compile as an R package, I keep getting the following
| error:
|
| ** building package indices
| ** testing if installed package can be loaded
| Error in dyn.load(file, DLLpath = DLLpath, ...) :
| unable to load shared object '/usr/local/lib/R/site-library/mathGL/libs/
| mathGL.so':
| /usr/local/lib/R/site-library/mathGL/libs/mathGL.so: undefined symbol:
| _ZTIN4Rcpp14not_compatibleE
| Error: loading failed
| Execution halted
| ERROR: loading failed
|
| The mathGL.so library was created and exists. For reference, I'm using the
| following flags in the Makevars file:
|
| PKG_CXXFLAGS=-"I/home/hp/Downloads/mathgl-2.1/include/mgl2" -lmgl
| PKG_LIBS=-L/usr/local/lib/
|
| Any ideas or thoughts as to what the "undefined symbol" error means and how to
| resolve this would be greatly appreciated.
Two suggestions. First, try creating a simple package without MathGL just to
make sure you have that process of going from sourceCpp via compileAttributes
to a package licked. Second, and as an alternative, try it the other way
without attributes. There are a number of simple package that link to
external libraries; you could pick any as an example.
The linmk error rings a faint bell, but I cannot quite connect the dots. You
don't by chance have two version of Rcpp installed -- in /usr/local and below
/home/hp, say?
Dirk
| Thanks!
|
| ----------------------------------------------------------------------
| _______________________________________________
| Rcpp-devel mailing list
| Rcpp-devel at lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
Dirk, Thank you for your fast reply! With regard to your specific suggestions: |Two suggestions.? First, try creating a simple package without MathGL just to |make sure you have that process of going from sourceCpp via compileAttributes |to a package licked.?? Yes, I did successfully create a simple package (using RStudio) as a "warm-up" exercise (I created a package for the classic gibbs.cpp function). I can load the package, and use the gibbs function as expected. |Second, and as an alternative, try it the other way |without attributes.? There are a number of simple package that link to |external libraries; you could pick any as an example.? I'm not quite sure what you mean by this one. Could you please give me a brief description/procedure as to how to do this? (I'm still a bit of? a newbie with Rcpp...) |The linmk error rings a faint bell, but I cannot quite connect the dots. You |don't by chance have two version of Rcpp installed -- in /usr/local and below |/home/hp, say? No, I don't have two versions installed. Just to be sure, I removed what I had and re-installed (actually upgraded to 0.10.4). Same issue... After going some googling on this, the consensus seems to be that there's something awry with ldconfig or LD_LIBRARY_PATH environment variable setting. Thanks!
From: Dirk Eddelbuettel <edd at debian.org>
To: Jules Archer <jules.archer at ymail.com>
Cc: "rcpp-devel at lists.r-forge.r-project.org" <rcpp-devel at lists.r-forge.r-project.org>
Sent: Tuesday, July 9, 2013 10:35 PM
Subject: Re: [Rcpp-devel] (no subject)
To: Jules Archer <jules.archer at ymail.com>
Cc: "rcpp-devel at lists.r-forge.r-project.org" <rcpp-devel at lists.r-forge.r-project.org>
Sent: Tuesday, July 9, 2013 10:35 PM
Subject: Re: [Rcpp-devel] (no subject)
Hi Jules,
On 9 July 2013 at 22:16, Jules Archer wrote:
| Hi,
|
| I've been trying to integrate the mathGL plotting library into R with Rcpp,
| with the ultimate goal of rendering in the browser.? So far, I've been
| successful with creating simple plotting test functions, compile with sourceCpp
| ("myplotter.cpp") and output *.png and *.json files for browser 3D plotting.
Cool.
| However, when I try to compile as an R package, I keep getting the following
| error:
|
| ** building package indices
| ** testing if installed package can be loaded
| Error in dyn.load(file, DLLpath = DLLpath, ...) :
|? unable to load shared object '/usr/local/lib/R/site-library/mathGL/libs/
| mathGL.so':
|? /usr/local/lib/R/site-library/mathGL/libs/mathGL.so: undefined symbol:
| _ZTIN4Rcpp14not_compatibleE
| Error: loading failed
| Execution halted
| ERROR: loading failed
|
| The mathGL.so library was created and exists. For reference, I'm using the
| following flags in the Makevars file:
|
| PKG_CXXFLAGS=-"I/home/hp/Downloads/mathgl-2.1/include/mgl2" -lmgl
| PKG_LIBS=-L/usr/local/lib/
|
| Any ideas or thoughts as to what the "undefined symbol" error means and how to
| resolve this would be greatly appreciated.
Two suggestions.? First, try creating a simple package without MathGL just to
make sure you have that process of going from sourceCpp via compileAttributes
to a package licked.? Second, and as an alternative, try it the other way
without attributes.? There are a number of simple package that link to
external libraries; you could pick any as an example.
The linmk error rings a faint bell, but I cannot quite connect the dots. You
don't by chance have two version of Rcpp installed -- in /usr/local and below
/home/hp, say?
Dirk
| Thanks!
|
| ----------------------------------------------------------------------
| _______________________________________________
| Rcpp-devel mailing list
| Rcpp-devel at lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130710/d546b4b0/attachment.html>
On Wed, Jul 10, 2013 at 2:18 PM, Jules Archer <jules.archer at ymail.com> wrote:
| However, when I try to compile as an R package, I keep getting the following | error: | | ** building package indices | ** testing if installed package can be loaded | Error in dyn.load(file, DLLpath = DLLpath, ...) : | unable to load shared object '/usr/local/lib/R/site-library/mathGL/libs/ | mathGL.so': | /usr/local/lib/R/site-library/mathGL/libs/mathGL.so: undefined symbol: | _ZTIN4Rcpp14not_compatibleE
I don't have an immediate answer, but calling c++filt gets you: ~ $ c++filt _ZTIN4Rcpp14not_compatibleE typeinfo for Rcpp::not_compatible I get more helpful error messages when I add "-Wl,-z,defs" to the gcc flags when building the library. With those flags, the error comes up at compilation. The proximate cause of the error is that it can't find the Rcpp::not_compatible exception class... the next clue you need is probably to look at the lines of output where your library is actually being compiled to see how Rcpp is being included, that's the part that's failing. Sorry if this is all obvious, I can't tell from your post where you're at with the Rcpp/C++ combo. Hope that helps, Krzysztof -- Krzysztof Sakrejda Organismic and Evolutionary Biology University of Massachusetts, Amherst 319 Morrill Science Center South 611 N. Pleasant Street Amherst, MA 01003 work #: 413-325-6555 email: sakrejda at cns.umass.edu -----------------------------------------------
Jules,
On 10 July 2013 at 11:18, Jules Archer wrote:
| Dirk, | | Thank you for your fast reply! | | With regard to your specific suggestions: | | |Two suggestions. First, try creating a simple package without MathGL just to | |make sure you have that process of going from sourceCpp via compileAttributes | |to a package licked. | | Yes, I did successfully create a simple package (using RStudio) as a "warm-up" | exercise (I created a package for the | classic gibbs.cpp function). I can load the package, and use the gibbs function | as expected. Ok. | |Second, and as an alternative, try it the other way | |without attributes. There are a number of simple package that link to | |external libraries; you could pick any as an example. | | I'm not quite sure what you mean by this one. Could you please give me a brief | description/procedure as to how to do this? (I'm still a bit of | a newbie with Rcpp...) Create a package the 'old fashioned and standard way' ie not via sourceCpp() / compileAttributes() but via Rcpp.package.skeleton(), say. | |The linmk error rings a faint bell, but I cannot quite connect the dots. You | |don't by chance have two version of Rcpp installed -- in /usr/local and below | |/home/hp, say? | | No, I don't have two versions installed. Just to be sure, I removed what I had | and re-installed (actually upgraded to 0.10.4). Same issue... | | | After going some googling on this, the consensus seems to be that there's | something awry with ldconfig or LD_LIBRARY_PATH environment variable setting. You will need to provide a complete reproducible example as our mind-reading machine is in the shop. Seriously, we do not know exactly what you did so it is a trfile hard to help here. Cheers, Dirk | | Thanks! | | ------------------------------------------------------------------------------- | From: Dirk Eddelbuettel <edd at debian.org> | To: Jules Archer <jules.archer at ymail.com> | Cc: "rcpp-devel at lists.r-forge.r-project.org" | <rcpp-devel at lists.r-forge.r-project.org> | Sent: Tuesday, July 9, 2013 10:35 PM | Subject: Re: [Rcpp-devel] (no subject) | | | Hi Jules, |
| On 9 July 2013 at 22:16, Jules Archer wrote:
| | Hi,
| |
| | I've been trying to integrate the mathGL plotting library into R with Rcpp,
| | with the ultimate goal of rendering in the browser. So far, I've been
| | successful with creating simple plotting test functions, compile with
| sourceCpp
| | ("myplotter.cpp") and output *.png and *.json files for browser 3D plotting.
|
| Cool.
|
| | However, when I try to compile as an R package, I keep getting the following
| | error:
| |
| | ** building package indices
| | ** testing if installed package can be loaded
| | Error in dyn.load(file, DLLpath = DLLpath, ...) :
| | unable to load shared object '/usr/local/lib/R/site-library/mathGL/libs/
| | mathGL.so':
| | /usr/local/lib/R/site-library/mathGL/libs/mathGL.so: undefined symbol:
| | _ZTIN4Rcpp14not_compatibleE
| | Error: loading failed
| | Execution halted
| | ERROR: loading failed
| |
| | The mathGL.so library was created and exists. For reference, I'm using the
| | following flags in the Makevars file:
| |
| | PKG_CXXFLAGS=-"I/home/hp/Downloads/mathgl-2.1/include/mgl2" -lmgl
| | PKG_LIBS=-L/usr/local/lib/
| |
| | Any ideas or thoughts as to what the "undefined symbol" error means and how
| to
| | resolve this would be greatly appreciated.
|
| Two suggestions. First, try creating a simple package without MathGL just to
| make sure you have that process of going from sourceCpp via compileAttributes
| to a package licked. Second, and as an alternative, try it the other way
| without attributes. There are a number of simple package that link to
| external libraries; you could pick any as an example.
|
| The linmk error rings a faint bell, but I cannot quite connect the dots. You
| don't by chance have two version of Rcpp installed -- in /usr/local and below
| /home/hp, say?
|
| Dirk
|
| | Thanks!
| |
| | ----------------------------------------------------------------------
| | _______________________________________________
| | Rcpp-devel mailing list
| | Rcpp-devel at lists.r-forge.r-project.org
| | https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
| --
| Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
|
|
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
1 day later
Krzysztof, Thank you very much for your helpful reply. Along with your suggestions, I was finally able to track down the problem. As it turned out, I was (incorrectly) re-defining PKG_LIBS instead of adding to the already existing? PKG_LIBS = `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` in the Makevars file. With this fix, the binary package build is successful. Thanks again to you and Dirk for your help!
From: Krzysztof Sakrejda <krzysztof.sakrejda at gmail.com>
To: Jules Archer <jules.archer at ymail.com>
Cc: Dirk Eddelbuettel <edd at debian.org>; "rcpp-devel at lists.r-forge.r-project.org" <rcpp-devel at lists.r-forge.r-project.org>
Sent: Wednesday, July 10, 2013 11:36 AM
Subject: Re: [Rcpp-devel] Unable to load shared object
To: Jules Archer <jules.archer at ymail.com>
Cc: Dirk Eddelbuettel <edd at debian.org>; "rcpp-devel at lists.r-forge.r-project.org" <rcpp-devel at lists.r-forge.r-project.org>
Sent: Wednesday, July 10, 2013 11:36 AM
Subject: Re: [Rcpp-devel] Unable to load shared object
On Wed, Jul 10, 2013 at 2:18 PM, Jules Archer <jules.archer at ymail.com> wrote: > | However, when I try to compile as an R package, I keep getting the > following > | error: > | > | ** building package indices > | ** testing if installed package can be loaded > | Error in dyn.load(file, DLLpath = DLLpath, ...) : > |? unable to load shared object '/usr/local/lib/R/site-library/mathGL/libs/ > | mathGL.so': > |? /usr/local/lib/R/site-library/mathGL/libs/mathGL.so: undefined symbol: > | _ZTIN4Rcpp14not_compatibleE I don't have an immediate answer, but calling c++filt gets you: ~ $ c++filt _ZTIN4Rcpp14not_compatibleE typeinfo for Rcpp::not_compatible I get more helpful error messages when I add "-Wl,-z,defs" to the gcc flags when building the library.? With those flags, the error comes up at compilation.? The proximate cause of the error is that it can't find the Rcpp::not_compatible exception class... the next clue you need is probably to look at the lines of output where your library is actually being compiled to see how Rcpp is being included, that's the part that's failing. Sorry if this is all obvious, I can't tell from your post where you're at with the Rcpp/C++ combo. Hope that helps, Krzysztof -- Krzysztof Sakrejda Organismic and Evolutionary Biology University of Massachusetts, Amherst 319 Morrill Science Center South 611 N. Pleasant Street Amherst, MA 01003 work #: 413-325-6555 email: sakrejda at cns.umass.edu ----------------------------------------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130712/943abe08/attachment.html>
On 12 July 2013 at 21:35, Jules Archer wrote:
| Krzysztof, | | Thank you very much for your helpful reply. | | Along with your suggestions, I was finally able to track down the problem. As | it turned out, I was (incorrectly) re-defining PKG_LIBS instead of adding to | the already existing | PKG_LIBS = `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` in the Makevars file. | With this fix, the binary package build is successful. Yup, that'll do it. And again, there are many Rcpp-based packages linking to external libraries so there is always a stanza to copy from. | Thanks again to you and Dirk for your help! Glad it works for you. Looking forward to your package. Dirk | ------------------------------------------------------------------------------- | From: Krzysztof Sakrejda <krzysztof.sakrejda at gmail.com> | To: Jules Archer <jules.archer at ymail.com> | Cc: Dirk Eddelbuettel <edd at debian.org>; | "rcpp-devel at lists.r-forge.r-project.org" | <rcpp-devel at lists.r-forge.r-project.org> | Sent: Wednesday, July 10, 2013 11:36 AM | Subject: Re: [Rcpp-devel] Unable to load shared object |
| On Wed, Jul 10, 2013 at 2:18 PM, Jules Archer <jules.archer at ymail.com> wrote:
| | > | However, when I try to compile as an R package, I keep getting the | > following | > | error: | > | | > | ** building package indices | > | ** testing if installed package can be loaded | > | Error in dyn.load(file, DLLpath = DLLpath, ...) : | > | unable to load shared object '/usr/local/lib/R/site-library/mathGL/libs/ | > | mathGL.so': | > | /usr/local/lib/R/site-library/mathGL/libs/mathGL.so: undefined symbol: | > | _ZTIN4Rcpp14not_compatibleE | | I don't have an immediate answer, but calling c++filt gets you: | | ~ $ c++filt _ZTIN4Rcpp14not_compatibleE | typeinfo for Rcpp::not_compatible | | I get more helpful error messages when I add "-Wl,-z,defs" to the gcc | flags when building the library. With those flags, the error comes up | at compilation. The proximate cause of the error is that it can't | find the Rcpp::not_compatible exception class... the next clue you | need is probably to look at the lines of output where your library is | actually being compiled to see how Rcpp is being included, that's the | part that's failing. Sorry if this is all obvious, I can't tell from | your post where you're at with the Rcpp/C++ combo. | | Hope that helps, | | Krzysztof | | | -- | | Krzysztof Sakrejda | | Organismic and Evolutionary Biology | University of Massachusetts, Amherst | 319 Morrill Science Center South | 611 N. Pleasant Street | Amherst, MA 01003 | | work #: 413-325-6555 | email: sakrejda at cns.umass.edu | ----------------------------------------------- | |
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com