Re: [R-pkg-devel] warning: type of ‘zhpevx_’ does not match original declaration [-Wlto-type-mismatch]

2020-12-15 Thread Tomas Kalibera
Dear Pierre,

your code checks fine on my Ubuntu 20.04 (gcc/gfortran 9.3), but I can 
reproduce what you are seeing on Debian 10 with gcc 8.3.

There seem to be two problems.

The first one is that the hidden character length arguments are signed, 
they are of type "long int" (not "size_t"). This is compiler specific 
and can (and does) change between Fortran compiler versions and I think 
you can just ignore it. R assumes the type is "size_t", which happens to 
be correct for newer compilers. The signedness mismatch in this case is 
benign. FC_LEN_T is defined in R, so if anywhere, this would have to be 
fixed in R, but we cannot realistically know what the type is for each 
compiler.

The second problem is that gcc/LTO is complaining about incompatibility 
between Rcomplex and "COMPLEX*16" types. This was rather tedious to 
find, I had to minimize the example for that a bit more (remove the 
Fortran code, just left the subroutine taking the same args, and then 
removing the args one by one - this is what I meant by minimizing the 
example). I don't know why the mismatch is reported. Gcc 9.3 is happy.

I would recommend to use a newer compiler, at least for these checks. 
The warnings have improved (become more informative), you can use 
-fc-prototypes-external to see what the types should be exactly for your 
compiler, and perhaps some of the warnings were false positives and have 
been fixed since.

If you want to stick to the FC_LEN_T and similar macros, I would 
recommend to check how R does it so that the code compiles also when the 
extra hidden length arguments are not used by the compiler. Still, a 
portable way to solve these issues would be via iso_c_binding, with 
FC_LEN_T we are relying on undocumented/not-standardized behavior of the 
compiler.

Best,
Tomas





On 12/15/20 7:56 AM, Pierre Lafaye de Micheaux wrote:
> Dear Tomas,
>
> Apologies for the very long delay.
>
> I was able to create a minimal version of the package (attached) that 
> gives the same exact warnings:
>
> myzhpevx.cpp:22:16: warning: type of ‘zhpevx_’ does not match original 
> declaration [-Wlto-type-mismatch]
>            void F77_NAME(zhpevx)(char *jobz, char *range, char *uplo,
>                 ^
> zhpevx.f:232:14: note: type mismatch in parameter 20
>        SUBROUTINE zhpevx(JOBZ, RANGE, UPLO, N, AP, VL, VU, IL, IU,
>               ^
> zhpevx.f:232:14: note: type ‘long int’ should match type ‘size_t’
> zhpevx.f:232:14: note: ‘zhpevx’ was previously declared here
> zhpevx.f:232:14: note: code may be misoptimized unless 
> -fno-strict-aliasing is used
>
> I am under the impression that I am following quite closely what is 
> written here: 
> https://cran.csiro.au/doc/manuals/r-patched/R-exts.html#Fortran-character-strings
>
> I tried many different things but I always end up with the same main 
> warning (i.e., type of ‘zhpevx_’ does not match original declaration ).
>
> My version of fortran: GNU Fortran (Debian 8.3.0-6) 8.3.0 under Debian 10.
>
> Thank you very much for any further help you could provide so that I 
> could have my package back to the CRAN.
>
> Kind regards,
> Pierre L.
>
>
> 
> *From:* Tomas Kalibera 
> *Sent:* Tuesday, 7 July 2020 15:43
> *To:* Pierre Lafaye de Micheaux 
> *Cc:* r-package-devel@r-project.org 
> *Subject:* Re: [R-pkg-devel] warning: type of ‘zhpevx_’ does not match 
> original declaration [-Wlto-type-mismatch]
> My recommendation would be to try to minimize the example (package) as 
> much as possible so that it still has the problem, and then try to 
> investigate why exactly/where is the type mismatch. This is what 
> helped me debug similar issues - sometimes it was hard to tell from 
> the Fortran warnings where exactly the mismatched declarations were 
> and why they were mismatched.
>
> This process of minimization can already reveal the true source of the 
> problem, and if not, others may try to debug for you using the minimal 
> example. A useful tool is the Fortran option -fc-prototypes-external 
> (see WRE for more details) and I've also used dumps of the compiler 
> tree before (-fdump-tree-all, more in GCC documentation).
>
> Best
> Tomas
>
> On 7/7/20 5:00 AM, Pierre Lafaye de Micheaux wrote:
>> My file myzhpevx.cpp starts with:
>>
>> 
>> #define USE_FC_LEN_T
>> #include 
>> #include "Rmath.h"
>>
>> #ifdef FC_LEN_T
>> extern "C" {
>>
>>void zhpevxC(char **jobz, char **range, char **uplo, int *n, Rcomplex *ap,
>>   double *vl, double *vu, int *il, int *iu, double *abstol, int *m,
>>   double *w, Rcomplex *z, int *ldz, Rcomplex *work, double *rwork,
>>   int *iwork, int *ifail, int *info) {
>>
>>void F77_NAME(zhpevx)(char *jobz, char *range, char *uplo,
>>const int *n, Rcomplex *ap, const double *vl,
>>const double *vu, const int *il, const int *iu,
>>const double *abstol, int *m, double *w,
>>Rcomplex *z, const int *ldz, Rcomplex *work, d

Re: [R-pkg-devel] Used package not updated - needs java < V 11

2020-12-15 Thread Duncan Murdoch

On 15/12/2020 8:02 a.m., Knut Krueger wrote:

I am using in my Package XlConnect. If the Computer is using Java < 11
all is working. But if not, the package can not be used.


inside teh functions tehre is an ' @importFrom XLConnect createSheet
writeWorksheet saveWorkbook

but only used for additional comfort to use excel sheets

The package is usable without XlConnect if I change

Imports:  igraph,chron,gdata, XLConnect
to
Imports:
  igraph,chron,gdata
Suggests:XLConnect

but then I get the error

checking package dependencies ... ERROR
Namespace dependency not required: ‘XLConnect’

Just now the new version is on my private repository and working with or
without Xlconnect depending on the java version


How can I submit the package to cran  until XlConnect is working with
java > 11


You should not have

@importFrom XLConnect createSheet writeWorksheet saveWorkbook

in your ROxygen comments; that results in an unconditional import. 
Instead, you should use fully qualified calls each time, i.e.


XLConnect::createSheet, XLConnect::writeWorksheet, XLConnect::saveWorkbook

in your code.  You should also wrap every use of those functions in 
checks like


if (requireNamespace("XLConnect")) {
  run code
} else {
  report that you can't run that code
}

and make sure none of your examples or vignettes fail if XLConnect is 
not present.


Duncan Murdoch

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Used package not updated - needs java < V 11

2020-12-15 Thread Spencer Graves
	 I suggest NOT using "XLConnect".  "sos" now uses WriteXLS.  "Ecfun" 
now uses "openxlsx".



	  Also, I received an email from CRAN maintainers months ago saying 
that "gdata" was being obsoleted.  It's still on CRAN with a date of 
2017-06-06 and a huge number of reverse dependencies.  The CRAN 
maintainers may have gotten someone to agree to take it over who just 
hasn't finished fixing whatever deficiencies it has.  However, you might 
see how difficult it might be to do without "gdata" as well.



  Spencer Graves


On 2020-12-15 07:37, Duncan Murdoch wrote:

On 15/12/2020 8:02 a.m., Knut Krueger wrote:

I am using in my Package XlConnect. If the Computer is using Java < 11
all is working. But if not, the package can not be used.


inside teh functions tehre is an ' @importFrom XLConnect createSheet
writeWorksheet saveWorkbook

but only used for additional comfort to use excel sheets

The package is usable without XlConnect if I change

Imports:  igraph,chron,gdata, XLConnect
to
Imports:
  igraph,chron,gdata
Suggests:XLConnect

but then I get the error

checking package dependencies ... ERROR
    Namespace dependency not required: ‘XLConnect’

Just now the new version is on my private repository and working with or
without Xlconnect depending on the java version


How can I submit the package to cran  until XlConnect is working with
java > 11


You should not have

@importFrom XLConnect createSheet writeWorksheet saveWorkbook

in your ROxygen comments; that results in an unconditional import. 
Instead, you should use fully qualified calls each time, i.e.


XLConnect::createSheet, XLConnect::writeWorksheet, XLConnect::saveWorkbook

in your code.  You should also wrap every use of those functions in 
checks like


if (requireNamespace("XLConnect")) {
   run code
} else {
   report that you can't run that code
}

and make sure none of your examples or vignettes fail if XLConnect is 
not present.


Duncan Murdoch

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


[R-pkg-devel] Used package not updated - needs java < V 11

2020-12-15 Thread Knut Krueger
I am using in my Package XlConnect. If the Computer is using Java < 11 
all is working. But if not, the package can not be used.



inside teh functions tehre is an ' @importFrom XLConnect createSheet 
writeWorksheet saveWorkbook


but only used for additional comfort to use excel sheets

The package is usable without XlConnect if I change

Imports:  igraph,chron,gdata, XLConnect
to
Imports:
igraph,chron,gdata
Suggests:XLConnect

but then I get the error

checking package dependencies ... ERROR
  Namespace dependency not required: ‘XLConnect’

Just now the new version is on my private repository and working with or 
without Xlconnect depending on the java version



How can I submit the package to cran  until XlConnect is working with 
java > 11


REgards Knut

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


[R-pkg-devel] R CMD check warning on Solaris

2020-12-15 Thread Akshit Achara
Hey everyone,

I have created a package rminizinc
 which is available on CRAN.
I had issues in
my configure script as it was only supporting Linux, OSX and Windows and not
other Unix like OS. I was able to resolve that issue.

I tested my package on R-hub on Oracle Solaris 10, x86, 32 bit, R-release,
Oracle Developer Studio 12.6
and got this warning :

#> Error(s) in re-building vignettes:

#> --- re-building ‘R_MiniZinc.Rmd’ using rmarkdown

#> Warning in engine$weave(file, quiet = quiet, encoding = enc) :

#> Pandoc (>= 1.12.3) and/or pandoc-citeproc not available. Falling back to
R Markdown v1.

#> *** caught segfault ***

#> address 0, cause 'memory not mapped'

#> Traceback:

#> 1: rminizinc:::mzn_parse(mzn_path = mzn_path)

#> 2: eval(expr, envir, enclos)

#> 3: eval(expr, envir, enclos)

#> 4: withVisible(eval(expr, envir, enclos))

#> 5: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning =
wHandler, error = eHandler, message = mHandler)

#> 6: doTryCatch(return(expr), name, parentenv, handler)

#> 7: tryCatchOne(expr, names, parentenv, handlers[[1L]])

#> 8: tryCatchList(expr, classes, parentenv, handlers)

#> 9: tryCatch(expr, error = function(e) { call <- conditionCall(e) if
(!is.null(call)) { if (identical(call[[1L]], quote(doTryCatch))) call <-
sys.call(-4L) dcall <- deparse(call)[1L] prefix <- paste("Error in", dcall,
": ") LONG <- 75L sm <- strsplit(conditionMessage(e), "\n")[[1L]] w <- 14L
+ nchar(dcall, type = "w") + nchar(sm[1L], type = "w") if (is.na(w)) w <-
14L + nchar(dcall, type = "b") + nchar(sm[1L], type = "b") if (w > LONG)
prefix <- paste0(prefix, "\n ") } else prefix <- "Error : " msg <-
paste0(prefix, conditionMessage(e), "\n") .Internal(seterrmessage(msg[1L]))
if (!silent && isTRUE(getOption("show.error.messages"))) { cat(msg, file =
outFile) .Internal(printDeferredWarnings()) } invisible(structure(msg,
class = "try-error", condition = e))})

#> 10: try(f, silent = TRUE)

#> 11: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir,
enclos)), warning = wHandler, error = eHandler, message = mHandler))

#> 12: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr,
envir, enclos)), warning = wHandler, error = eHandler, message = mHandler)))

#> 13: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos,
debug = debug, last = i == length(out), use_try = stop_on_error != 2L,
keep_warning = keep_warning, keep_message = keep_message, output_handler =
output_handler, include_timing = include_timing)

#> 14: evaluate::evaluate(...)

#> 15: evaluate(code, envir = env, new_device = FALSE, keep_warning =
!isFALSE(options$warning), keep_message = !isFALSE(options$message),
stop_on_error = if (options$error && options$include) 0L else 2L,
output_handler = knit_handlers(options$render, options))

#> 16: in_dir(input_dir(), evaluate(code, envir = env, new_device = FALSE,
keep_warning = !isFALSE(options$warning), keep_message =
!isFALSE(options$message), stop_on_error = if (options$error &&
options$include) 0L else 2L, output_handler = knit_handlers(options$render,
options)))

#> 17: block_exec(params)

#> 18: call_block(x)

#> 19: process_group.block(group)

#> 20: process_group(group)

#> 21: withCallingHandlers(if (tangle) process_tangle(group) else
process_group(group), error = function(e) { setwd(wd) cat(res, sep = "\n",
file = output %n% "") message("Quitting from lines ",
paste(current_lines(i), collapse = "-"), " (", knit_concord$get("infile"),
") ") })

#> 22: process_file(text, output)

#> 23: knit(input, text = text, envir = envir, quiet = quiet)

#> 24: knit2html(..., force_v1 = TRUE)

#> 25: (if (grepl("\\.[Rr]md$", file)) knit2html_v1 else if
(grepl("\\.[Rr]rst$", file)) knit2pandoc else knit)(file, encoding =
encoding, quiet = quiet, envir = globalenv(), ...)

#> 26: vweave(...)

#> 27: engine$weave(file, quiet = quiet, encoding = enc)

#> 28: doTryCatch(return(expr), name, parentenv, handler)

#> 29: tryCatchOne(expr, names, parentenv, handlers[[1L]])

#> 30: tryCatchList(expr, classes, parentenv, handlers)

#> 31: tryCatch({ engine$weave(file, quiet = quiet, encoding = enc)
setwd(startdir) output <- find_vignette_product(name, by = "weave", engine
= engine) if (!have.makefile && vignette_is_tex(output)) { texi2pdf(file =
output, clean = FALSE, quiet = quiet) output <- find_vignette_product(name,
by = "texi2pdf", engine = engine) } outputs <- c(outputs, output)}, error =
function(e) { thisOK <<- FALSE fails <<- c(fails, file)
message(gettextf("Error: processing vignette '%s' failed with
diagnostics:\n%s", file, conditionMessage(e)))})

#> 32: tools:::buildVignettes(dir =
"/export/home/XvmX59V/rminizinc.Rcheck/vign_test/rminizinc", ser_elibs =
"/export/home/XvmX59V/Rtemp/RtmpFgaaxZ/file66b85b0113ad.rds")

#> An irrecoverable exception occurred. R is aborting now ...


I think this warning is coming because of the compiler 'Oracle Developer
Studio 12.6' and I
was not getting this warning

Re: [R-pkg-devel] R CMD check warning on Solaris

2020-12-15 Thread Duncan Murdoch

On 15/12/2020 4:37 p.m., Akshit Achara wrote:

Hey everyone,

I have created a package rminizinc
 which is available on CRAN.
I had issues in
my configure script as it was only supporting Linux, OSX and Windows and not
other Unix like OS. I was able to resolve that issue.

I tested my package on R-hub on Oracle Solaris 10, x86, 32 bit, R-release,
Oracle Developer Studio 12.6
and got this warning :

#> Error(s) in re-building vignettes:

#> --- re-building ‘R_MiniZinc.Rmd’ using rmarkdown

#> Warning in engine$weave(file, quiet = quiet, encoding = enc) :

#> Pandoc (>= 1.12.3) and/or pandoc-citeproc not available. Falling back to
R Markdown v1.

#> *** caught segfault ***

#> address 0, cause 'memory not mapped'

#> Traceback:

#> 1: rminizinc:::mzn_parse(mzn_path = mzn_path)

#> 2: eval(expr, envir, enclos)

#> 3: eval(expr, envir, enclos)

#> 4: withVisible(eval(expr, envir, enclos))

#> 5: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning =
wHandler, error = eHandler, message = mHandler)

#> 6: doTryCatch(return(expr), name, parentenv, handler)

#> 7: tryCatchOne(expr, names, parentenv, handlers[[1L]])

#> 8: tryCatchList(expr, classes, parentenv, handlers)

#> 9: tryCatch(expr, error = function(e) { call <- conditionCall(e) if
(!is.null(call)) { if (identical(call[[1L]], quote(doTryCatch))) call <-
sys.call(-4L) dcall <- deparse(call)[1L] prefix <- paste("Error in", dcall,
": ") LONG <- 75L sm <- strsplit(conditionMessage(e), "\n")[[1L]] w <- 14L
+ nchar(dcall, type = "w") + nchar(sm[1L], type = "w") if (is.na(w)) w <-
14L + nchar(dcall, type = "b") + nchar(sm[1L], type = "b") if (w > LONG)
prefix <- paste0(prefix, "\n ") } else prefix <- "Error : " msg <-
paste0(prefix, conditionMessage(e), "\n") .Internal(seterrmessage(msg[1L]))
if (!silent && isTRUE(getOption("show.error.messages"))) { cat(msg, file =
outFile) .Internal(printDeferredWarnings()) } invisible(structure(msg,
class = "try-error", condition = e))})

#> 10: try(f, silent = TRUE)

#> 11: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir,
enclos)), warning = wHandler, error = eHandler, message = mHandler))

#> 12: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr,
envir, enclos)), warning = wHandler, error = eHandler, message = mHandler)))

#> 13: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos,
debug = debug, last = i == length(out), use_try = stop_on_error != 2L,
keep_warning = keep_warning, keep_message = keep_message, output_handler =
output_handler, include_timing = include_timing)

#> 14: evaluate::evaluate(...)

#> 15: evaluate(code, envir = env, new_device = FALSE, keep_warning =
!isFALSE(options$warning), keep_message = !isFALSE(options$message),
stop_on_error = if (options$error && options$include) 0L else 2L,
output_handler = knit_handlers(options$render, options))

#> 16: in_dir(input_dir(), evaluate(code, envir = env, new_device = FALSE,
keep_warning = !isFALSE(options$warning), keep_message =
!isFALSE(options$message), stop_on_error = if (options$error &&
options$include) 0L else 2L, output_handler = knit_handlers(options$render,
options)))

#> 17: block_exec(params)

#> 18: call_block(x)

#> 19: process_group.block(group)

#> 20: process_group(group)

#> 21: withCallingHandlers(if (tangle) process_tangle(group) else
process_group(group), error = function(e) { setwd(wd) cat(res, sep = "\n",
file = output %n% "") message("Quitting from lines ",
paste(current_lines(i), collapse = "-"), " (", knit_concord$get("infile"),
") ") })

#> 22: process_file(text, output)

#> 23: knit(input, text = text, envir = envir, quiet = quiet)

#> 24: knit2html(..., force_v1 = TRUE)

#> 25: (if (grepl("\\.[Rr]md$", file)) knit2html_v1 else if
(grepl("\\.[Rr]rst$", file)) knit2pandoc else knit)(file, encoding =
encoding, quiet = quiet, envir = globalenv(), ...)

#> 26: vweave(...)

#> 27: engine$weave(file, quiet = quiet, encoding = enc)

#> 28: doTryCatch(return(expr), name, parentenv, handler)

#> 29: tryCatchOne(expr, names, parentenv, handlers[[1L]])

#> 30: tryCatchList(expr, classes, parentenv, handlers)

#> 31: tryCatch({ engine$weave(file, quiet = quiet, encoding = enc)
setwd(startdir) output <- find_vignette_product(name, by = "weave", engine
= engine) if (!have.makefile && vignette_is_tex(output)) { texi2pdf(file =
output, clean = FALSE, quiet = quiet) output <- find_vignette_product(name,
by = "texi2pdf", engine = engine) } outputs <- c(outputs, output)}, error =
function(e) { thisOK <<- FALSE fails <<- c(fails, file)
message(gettextf("Error: processing vignette '%s' failed with
diagnostics:\n%s", file, conditionMessage(e)))})

#> 32: tools:::buildVignettes(dir =
"/export/home/XvmX59V/rminizinc.Rcheck/vign_test/rminizinc", ser_elibs =
"/export/home/XvmX59V/Rtemp/RtmpFgaaxZ/file66b85b0113ad.rds")

#> An irrecoverable exception occurred. R is aborting now ...


I think this warning is coming because of the compiler 'Oracle Developer