Skip to content

Cmake install#11

Closed
sn248 wants to merge 149 commits intomasterfrom
cmake-install
Closed

Cmake install#11
sn248 wants to merge 149 commits intomasterfrom
cmake-install

Conversation

@sn248
Copy link
Copy Markdown
Owner

@sn248 sn248 commented Mar 30, 2026

No description provided.

sn248 and others added 30 commits November 6, 2017 22:42
First argument now can be a time vector, Rcppcvode_str now is cvode.
Renamed sundials_test.cpp to cvode.cpp
Package works with 3.4.2 version
cvode.cpp now returns a data frame and absolute tolerance can be a
scalar also
Sundials v3.1.0 introduced changes such as sunmatrix and sunlinsol
header files. This version changes the cvode to be compliant with those
changes.
Based on PKG_CPPFILES - moving check_flag.h from /inst to /inst/include
and removing the file checkflag.h from src
This package compiles on OS X, the same Makevars is copied to
Makevars.win - to check if this compiles on Windows
With this fix, the package compiles for Windows and macOS/Linux.
Cvode_test to integrate functions defined using rcpp only
Testing build on appveyor
Adding badge from appveyor -> settings -> badges
Removed the old cvode, and converted cvode_test to cvode. Removed all extra code and completed the vignette.
Version which was submitted to CRAN
Added contributors from SUNDIALS to Description and changed the license to GPL (>=2). Removed the MIT license file.
Changed the description based on feedback from SUNDIALS and CRAN members
Author@R changed to Authors@R
added /inst/examples/ and referred to it in cvode documentation
NV_Ith_S macro is not working on Windows. Replaced it with accessing via N_VGetArrayPointer
There is no need to have ydot as an input in the RHS function. Removed it.
Removed all the extraneous comments, solution is matching with example output and a message is displayed on attaching the package
This version contains files generated in cmake using int32_t option.
Hilari C Tiedeman - spelling was corrected.
Removed $(info ...) from the Makevars/.win to fix Solaris compilation issue
The model equations can now be written in R and Rcpp. Removed the xptr - changes in vignette and example file.
sn248 and others added 29 commits December 13, 2024 13:03
updated configure.ac to remove CR and CRLF
removing CR and CRLF
CR and CRLF line endings in configure.ac
To prevent auto-conversion of line endings to CRLF
To prevent auto-conversion of line endings to CRLF
trying to remove CRLF or CR from files
Download sundials source files during installation
Fix CRAN badge
GNU Make in SystemRequirements changed to cmake
CRAN submission version 0.1.6.1
See the changes suggested at #9
…11, bashism, Makevars

This commit resolves the issues that caused sundialr to be archived from CRAN
on 2025-05-12 ("issues were not corrected despite reminders"). All changes are
aimed at satisfying "Writing R Extensions" §1.6.4 and the associated R CMD
check --as-cran requirements.

--- R CMD check improvements ---

Before: 1 ERROR, 3 WARNINGs, 7 NOTEs
After:  1 ERROR*, 2 WARNINGs*, 4 NOTEs*

  * ERROR and PDF WARNING are a local LaTeX environment issue (missing
    inconsolata.sty), not a package defect.
  * Remaining WARNINGs/NOTEs are either version-number metadata or system-
    specific flags injected by the Ubuntu R build; they will not appear on
    CRAN check servers.

--- SUNDIALS source patches (applied at build time in tools/cmake_call.sh) ---

CRAN policy forbids compiled code from calling abort() or writing directly to
stdout/stderr. Five SUNDIALS 7.1.1 source files are patched via sed after the
tarball is extracted, before cmake compiles them:

  src/sundials/sundials_errors.c
    - SUNAbortErrHandlerFn: removed abort() call. Fatal errors are now handled
      by the R error handler registered via SUNContext_PushErrHandler() (see
      inst/include/sundials_err_handler.h). The abort() path is unreachable at
      runtime because our handler is pushed on top of the handler stack.
    - SUNGlobalFallbackErrHandler: removed two fprintf(stderr, ...) calls that
      wrote directly to stderr when the SUNContext itself was NULL/corrupt.

  src/sundials/sundials_logger.c
    - SUNLogger_Create: changed default logger->error_fp from stderr to NULL
      and logger->warning_fp from stdout to NULL. With SUNDIALS_LOGGING_LEVEL=0
      these handles are never used, but assigning them referenced the symbols.
    - sunCloseLogFile: removed fp != stdout and fp != stderr comparisons;
      replaced with a plain NULL check (safe since fps are now initialised to
      NULL above).
    - Removed fprintf(stderr, "[FATAL LOGGER ERROR] ...") call that fired when
      log message allocation failed.

  src/sundials/sundials_futils.c
    - SUNDIALSFileOpen: removed the "stdout" and "stderr" filename-to-FILE*
      mappings. Callers that previously passed "stdout" or "stderr" as a
      filename will now receive NULL (no output), which is harmless because
      sundialr never calls this function directly.
    - SUNDIALSFileClose: removed the fp != stdout / fp != stderr guards before
      fclose(); replaced with a plain fp != NULL check.

  src/sundials/sundials_nvector.c
    - N_VPrint: removed two printf("NULL...\n") debug messages. GCC -O2
      optimises printf("literal\n") → puts("literal"), which CRAN flags as a
      puts() reference in libsundials_core.a.

  src/nvector/serial/nvector_serial.c
    - N_VPrint_Serial: removed the direct N_VPrintFile_Serial(x, stdout) call,
      which placed an explicit stdout reference in libsundials_nvecserial.a (and
      in libsundials_cvodes.a and libsundials_idas.a, which archive the serial
      nvector object). Users who need to print a vector can call
      N_VPrintFile_Serial() with an explicit FILE* handle.

cmake flag added to tools/cmake_call.sh:
  -D SUNDIALS_LOGGING_LEVEL=0  (disables compile-time logging; guards all
    SUNLogger_QueueMsg bodies with #if SUNDIALS_LOGGING_LEVEL > 0)

--- R error handler (new file) ---

  inst/include/sundials_err_handler.h
    Defines sundials_r_err_handler(), a SUNErrHandlerFn that routes SUNDIALS
    fatal errors to Rf_error() instead of abort(). Included in all four solver
    translation units (cvode.cpp, cvodes.cpp, ida.cpp, cvsolve.cpp) and
    registered immediately after SUNContext_Create() via
    SUNContext_PushErrHandler().

--- Other CRAN NOTEs fixed ---

  src/Makevars.in, src/Makevars
    Removed CXX_STD = CXX11. Modern R defaults to C++17; CRAN now flags an
    explicit C++11 request as unnecessary.

  configure.ac (line 24)
    Changed == to = in the shell test expression. Double-equals is a bashism;
    POSIX sh requires single =.

  cleanup
    Fixed rm -f Makevars → rm -f src/Makevars. The old path never removed the
    configure-generated src/Makevars, so R CMD build included both Makevars and
    Makevars.in in the tarball, triggering a NOTE about ambiguous Makevars.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…dials_logger.c

The sed pattern for patching the fprintf(stderr,...) in sundials_logger.c was wrong:
it matched "[FATAL LOGGER ERROR]" at the start of the format string, but the actual
code has "[ERROR][rank %d]..." as the format string with "FATAL LOGGER ERROR" as an
argument on the continuation line. The patch silently failed, leaving the stderr
symbol in libsundials_core.a.

Replace the broken sed with a Python regex that correctly handles the multi-line
fprintf call. Also fix the committed copy of sundials_logger.c directly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sn248 sn248 closed this Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants