Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork219
Automatically register init functions for RcppModules (closes #704)#705
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
eddelbuettel commentedJun 2, 2017
Nicely done. |
eddelbuettel commentedJun 2, 2017
Shame on me for not escalating this in March when I adjusted the example we unit test. |
codecov-io commentedJun 2, 2017 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov Report
@@ Coverage Diff @@## master #705 +/- ##==========================================+ Coverage 89.54% 89.57% +0.03%========================================== Files 66 66 Lines 3587 3588 +1 ==========================================+ Hits 3212 3214 +2+ Misses 375 374 -1
Continue to review full report at Codecov.
|
eddelbuettel commentedJun 2, 2017 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Notquite there yet. After fresh install from this branch: /tmp$ Rscript -e"Rcpp::Rcpp.package.skeleton('foo', module = TRUE)" Creating directories ...Creating DESCRIPTION ...Creating NAMESPACE ...Creating Read-and-delete-me ...Saving functions and data ...Makinghelp files ...Done.Further steps are describedin'./foo/Read-and-delete-me'.Adding Rcpp settings>> added Imports: Rcpp>> added LinkingTo: Rcpp>> added useDynLib directive to NAMESPACE>> added import(methods, Rcpp) directive to NAMESPACE>> added example src file using Rcpp attributes>> compiled Rcpp attributes>>do NOT modify by hand either RcppExports.cpp or RcppExports.R>> added Rd filefor rcpp_hello_world>> copied the example module file /tmp$ R CMD INSTALL foo* installing to library ‘/usr/local/lib/R/site-library’* installing*source* package ‘foo’ ...** libsccache g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -fpic -g -O3 -Wall -pipe -pedantic -Wextra -Wno-empty-body -Wno-unused -c Num.cpp -o Num.occache g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -fpic -g -O3 -Wall -pipe -pedantic -Wextra -Wno-empty-body -Wno-unused -c RcppExports.cpp -o RcppExports.occache g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -fpic -g -O3 -Wall -pipe -pedantic -Wextra -Wno-empty-body -Wno-unused -c rcpp_hello_world.cpp -o rcpp_hello_world.occache g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -fpic -g -O3 -Wall -pipe -pedantic -Wextra -Wno-empty-body -Wno-unused -c rcpp_module.cpp -o rcpp_module.occache g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -fpic -g -O3 -Wall -pipe -pedantic -Wextra -Wno-empty-body -Wno-unused -c stdVector.cpp -o stdVector.og++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o foo.so Num.o RcppExports.o rcpp_hello_world.o rcpp_module.o stdVector.o -L/usr/lib/R/lib -lRinstalling to /usr/local/lib/R/site-library/foo/libs** R** preparing packagefor lazy loading**help*** installinghelp indices** building package indices** testingif installed package can be loadedError: package or namespace load failedfor‘foo’in .doLoadActions(where, attach): errorin load action .__A__.1forpackage foo: loadModule(module ="NumEx", what = TRUE, env = ns, loadNow = TRUE): Unable to load module"NumEx": Failed to initialize module pointer: Errorin FUN(X[[i]], ...): no such symbol _rcpp_module_boot_NumExin package fooError: loading failedExecution haltedERROR: loading failed* removing ‘/usr/local/lib/R/site-library/foo’/tmp$ |
jjallaire commentedJun 2, 2017 via email
I think the problem is that compileAttributes is called withinRcpp::package.skeleton *before* the module code is added. I'll change theorder and it should resolve things. …On Fri, Jun 2, 2017 at 12:17 PM, Dirk Eddelbuettel ***@***.*** > wrote: Not *quite* there yet. After fresh install from this branch: /tmp$ Rscript -e "Rcpp::Rcpp.package.skeleton('foo', module = TRUE)" Creating directories ... Creating DESCRIPTION ... Creating NAMESPACE ... Creating Read-and-delete-me ... Saving functions and data ... Making help files ... Done. Further steps are described in './foo/Read-and-delete-me'. Adding Rcpp settings >> added Imports: Rcpp >> added LinkingTo: Rcpp >> added useDynLib directive to NAMESPACE >> added import(methods, Rcpp) directive to NAMESPACE >> added example src file using Rcpp attributes >> compiled Rcpp attributes >> do NOT modify by hand either RcppExports.cpp or RcppExports.R >> added Rd file for rcpp_hello_world >> copied the example module file /tmp$ R CMD INSTALL foo* installing to library ‘/usr/local/lib/R/site-library’* installing *source* package ‘foo’ ...** libs ccache g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -fpic -g -O3 -Wall -pipe -pedantic -Wextra -Wno-empty-body -Wno-unused -c Num.cpp -o Num.o ccache g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -fpic -g -O3 -Wall -pipe -pedantic -Wextra -Wno-empty-body -Wno-unused -c RcppExports.cpp -o RcppExports.o ccache g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -fpic -g -O3 -Wall -pipe -pedantic -Wextra -Wno-empty-body -Wno-unused -c rcpp_hello_world.cpp -o rcpp_hello_world.o ccache g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -fpic -g -O3 -Wall -pipe -pedantic -Wextra -Wno-empty-body -Wno-unused -c rcpp_module.cpp -o rcpp_module.o ccache g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -fpic -g -O3 -Wall -pipe -pedantic -Wextra -Wno-empty-body -Wno-unused -c stdVector.cpp -o stdVector.o g++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o foo.so Num.o RcppExports.o rcpp_hello_world.o rcpp_module.o stdVector.o -L/usr/lib/R/lib -lR installing to /usr/local/lib/R/site-library/foo/libs** R** preparing 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 ‘foo’ in .doLoadActions(where, attach): error in load action .__A__.1 for package foo: loadModule(module = "NumEx", what = TRUE, env = ns, loadNow = TRUE): Unable to load module "NumEx": Failed to initialize module pointer: Error in FUN(X[[i]], ...): no such symbol _rcpp_module_boot_NumEx in package foo Error: loading failed Execution halted ERROR: loading failed* removing ‘/usr/local/lib/R/site-library/foo’ /tmp$ — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#705 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAGXx0vLz4Cagygyt4M5_uiBGskIPcnDks5sADWbgaJpZM4NudVA> . |
jjallaire commentedJun 2, 2017 via email
Okay, just pushed a fix …On Fri, Jun 2, 2017 at 1:20 PM, JJ Allaire ***@***.***> wrote: I think the problem is that compileAttributes is called within Rcpp::package.skeleton *before* the module code is added. I'll change the order and it should resolve things. On Fri, Jun 2, 2017 at 12:17 PM, Dirk Eddelbuettel < ***@***.***> wrote:> Not *quite* there yet.>> After fresh install from this branch:>> /tmp$ Rscript -e "Rcpp::Rcpp.package.skeleton('foo', module = TRUE)" Creating directories ...> Creating DESCRIPTION ...> Creating NAMESPACE ...> Creating Read-and-delete-me ...> Saving functions and data ...> Making help files ...> Done.> Further steps are described in './foo/Read-and-delete-me'.>> Adding Rcpp settings> >> added Imports: Rcpp> >> added LinkingTo: Rcpp> >> added useDynLib directive to NAMESPACE> >> added import(methods, Rcpp) directive to NAMESPACE> >> added example src file using Rcpp attributes> >> compiled Rcpp attributes> >> do NOT modify by hand either RcppExports.cpp or RcppExports.R> >> added Rd file for rcpp_hello_world> >> copied the example module file> /tmp$ R CMD INSTALL foo* installing to library ‘/usr/local/lib/R/site-library’* installing *source* package ‘foo’ ...** libs> ccache g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -fpic -g -O3 -Wall -pipe -pedantic -Wextra -Wno-empty-body -Wno-unused -c Num.cpp -o Num.o> ccache g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -fpic -g -O3 -Wall -pipe -pedantic -Wextra -Wno-empty-body -Wno-unused -c RcppExports.cpp -o RcppExports.o> ccache g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -fpic -g -O3 -Wall -pipe -pedantic -Wextra -Wno-empty-body -Wno-unused -c rcpp_hello_world.cpp -o rcpp_hello_world.o> ccache g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -fpic -g -O3 -Wall -pipe -pedantic -Wextra -Wno-empty-body -Wno-unused -c rcpp_module.cpp -o rcpp_module.o> ccache g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -fpic -g -O3 -Wall -pipe -pedantic -Wextra -Wno-empty-body -Wno-unused -c stdVector.cpp -o stdVector.o> g++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o foo.so Num.o RcppExports.o rcpp_hello_world.o rcpp_module.o stdVector.o -L/usr/lib/R/lib -lR> installing to /usr/local/lib/R/site-library/foo/libs** R** preparing 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 ‘foo’ in .doLoadActions(where, attach):> error in load action .__A__.1 for package foo: loadModule(module = "NumEx", what = TRUE, env = ns, loadNow = TRUE): Unable to load module "NumEx": Failed to initialize module pointer: Error in FUN(X[[i]], ...): no such symbol _rcpp_module_boot_NumEx in package foo>> Error: loading failed> Execution halted> ERROR: loading failed* removing ‘/usr/local/lib/R/site-library/foo’> /tmp$>> —> You are receiving this because you authored the thread.> Reply to this email directly, view it on GitHub> <#705 (comment)>, or mute> the thread> <https://github.com/notifications/unsubscribe-auth/AAGXx0vLz4Cagygyt4M5_uiBGskIPcnDks5sADWbgaJpZM4NudVA>> .> |
eddelbuettel commentedJun 2, 2017
Works like a charm now. |
| compileAttributes(root) | ||
| message(" >> compiled Rcpp attributes") | ||
| } | ||
eddelbuettelJun 2, 2017 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Maybe I am short of coffee butif (attributes) { relies onattributes==TRUE. We could have a case ofmodules=TRUE (as in#704)and alsoattributes=FALSE, no? Needless complication?
jjallaire commentedJun 2, 2017
I think it's a little more involved than first appears, if we do this: Rcpp::Rcpp.package.skeleton('foo', module = TRUE, attributes = FALSE)Then the I'd say if the user asks for modules and no attributes then they mean no auto-generation behavior and they'll futz with init.c manually themselves. |
eddelbuettel commentedJun 2, 2017
Agreed. Let's go with this now and clean up spillage should it occur. |
BenoitLondon commentedJun 7, 2017
Thanks for the fix! Do you know when you will release it? I wanted to know if I should use master or wait for the release. |
eddelbuettel commentedJun 7, 2017
@BenoitLondon See myrecent post to the rcpp-devel list with pointers to the drat repo. You can install Rcpp 0.12.11.2 from there. (Master works too but the git repo could be unstable.) |
BenoitLondon commentedJun 8, 2017
Thanks |
Addresses#704
RcppModules include a native routine "boot" function of the form
_rcpp_module_boot_*. These functions are not discovered bytools::package_native_routine_registration_skeletonso generally need to be hand-added toinit.c.This also implies that our current auto-generation of native routine registrations for
RcppExports.cppwon't register these functions and will therefore fail to create a loadable package. 2 alternatives here:When we see an Rcpp module simply don't attempt to generate native routine registrations (sort of like we do now when we see
init.c).Generate native routine registrations for the Rcpp modules.
Happily, we already parse for Rcpp module declarations (since
sourceCppsupports exporting modules) so it's a very straightforward change to generate the_rcpp_module_boot_*functions, which is what we do in this PR.