From 52d2034feeb60ceacc86014ffef8c6bc080c4375 Mon Sep 17 00:00:00 2001 From: sciome-bot Date: Tue, 12 Nov 2024 11:22:27 -0500 Subject: [PATCH 1/8] Fix path to cmake install script --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 0acbc29..9eb77a1 100755 --- a/configure +++ b/configure @@ -3495,7 +3495,7 @@ fi if test x"${have_cmake}" == x"no"; then - . src/cmake_install.sh + . src/scripts/cmake_install.sh if test -z "${CMAKE_BIN}"; then ## also error to end configure here as_fn_error $? "Could not find 'cmake'." "$LINENO" 5 From 90081e402b82bba5cf83a284dc44c08674e04ca9 Mon Sep 17 00:00:00 2001 From: sciome-bot Date: Tue, 12 Nov 2024 11:33:53 -0500 Subject: [PATCH 2/8] Remove gfortran link --- src/Makevars.in | 2 +- src/Makevars.ucrt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Makevars.in b/src/Makevars.in index 165fcba..24d9bde 100644 --- a/src/Makevars.in +++ b/src/Makevars.in @@ -1,5 +1,5 @@ PKG_CXXFLAGS=-I./code_base -I./include @OSFLAG@ @OPENMP@ @NLOPT_CPPFLAGS@ @GSL_CPPFLAGS@ -DR_COMPILATION -DNO_OMP -DEIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS -PKG_LIBS=$(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) @NLOPT_LIBS@ @GSL_LIBS@ @OPENMP@ -lgfortran +PKG_LIBS=$(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) @NLOPT_LIBS@ @GSL_LIBS@ @OPENMP@ # Debug / clear eigen warnings from compilation #PKG_CXXFLAGS+=-Wno-ignored-attributes -DToxicR_DEBUG diff --git a/src/Makevars.ucrt b/src/Makevars.ucrt index 71827ed..32cd510 100644 --- a/src/Makevars.ucrt +++ b/src/Makevars.ucrt @@ -1,5 +1,5 @@ PKG_CXXFLAGS=-I./code_base -I./include @OSFLAG@ $(SHLIB_OPENMP_CXXFLAGS) -I$(R_TOOLS_SOFT)/include/nlopt -I$(R_TOOLS_SOFT)/include/gsl -DR_COMPILATION -ftree-vectorize -Os -DNO_OMP -DEIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS -PKG_LIBS=$(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CXXFLAGS) -lgsl -lgslcblas -lnlopt -lgfortran +PKG_LIBS=$(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CXXFLAGS) -lgsl -lgslcblas -lnlopt # Debug / clear eigen warnings from compilation #PKG_CXXFLAGS+=-Wno-ignored-attributes -DToxicR_DEBUG From 439e7c5db096bb1372313b6bcfe04fe552011f81 Mon Sep 17 00:00:00 2001 From: sciome-bot Date: Tue, 12 Nov 2024 11:39:06 -0500 Subject: [PATCH 3/8] Fix compiler directive logic --- src/include/cBMDstatmod.h | 2 +- src/include/statmod.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/include/cBMDstatmod.h b/src/include/cBMDstatmod.h index 98de2d6..ed9e836 100644 --- a/src/include/cBMDstatmod.h +++ b/src/include/cBMDstatmod.h @@ -609,7 +609,7 @@ optimizationResult cfindMAX_W_BOUND(cBMDModel *M, Eigen::MatrixXd start, // flush(file); good_opt = true; // opt_iter++; -#ifdef _WIN32 || defined(__APPLE__) +#if defined(_WIN32) || defined(__APPLE__) } catch (nlopt::roundoff_limited &exc) { good_opt = false; DEBUG_LOG(file, "opt_iter= " << opt_iter << ", error: roundoff_limited"); diff --git a/src/include/statmod.h b/src/include/statmod.h index db539ae..73cb084 100644 --- a/src/include/statmod.h +++ b/src/include/statmod.h @@ -780,7 +780,7 @@ optimizationResult findMAP(statModel *M, Eigen::MatrixXd startV, } // catch -#ifdef _WIN32 || defined(__APPLE__) +#if defined(_WIN32) || defined(__APPLE__) catch (nlopt::roundoff_limited &exce) { DEBUG_LOG(file, "opt_iter= " << opt_iter << ", error: roundoff_limited"); // Rcpp::Rcout << "Roundoff_limited nlopt: " << exce.what() << From acbfcd55d9eddf0e3feb7db722f507a15b369c9f Mon Sep 17 00:00:00 2001 From: sciome-bot Date: Tue, 12 Nov 2024 11:42:25 -0500 Subject: [PATCH 4/8] Remove linker OSFLAG --- src/Makevars.in | 2 +- src/Makevars.ucrt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Makevars.in b/src/Makevars.in index 24d9bde..ffc7731 100644 --- a/src/Makevars.in +++ b/src/Makevars.in @@ -1,4 +1,4 @@ -PKG_CXXFLAGS=-I./code_base -I./include @OSFLAG@ @OPENMP@ @NLOPT_CPPFLAGS@ @GSL_CPPFLAGS@ -DR_COMPILATION -DNO_OMP -DEIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS +PKG_CXXFLAGS=-I./code_base -I./include @OPENMP@ @NLOPT_CPPFLAGS@ @GSL_CPPFLAGS@ -DR_COMPILATION -DNO_OMP -DEIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS PKG_LIBS=$(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) @NLOPT_LIBS@ @GSL_LIBS@ @OPENMP@ # Debug / clear eigen warnings from compilation diff --git a/src/Makevars.ucrt b/src/Makevars.ucrt index 32cd510..44ff697 100644 --- a/src/Makevars.ucrt +++ b/src/Makevars.ucrt @@ -1,4 +1,4 @@ -PKG_CXXFLAGS=-I./code_base -I./include @OSFLAG@ $(SHLIB_OPENMP_CXXFLAGS) -I$(R_TOOLS_SOFT)/include/nlopt -I$(R_TOOLS_SOFT)/include/gsl -DR_COMPILATION -ftree-vectorize -Os -DNO_OMP -DEIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS +PKG_CXXFLAGS=-I./code_base -I./include $(SHLIB_OPENMP_CXXFLAGS) -I$(R_TOOLS_SOFT)/include/nlopt -I$(R_TOOLS_SOFT)/include/gsl -DR_COMPILATION -ftree-vectorize -Os -DNO_OMP -DEIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS PKG_LIBS=$(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CXXFLAGS) -lgsl -lgslcblas -lnlopt # Debug / clear eigen warnings from compilation #PKG_CXXFLAGS+=-Wno-ignored-attributes -DToxicR_DEBUG From f0eeed252f65a2d8f340b28a0e4cbaadcbaaaed0 Mon Sep 17 00:00:00 2001 From: sciome-bot Date: Tue, 12 Nov 2024 11:55:17 -0500 Subject: [PATCH 5/8] Add missing compiler directive for Mac/Windows --- src/include/cBMDstatmod.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/include/cBMDstatmod.h b/src/include/cBMDstatmod.h index ed9e836..39e80a3 100644 --- a/src/include/cBMDstatmod.h +++ b/src/include/cBMDstatmod.h @@ -378,9 +378,13 @@ optimizationResult cfindMAX_W_EQUALITY(cBMDModel *M, try { result = opt.optimize(x, minf); good_opt = true; + #if defined(_WIN32) || defined(__APPLE__) } catch (nlopt::roundoff_limited2 &exc) { good_opt = false; - // cout << "Error Round off" << endl; + #else + } catch (nlopt::roundoff_limited &exc) { + good_opt = false; + #endif } catch (nlopt::forced_stop &exc) { good_opt = false; // cout << "Error Forced stop" << endl; From d6c484a176c371c0824f82ff120ccf282349562b Mon Sep 17 00:00:00 2001 From: sciome-bot Date: Tue, 12 Nov 2024 11:57:22 -0500 Subject: [PATCH 6/8] Update version number and date --- CHANGELOG.md | 4 ++-- DESCRIPTION | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 751f319..1a798b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changes -## Version 23.10.1.3 -## The following cumulative fixes are in version 23.10.1.3 +## Version 23.10.1.4 +## The following cumulative fixes are in version 23.10.1.4 - Modify nlopt to avoid issues with LLVM-clang incompatibilities - Disable OpenMP temporarily to get approved for CRAN ## Version 23.10.1.2.4 diff --git a/DESCRIPTION b/DESCRIPTION index 5e4ab8b..65b873a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: ToxicR Type: Package Title: Analyzing Toxicology Dose-Response Data -Version: 24.1.1.4 -Date: 2024-08-24 +Version: 23.10.1.4 +Date: 2024-11-12 Authors@R: c( person(given = "Matt", From 6ba478244841025eeb3be931166556c9752ba786 Mon Sep 17 00:00:00 2001 From: sciome-bot Date: Tue, 12 Nov 2024 13:05:20 -0500 Subject: [PATCH 7/8] add mvtnorm and fix compiler directive logic --- DESCRIPTION | 3 ++- src/include/cBMDstatmod.h | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 65b873a..7b20c88 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -75,7 +75,8 @@ URL: https://github.com/NIEHS/ToxicR LazyData: true Imports: Rcpp (>= 1.0.0), ggplot2 (>= 3.3.2), shiny (>= 1.5.0), coda (>= 0.19-4), scales (>= 1.1.1), forcats, ggridges (>= 0.5.3), - doBy (>= 4.6.11), multcomp (>= 1.4), dplyr (>= 1.0.7), remotes + doBy (>= 4.6.11), multcomp (>= 1.4), dplyr (>= 1.0.7), remotes, + mvtnorm LinkingTo: Rcpp, RcppEigen, RcppGSL RoxygenNote: 7.3.2 Encoding: UTF-8 diff --git a/src/include/cBMDstatmod.h b/src/include/cBMDstatmod.h index 39e80a3..1efed30 100644 --- a/src/include/cBMDstatmod.h +++ b/src/include/cBMDstatmod.h @@ -379,10 +379,10 @@ optimizationResult cfindMAX_W_EQUALITY(cBMDModel *M, result = opt.optimize(x, minf); good_opt = true; #if defined(_WIN32) || defined(__APPLE__) - } catch (nlopt::roundoff_limited2 &exc) { + } catch (nlopt::roundoff_limited &exc) { good_opt = false; #else - } catch (nlopt::roundoff_limited &exc) { + } catch (nlopt::roundoff_limited2 &exc) { good_opt = false; #endif } catch (nlopt::forced_stop &exc) { From cff0660e6be899c5a3e3291b7c984659ae9953a8 Mon Sep 17 00:00:00 2001 From: sciome-bot Date: Tue, 12 Nov 2024 14:06:35 -0500 Subject: [PATCH 8/8] Updated configure.ac --- configure.ac | 43 +++++++++++++++++-------------------------- 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/configure.ac b/configure.ac index 6202359..e486c60 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,5 @@ # Configure Script for ToxicR # Modified 4/27/2022 -# Configure Script for ToxicR -# Modified 4/27/2022 AC_INIT([ToxicR], 1.0.1) dnl Package version @@ -11,15 +9,21 @@ CPPFLAGS=`"${R_HOME}/bin/R" CMD config CPPFLAGS` AC_LANG(C++) AC_PROG_CPP -#determine the OS -AC_MSG_CHECKING([Is OPENMP avaialble? ]) +# Determine the OS +AC_MSG_CHECKING([Is OPENMP available?]) OS_FLAG="$(uname)" -if test x"${OS_FLAG}" == x"Darwin";then +if test x"${OS_FLAG}" == x"Darwin"; then AC_MSG_RESULT([no]) OPENMP="-DNO_OMP" + OSFLAG="-D__APPLE__" +elif test x"${OS_FLAG}" == x"Linux"; then + AC_MSG_RESULT([yes]) + OPENMP="\$(SHLIB_OPENMP_CXXFLAGS)" + OSFLAG="" else AC_MSG_RESULT([yes]) - OPENMP="\$(SHLIB_OPENMP_CXXFLAGS) " + OPENMP="\$(SHLIB_OPENMP_CXXFLAGS)" + OSFLAG="-D__WIN32" fi AC_PATH_PROG([GSL_CONFIG], [gsl-config]) @@ -35,14 +39,14 @@ else sudo apt install gsl To install GSL in Fedora Type: sudo yum -y install gsl - To iinstall GSL on macOS using homebrew type: + To install GSL on macOS using homebrew type: brew install gsl ]) fi ## Can we use pkg-config? AC_PATH_PROG(have_pkg_config, pkg-config, no) -AC_MSG_CHECKING([Is pkg-config avaialble? ]) +AC_MSG_CHECKING([Is pkg-config available?]) if test x"${have_pkg_config}" != x"no"; then AC_MSG_RESULT([yes]) AC_MSG_CHECKING([if pkg-config knows NLopt]) @@ -58,24 +62,12 @@ if test x"${have_pkg_config}" != x"no"; then AC_SUBST([NLOPT_LIBS], "${nlopt_libs}") else AC_MSG_RESULT([no]) - #if it is macOS just try link and use nlopt generically - need_to_build="yes" + need_to_build="yes" fi else AC_MSG_RESULT([no]) - #if it is macOS just try link and use nlopt generically - if test x"${OS_FLAG}" == x"Darwin";then - AC_MSG_RESULT([>= 2.6.0]) - nlopt_include="" - nlopt_libs="-lnlopt" - AC_SUBST([NLOPT_INCLUDE], "${nlopt_include}") - AC_SUBST([NLOPT_LIBS], "${nlopt_libs}") - else - need_to_build="yes" - fi - + need_to_build="yes" fi - else AC_MSG_RESULT([no]) need_to_build="yes" @@ -85,14 +77,12 @@ fi if test x"${need_to_build}" != x"no"; then AC_PATH_PROG(have_cmake, cmake, no) - if test x"${have_cmake}" == x"no"; then - . src/scripts/cmake_config.sh + if test x"${have_cmake}" == x"no"; then + . src/scripts/cmake_install.sh if test -z "${CMAKE_BIN}"; then ## also error to end configure here AC_MSG_ERROR([Could not find 'cmake'.]) fi - else - . src/scripts/cmake_install.sh fi ## 'uname -m' on M1 give x86_64 which is ... not helping machine=`"${R_HOME}/bin/Rscript" -e 'cat(Sys.info()[["machine"]])'` @@ -107,6 +97,7 @@ SUBDIR_SOURCES="$(cd src/ && ls {code_base,polyK}/*.cpp | tr '\n' ' ')" SRC_SOURCES="$( cd src/ && ls *.cpp | tr '\n' ' ')" AC_SUBST(OPENMP) +AC_SUBST(OSFLAG) AC_SUBST(SRC_SOURCES) AC_SUBST(SUBDIR_SOURCES) AC_SUBST([NLOPT_CPPFLAGS],["${nlopt_include}"])