corels icon indicating copy to clipboard operation
corels copied to clipboard

Update rules_init to fix early termination bug on linux

Open nlarusstone opened this issue 6 years ago • 10 comments

nlarusstone avatar Feb 22 '20 00:02 nlarusstone

Should fix #25

nlarusstone avatar Feb 22 '20 00:02 nlarusstone

Tested on Description: CentOS Linux release 7.5.1804 (Core) Release: 7.5.1804 and OSX 10.15

nlarusstone avatar Feb 22 '20 00:02 nlarusstone

That's a pretty large change set over code I am not that familiar with. Not sure I can review this. Will try to come back to this during the weekend.

eddelbuettel avatar Feb 22 '20 01:02 eddelbuettel

Approved in the sense that it builds (and tests) fine in corels, that I can carry it over to RcppCorels where it builds fine but issues remain:

edd@rob:~/git/rcppcorels(feature/upstream_pr25)$ rcc.r RcppCorels_0.0.1.3.tar.gz   
── R CMD check ──────────────────────────────────────────────────────────────
─  using log directory ‘/tmp/file14712954e0d2/RcppCorels.Rcheck’
─  using R version 3.6.2 (2019-12-12)
─  using platform: x86_64-pc-linux-gnu (64-bit)
─  using session charset: UTF-8
✔  checking for file ‘RcppCorels/DESCRIPTION’ ...
─  checking extension type ... Package
─  this is package ‘RcppCorels’ version ‘0.0.1.3’
✔  checking package namespace information
✔  checking package dependencies (584ms)
✔  checking if this is a source package
✔  checking if there is a namespace
✔  checking for executable files ...
✔  checking for hidden files and directories
W  checking whether package ‘RcppCorels’ can be installed (2.2s)
   Found the following significant warnings:
     rule.h:102:18: warning: ISO C++ forbids flexible array member ‘rules’ [-Wpedantic]
   See ‘/tmp/file14712954e0d2/RcppCorels.Rcheck/00install.out’ for details.
✔  checking package subdirectories ...
✔  checking R files for non-ASCII characters ...
✔  checking R files for syntax errors ...
✔  checking whether the package can be loaded ...
✔  checking whether the package can be loaded with stated dependencies ...
✔  checking whether the package can be unloaded cleanly ...
✔  checking whether the namespace can be loaded with stated dependencies ...
✔  checking whether the namespace can be unloaded cleanly ...
✔  checking loading without being on the library search path ...
✔  checking dependencies in R code ...
✔  checking S3 generic/method consistency (410ms)
✔  checking replacement functions ...
✔  checking foreign function calls ...
✔  checking R code for possible problems (860ms)
✔  checking Rd files ...
✔  checking Rd metadata ...
✔  checking Rd cross-references ...
✔  checking for missing documentation entries ...
✔  checking for code/documentation mismatches (627ms)
✔  checking Rd \usage sections (490ms)
✔  checking Rd contents ...
✔  checking for unstated dependencies in examples ...
✔  checking line endings in shell scripts
✔  checking line endings in C/C++/Fortran sources/headers
✔  checking line endings in Makefiles
✔  checking compilation flags in Makevars ...
✔  checking for GNU extensions in Makefiles
✔  checking for portable use of $(BLAS_LIBS) and $(LAPACK_LIBS)
✔  checking compilation flags used
N  checking compiled code ...
   File ‘RcppCorels/libs/RcppCorels.so’:
     Found ‘putchar’, possibly from ‘putchar’ (C)
       Object: ‘rulelib.o’
     Found ‘random’, possibly from ‘random’ (C)
       Object: ‘rulelib.o’
     Found ‘stdout’, possibly from ‘stdout’ (C)
       Object: ‘rulelib.o’
   
   Compiled code should not call entry points which might terminate R nor
   write to stdout/stderr instead of to the console, nor use Fortran I/O
   nor system RNGs.
   
   See ‘Writing portable packages’ in the ‘Writing R Extensions’ manual.
✔  checking examples (816ms)
✔  checking PDF version of manual (1.3s)
   
   See
     ‘/tmp/file14712954e0d2/RcppCorels.Rcheck/00check.log’
   for details.
   
   
edd@rob:~/git/rcppcorels(feature/upstream_pr25)$ 

(where rcc.r is a command-line wrapper around rcmdcheck::rcmdcheck() which itself wraps and pretty prints the standard R CMD check process.)

eddelbuettel avatar Feb 22 '20 19:02 eddelbuettel

I should add that before the code in your PR, I have a proper clean checkout so that aspect is a regression for me.

edd@rob:~/git/rcppcorels(master)$ rcc.r RcppCorels_0.0.1.2.tar.gz 
── R CMD check ──────────────────────────────────────────────────────────────
─  using log directory ‘/tmp/file9ed1fa87234/RcppCorels.Rcheck’
─  using R version 3.6.2 (2019-12-12)
─  using platform: x86_64-pc-linux-gnu (64-bit)
─  using session charset: UTF-8         
✔  checking for file ‘RcppCorels/DESCRIPTION’ ...
─  checking extension type ... Package
─  this is package ‘RcppCorels’ version ‘0.0.1.2’
✔  checking package namespace information
✔  checking package dependencies (691ms)
✔  checking if this is a source package
✔  checking if there is a namespace
✔  checking for executable files ...
✔  checking for hidden files and directories
✔  checking for portable file names
✔  checking for sufficient/correct file permissions
✔  checking whether package ‘RcppCorels’ can be installed (2.2s)
✔  checking installed package size
✔  checking package directory
✔  checking DESCRIPTION meta-information ...
✔  checking top-level files ...
✔  checking for left-over files
✔  checking index information
✔  checking package subdirectories ...
✔  checking R files for non-ASCII characters ...
✔  checking R files for syntax errors ...
✔  checking whether the package can be loaded ...
✔  checking whether the package can be loaded with stated dependencies ...
✔  checking whether the package can be unloaded cleanly ...
✔  checking whether the namespace can be loaded with stated dependencies ...
✔  checking whether the namespace can be unloaded cleanly ...
✔  checking loading without being on the library search path ...
✔  checking dependencies in R code ...
✔  checking S3 generic/method consistency (388ms)
✔  checking replacement functions ...
✔  checking foreign function calls ...
✔  checking R code for possible problems (913ms)
✔  checking Rd files ...
✔  checking Rd metadata ...
✔  checking Rd cross-references ...
✔  checking for missing documentation entries ...
✔  checking for code/documentation mismatches (627ms)
✔  checking Rd \usage sections (486ms)
✔  checking Rd contents ...
✔  checking for unstated dependencies in examples ...
✔  checking line endings in shell scripts
✔  checking line endings in C/C++/Fortran sources/headers
✔  checking line endings in Makefiles ...
✔  checking compilation flags in Makevars ...
✔  checking for GNU extensions in Makefiles
✔  checking for portable use of $(BLAS_LIBS) and $(LAPACK_LIBS)
✔  checking compilation flags used
✔  checking compiled code ...
✔  checking examples (619ms)
✔  checking PDF version of manual (1.2s)
   
   
edd@rob:~/git/rcppcorels(master)$ 

eddelbuettel avatar Feb 23 '20 13:02 eddelbuettel

Do you want to update the PR so that it has a clean R check? I'm not sure exactly what command you're running so it would be difficult for me to adapt

nlarusstone avatar Feb 23 '20 14:02 nlarusstone

Could you look into it and trying to replace my one-line (and quite possibly imperfect) bug fix with one that does not regress?

We run the very standard R CMD check --as-cran yourTarballHere.tar.gz where the tarball contains the three files you modified in the PR as replacements over what is currently in RcppCorels.

(I run a wrapper called rcc.r but that is just cosmetics. The command above is what counts.)

eddelbuettel avatar Feb 23 '20 14:02 eddelbuettel

Hi @eddelbuettel sorry I'm not very familiar with R packaging. I've cloned the rcpp repo and I'm trying to run R CMD check, but I'm getting some installation errors (even without the changes).

Here's what I'm seeing:

** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘RcppCorels’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Users/nlarusstone/Documents/corels/rcppcorels/..Rcheck/00LOCK-rcppcorels/00new/RcppCorels/libs/RcppCorels.so':
  dlopen(/Users/nlarusstone/Documents/corels/rcppcorels/..Rcheck/00LOCK-rcppcorels/00new/RcppCorels/libs/RcppCorels.so, 6): Library not loaded: /usr/local/lib/gcc/7/libgcc_s.1.dylib
  Referenced from: /usr/local/lib/libgmp.10.dylib
  Reason: image not found
Error: loading failed
Execution halted
ERROR: loading failed

Any thoughts on what I'm doing wrong?

nlarusstone avatar Mar 04 '20 23:03 nlarusstone

I don't use macOS myself so I know next to nothing.

But I do know that I see a lot of emails like this (and that is a truncated distribution -- I may not see the winners). In short, I think you need to be careful with the toolchain / do extra steps. Per the Rcpp FAQ, questions 2.10 and 2.16 the best resource is maintained by James at his site

If you "can escape" to Linux or Docker, that may be an alternative.

And/or use facilities such as the RHub Builder.

eddelbuettel avatar Mar 04 '20 23:03 eddelbuettel

This looks good - my only concern is rule_vector_equal has the opposite return value of rule_vector_cmp (the latter returns 0 when they're equal), yet you simply interchanged them (without changing you use their return value) in pmap.h

fingoldin avatar Jun 18 '20 22:06 fingoldin