nlmixrdevelopment / nlmixr

nlmixr: an R package for population PKPD modeling
https://nlmixrdevelopment.github.io/nlmixr/
GNU General Public License v2.0
115 stars 45 forks source link

Can't successfully install nlmixr on mac #225

Closed Cyprian95 closed 5 years ago

Cyprian95 commented 5 years ago

Hello

I have tried reinstalling nlmixr on my device, since initially the installed version was failing to generate vpc plots. I have recently tried reinstalling with a more updated version of R (version 3.6.0), and managed to get in the installation to the stage of running “library(RxODE); rxTest();” without any major issues:

results test rx

Results ══════════════════════════════════════════════════════ Duration: 3980.9 s OK: 5202 Failed: 1 Warnings: 3 Skipped: 3

However, proceeding to install nlmixr, it couldn’t move forward because of a warning message “nlmixr not available for R version 3.6.0. Thus, I reinstalled everything step by step as instructed on your github page (with R 3.5.2), but now there seems to be some compilation issues, whenever trying to install the nlmixr package. For some of my attempts, I was ending up with this error:

ode_cmt1.cpp:7:10: fatal error: 'stan/math/rev/core.hpp' file not found

include <stan/math/rev/core.hpp>

Also, I am not quite sure how to allow for python3 to be used by nlmixr. During the time it worked (without vpc), it used python 2.7. I did modify the R.profile file in order for it to recognize the newer version but to no avail.

I have also tried installing Rcpp (and all related files e.g. RccpEigen) separately within R via install.packages() command. Additionally, I’ve installed Eigen through brew (all of these steps were following a series of tries on a normal process of installation, all rendering exactly the same result). I even reinstalled brew and will attempt reinstalling XCode if nothing else helps.

If I could facilitate by providing some additional info, I'll gladly do it.

If anyone has been using nlmixr with R 3.6.0 on Mac without any issues and could instruct me on how to remove any files that could have altered compilation, I would be extremely grateful!

Additional info on the session, SnakeCharmR etc:

library(devtools) Loading required package: usethis library(RxODE) library(SnakeCharmR) SnakeCharmR 1.0.7.1 - R and Python Integration Contribute and submit issues at https://github.com/asieira/SnakeCharmR Python version 2.7.10 (default, Feb 22 2019, 21:55:15) [GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.37.14)]

githubinstall::githubinstall("nlmixrdevelopment/nlmixr")

Suggestion:

  • nlmixrdevelopment/nlmixr Do you want to install the package (Y/n)? y Downloading GitHub repo nlmixrdevelopment/nlmixr@master Your system is ready to build packages! ✔ checking for file ‘/private/var/folders/c6/sxn57gws03d4_0r_5jr_kz9c0000gn/T/RtmpNr1qDb/remotes4671e9c74da/nlmixrdevelopment-nlmixr-9f79e94/DESCRIPTION’ ... ─ preparing ‘nlmixr’: ✔ checking DESCRIPTION meta-information ... ─ cleaning src ─ running ‘cleanup’ ─ checking for LF line-endings in source and make files and shell scripts ─ checking for empty or unneeded directories Removed empty directory ‘nlmixr/build’ Removed empty directory ‘nlmixr/man-roxygen’ ─ looking to see if a ‘data/datalist’ file should be added ─ building ‘nlmixr_1.1.1-1.tar.gz’

[1] TRUE

  • installing source package ‘nlmixr’ ... checking for gcc... clang checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether clang accepts -g... yes checking for clang option to accept ISO C89... none needed checking for clang option to support OpenMP... -fopenmp checking whether OpenMP will work in a package... yes configure: creating ./config.status config.status: creating src/Makevars

--------[begin src/Makevars]--------

-- mode: makefile-gmake --

ARMA="$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e 'cat(file.path(find.package("RcppArmadillo"),"include"))' BH="$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e 'cat(file.path(find.package("BH"),"include"))' RCPP="$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e 'cat(file.path(find.package("Rcpp"),"include"))' EG="$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e 'cat(file.path(find.package("RcppEigen"),"include"))' SH="$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e 'cat(file.path(find.package("StanHeaders"),"include"))'

CXX_STD = CXX14

PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) PKG_CXXFLAGS = -Id -I../inst/include -DBOOST_DISABLE_ASSERTS -isystem"$(BH)" -isystem"$(EG)" -isystem"$(SH)" -isystem"$(RCPP)" -isystem"$(ARMA)" SHLIB_LDFLAGS = $(SHLIB_CXXLDFLAGS) SHLIB_LD = $(SHLIB_CXXLD) SOURCES_C = jj.c jj.g.d_parser.c init.c rprintf.c merge3.c lbfgsR.c SOURCES_CPP = neldermead.cpp slice.cpp RcppExportMod.cpp ode_cmt1.cpp RcppExports.cpp resid.cpp inner.cpp saem.cpp OBJECTS = $(SOURCES_C:.c=.o) $(SOURCES_CPP:.cpp=.o) all: $(SHLIB) $(SHLIB): $(OBJECTS)

--------[end src/Makevars]-------- ** libs clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/dparser/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RxODE/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/lbfgsb3c/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I/usr/local/include -fPIC -Wall -g -O2 -c jj.c -o jj.o

[…this carries out clang scripts until]:

clang++ -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/dparser/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RxODE/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/lbfgsb3c/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I/usr/local/include -Id -I../inst/include -DBOOST_DISABLE_ASSERTS -isystem""/Library/Frameworks/R.framework/Resources/bin/Rscript" -e 'cat(file.path(find.package("BH"),"include"))'" -isystem""/Library/Frameworks/R.framework/Resources/bin/Rscript" -e 'cat(file.path(find.package("RcppEigen"),"include"))'" -isystem""/Library/Frameworks/R.framework/Resources/bin/Rscript" -e 'cat(file.path(find.package("StanHeaders"),"include"))'" -isystem""/Library/Frameworks/R.framework/Resources/bin/Rscript" -e 'cat(file.path(find.package("Rcpp"),"include"))'" -isystem""/Library/Frameworks/R.framework/Resources/bin/Rscript" -e 'cat(file.path(find.package("RcppArmadillo"),"include"))'" -fPIC -Wall -g -O2 -c RcppExportMod.cpp -o RcppExportMod.o

In file included from RcppExportMod.cpp:1: In file included from ./../inst/include/nlmixr_types.h:4: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:1: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Core:535: /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

pragma clang diagnostic pop

[17 OF THEM IN TOTAL]

In file included from RcppExportMod.cpp:1: In file included from ./../inst/include/nlmixr_types.h:4: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:40: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/unsupported/Eigen/SparseExtra:51: /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/unsupported/Eigen/../../Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

#pragma clang diagnostic pop

                         ^

17 warnings generated.

clang++ -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/dparser/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RxODE/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/lbfgsb3c/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I/usr/local/include -Id -I../inst/include -DBOOST_DISABLE_ASSERTS -isystem""/Library/Frameworks/R.framework/Resources/bin/Rscript" -e 'cat(file.path(find.package("BH"),"include"))'" -isystem""/Library/Frameworks/R.framework/Resources/bin/Rscript" -e 'cat(file.path(find.package("RcppEigen"),"include"))'" -isystem""/Library/Frameworks/R.framework/Resources/bin/Rscript" -e 'cat(file.path(find.package("StanHeaders"),"include"))'" -isystem""/Library/Frameworks/R.framework/Resources/bin/Rscript" -e 'cat(file.path(find.package("Rcpp"),"include"))'" -isystem""/Library/Frameworks/R.framework/Resources/bin/Rscript" -e 'cat(file.path(find.package("RcppArmadillo"),"include"))'" -fPIC -Wall -g -O2 -c ode_cmt1.cpp -o ode_cmt1.o

In file included from ode_cmt1.cpp:1: In file included from ./../inst/include/nlmixr_types.h:4: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:30: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:1: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Core:535: /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

#pragma clang diagnostic pop

[AGAIN 17 OF THEM]

In file included from ode_cmt1.cpp:1: In file included from ./../inst/include/nlmixr_types.h:4: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigen.h:25: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/RcppEigenForward.h:40: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/unsupported/Eigen/SparseExtra:51: /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/unsupported/Eigen/../../Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]

pragma clang diagnostic pop

                         ^

ode_cmt1.cpp:7:10: fatal error: 'stan/math/rev/core.hpp' file not found

include <stan/math/rev/core.hpp>

     ^~~~~~~~~~~~~~~~~~~~~~~~

17 warnings and 1 error generated. make: *** [ode_cmt1.o] Error 1 ERROR: compilation failed for package ‘nlmixr’

  • removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/nlmixr’ Error: Failed to install 'nlmixr' from GitHub: (converted from warning) installation of package ‘/var/folders/c6/sxn57gws03d4_0r_5jr_kz9c0000gn/T//RtmpNr1qDb/file4676b5194dc/nlmixr_1.1.1-1.tar.gz’ had non-zero exit status

In addition: Warning message: In fread(download_url, sep = "\t", header = FALSE, stringsAsFactors = FALSE,

Found and resolved improper quoting out-of-sample. First healed line 4848: <<Puriney honfleuR "Evening, honfleuR" by Seurat>>. If the fields are not quoted (e.g. field separator does not appear within any field), try quote="" to avoid this warning.

Lastly: A bit about my session:

sessionInfo() R version 3.5.2 (2018-12-20) Platform: x86_64-apple-darwin15.6.0 (64-bit) Running under: macOS Mojave 10.14.6

Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib

LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale: [1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages: [1] stats graphics grDevices datasets utils methods base

other attached packages: [1] SnakeCharmR_1.0.7.1 RxODE_0.9.1-3 devtools_2.1.0 usethis_1.5.1

loaded via a namespace (and not attached): [1] tidyselect_0.2.5 remotes_2.1.0 rematch2_2.1.0 purrr_0.3.2 vctrs_0.2.0 colorspace_1.4-1 cranlike_1.0.2

[8] testthat_2.2.1 crancache_0.0.0.9001 blob_1.2.0 rlang_0.4.0 pkgbuild_1.0.4 pillar_1.4.2 DBI_1.0.0

[15] glue_1.3.1 withr_2.1.2 rappdirs_0.3.1 tweenr_1.0.1 bit64_0.9-7 sessioninfo_1.1.1 stringr_1.4.0

[22] munsell_0.5.0 gtable_0.3.0 mvnfast_0.2.5 memoise_1.1.0 callr_3.3.1 ps_1.3.0 curl_4.0

[29] Rcpp_1.0.2 scales_1.0.0 backports_1.1.4 desc_1.2.0 pkgload_1.0.2 debugme_1.1.0 jsonlite_1.6

[36] bit_1.1-14 farver_1.1.0 fs_1.3.1 ggforce_0.3.0 ggplot2_3.2.1 digest_0.6.20 lotri_0.1.1

[43] stringi_1.4.3 parsedate_1.2.0 processx_3.4.1 dplyr_0.8.3 polyclip_1.10-0 grid_3.5.2 rprojroot_1.3-2

[50] cli_1.1.0 tools_3.5.2 magrittr_1.5 RSQLite_2.1.2 lazyeval_0.2.2 tibble_2.1.3 PreciseSums_0.3

[57] zeallot_0.1.0 crayon_1.3.4 githubinstall_0.2.2 pkgconfig_2.0.2 MASS_7.3-51.1 data.table_1.12.2 prettyunits_1.0.2

[64] assertthat_0.2.1 httr_1.4.1 rstudioapi_0.10 R6_2.4.0 units_0.6-3 compiler_3.5.2

Sys.getenv("PATH") [1] "/usr/local/clang6/bin:/usr/local/gfortran/bin:/usr/local/clang6/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/MacGPG2/bin:/opt/X11/bin" .libPaths() [1] "/Library/Frameworks/R.framework/Versions/3.5/Resources/library"

Kindly thanking in advance for all help provided!

mattfidler commented 5 years ago

Hi @Cyprian95 ,

The latest github version of nlmixr requires C++14. I haven't tried it on a mac yet. Let me try and update the instructions if I need to.

mattfidler commented 5 years ago

Hi @Cyprian95,

I think you simply need to add the C++14 configuration file:

# ~/.R/Makevars
CXX14FLAGS=-O2 -march=native -mtune=native -arch x86_64 -ftemplate-depth-256 -fPIC

For me, the instructions seemed to work just fine. I ran the theo_sd example with focei and saem and both seemed OK.

Cyprian95 commented 5 years ago

Hi @mattfidler, first of all, thank you very much for coming back to me. I have followed your suggestions and the updated instructions for mac. Unfortunately, the same issue still persists:

ode_cmt1.cpp:7:10: fatal error: 'stan/math/rev/core.hpp' file not found

include <stan/math/rev/core.hpp>

I have also additionally tried reinstalling R&R Studio with the removal of Library (containing all the packages), so had a fresh clean attempt at reinstallation. I removed R from applications and used the terminal commands:

rm -rf /Applications/R.app sudo rm -rf /Library/Frameworks/R.framework sudo rm /usr/bin/{R,Rscript}

My Makevars file was edited using:

file.edit(file.path("~/.R", "Makevars"))

and I have added the line as instructed. Below

sessionInfo() R version 3.6.1 (2019-07-05) Platform: x86_64-apple-darwin15.6.0 (64-bit) Running under: macOS Mojave 10.14.6

Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

Random number generation: RNG: Mersenne-Twister Normal: Inversion Sample: Rounding

locale: [1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages: [1] stats graphics grDevices datasets utils methods base

other attached packages: [1] devtools_2.1.0 usethis_1.5.1 RxODE_0.9.1-3 reticulate_1.13

loaded via a namespace (and not attached): [1] Rcpp_1.0.2 pillar_1.4.2 compiler_3.6.1 prettyunits_1.0.2 PreciseSums_0.3 remotes_2.1.0 tools_3.6.1
[8] testthat_2.2.1 pkgload_1.0.2 pkgbuild_1.0.4 mvnfast_0.2.5 digest_0.6.20 jsonlite_1.6 memoise_1.1.0
[15] tibble_2.1.3 gtable_0.3.0 lattice_0.20-38 pkgconfig_2.0.2 rlang_0.4.0 Matrix_1.2-17 cli_1.1.0
[22] rstudioapi_0.10 curl_4.0 withr_2.1.2 desc_1.2.0 fs_1.3.1 rprojroot_1.3-2 grid_3.6.1
[29] tidyselect_0.2.5 glue_1.3.1 R6_2.4.0 processx_3.4.1 sessioninfo_1.1.1 polyclip_1.10-0 callr_3.3.1
[36] ggplot2_3.2.1 purrr_0.3.2 tweenr_1.0.1 farver_1.1.0 magrittr_1.5 backports_1.1.4 ps_1.3.0
[43] scales_1.0.0 MASS_7.3-51.4 units_0.6-3 assertthat_0.2.1 ggforce_0.3.0 colorspace_1.4-1 lotri_0.1.1
[50] lazyeval_0.2.2 munsell_0.5.0 crayon_1.3.4

Sys.getenv("PATH") [1] "/usr/local/clang8/bin:/usr/local/gfortran/bin:/usr/local/clang6/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/MacGPG2/bin:/opt/X11/bin" .libPaths() [1] "/Library/Frameworks/R.framework/Versions/3.6/Resources/library"

Apart from sessionInfo(); Sys.getenv("PATH"); and .libPaths(), would anything else be helpful to solve this mystery?

mattfidler commented 5 years ago

What happens when you install the stan headers?

install.packages("StanHeaders")
Cyprian95 commented 5 years ago

install.packages("StanHeaders") Error in install.packages : Updating loaded packages

Restarting R session...

install.packages("StanHeaders") trying URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6/StanHeaders_2.18.1-10.tgz' Content type 'application/x-gzip' length 1492271 bytes (1.4 MB)

downloaded 1.4 MB

The downloaded binary packages are in /var/folders/c6/sxn57gws03d4_0r_5jr_kz9c0000gn/T//RtmpQYCX5Y/downloaded_packages

library("StanHeaders")

Cyprian95 commented 5 years ago

would you mind providing a full script for the Makevars file for the ~/.R location? Or could you confirm whether it is supposed to work only as being composed of a single line of code - aka the one that you've provided? I've encountered similar issues with RStan compilation on the web, being resolved, for instance, by substitution of -Wall with -W in the Makevars or Makeconfig scripts: https://discourse.mc-stan.org/t/suppressing-compiler-warnings-in-rstan/4910

This would not be applicable to Makevars with only the line you provided. As I have no previous experience with C++, I am not sure how to approach this compilation issue. Would you advise on modifying Makeconf file, similarily to your advice regarding Makevars, as well?

Below I'm providing the current state of Makeconfig file:

> # etc/Makeconf.  Generated from Makeconf.in by configure.
> #
> # ${R_HOME}/etc/Makeconf
> #
> # R was configured using the following call
> # (not including env. vars and site configuration)
> # configure  'CC=clang' 'CXX=clang++' 'OBJC=clang' 'CFLAGS=-Wall -g -O2' 'CPPFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include' 'CXXFLAGS=-Wall -g -O2' 'OBJCFLAGS=-Wall -g -O2' 'FCFLAGS=-Wall -g -O2' 'F77FLAGS=-Wall -g -O2' '--enable-memory-profiling' '--x-libraries=/opt/X11/lib' '--enable-R-framework' 'PKG_CONFIG_PATH=/usr/lib/pkgconfig:/opt/X11/lib/pkgconfig:/usr/local/lib/pkgconfig'
> 
> ## This fails if it contains spaces, or if it is quoted
> include $(R_SHARE_DIR)/make/vars.mk
> 
> AR = ar
> BLAS_LIBS = -L"$(R_HOME)/lib$(R_ARCH)" -lRblas
> C_VISIBILITY = 
> CC = clang
> CFLAGS = -Wall -g -O2 $(LTO)
> CPICFLAGS = -fPIC
> CPPFLAGS = -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include
> CXX = clang++ -std=gnu++11
> CXXCPP = $(CXX) -E
> CXXFLAGS = -Wall -g -O2 $(LTO)
> CXXPICFLAGS = -fPIC
> CXX98 = clang++
> CXX98FLAGS = -Wall -g -O2 $(LTO)
> CXX98PICFLAGS = -fPIC
> CXX98STD = -std=gnu++98
> CXX11 = clang++
> CXX11FLAGS = -Wall -g -O2 $(LTO)
> CXX11PICFLAGS = -fPIC
> CXX11STD = -std=gnu++11
> CXX14 = clang++
> CXX14FLAGS = -Wall -g -O2 $(LTO)
> CXX14PICFLAGS = -fPIC
> CXX14STD = -std=gnu++14
> CXX17 = clang++
> CXX17FLAGS = -Wall -g -O2 $(LTO)
> CXX17PICFLAGS = -fPIC
> CXX17STD = -std=gnu++17
> CXX_VISIBILITY = 
> DYLIB_EXT = .dylib
> DYLIB_LD = $(CC)
> DYLIB_LDFLAGS = -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -fopenmp# $(CFLAGS) $(CPICFLAGS)
> DYLIB_LINK = $(DYLIB_LD) $(DYLIB_LDFLAGS) $(LDFLAGS)
> ECHO = echo
> ECHO_C = \c
> ECHO_N = 
> ECHO_T = 
> F_VISIBILITY = 
> ## FC is the compiler used for all Fortran as from R 3.6.0
> FC = gfortran
> FCFLAGS = -Wall -g -O2 $(LTO)
> ## additional libs needed when linking with $(FC), e.g. on some Oracle compilers
> FCLIBS_XTRA = 
> FFLAGS = -Wall -g -O2 $(LTO)
> FLIBS =  -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm
> FPICFLAGS = -fPIC
> FOUNDATION_CPPFLAGS = 
> FOUNDATION_LIBS = -framework Foundation
> JAR = /usr/bin/jar
> JAVA = /usr/bin/java
> JAVAC = /usr/bin/javac
> JAVAH = /usr/bin/javah
> ## JAVA_HOME might be used in the next three.  
> ## They are for packages 'JavaGD' and 'rJava'
> JAVA_HOME = /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home
> JAVA_CPPFLAGS = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin
> JAVA_LIBS = -L$(JAVA_HOME)/lib/server -ljvm
> JAVA_LD_LIBRARY_PATH = $(JAVA_HOME)/lib/server
> LAPACK_LIBS = -L"$(R_HOME)/lib$(R_ARCH)" -lRlapack
> LDFLAGS = -L/usr/local/lib
> ## we only need this is if it is external, as otherwise link to R
> LIBINTL=   -Wl,-framework -Wl,CoreFoundation
> LIBM = 
> LIBR0 = -L"$(R_HOME)/lib$(R_ARCH)"
> LIBR1 = -lR
> LIBR = -F/Library/Frameworks/R.framework/.. -framework R
> LIBS =  -lpcre -llzma -lbz2 -lz -licucore -ldl -lm -liconv
> ## needed by R CMD config
> LIBnn = lib
> LIBTOOL = $(SHELL) "$(R_HOME)/bin/libtool"
> LTO = 
> ## needed to build applications linking to static libR
> MAIN_LD = $(CC)
> MAIN_LDFLAGS = -fopenmp
> MAIN_LINK = $(MAIN_LD) $(MAIN_LDFLAGS) $(LDFLAGS)
> MKINSTALLDIRS = "$(R_HOME)/bin/mkinstalldirs"
> OBJC = clang
> OBJCFLAGS = -Wall -g -O2 -fobjc-exceptions $(LTO)
> OBJC_LIBS = -lobjc 
> OBJCXX = clang++
> R_ARCH = 
> RANLIB = ranlib
> SAFE_FFLAGS = -Wall -g -O2 -msse2 -mfpmath=sse
> SED = /usr/bin/sed
> SHELL = /bin/sh
> SHLIB_CFLAGS = 
> SHLIB_CXXFLAGS = 
> SHLIB_CXXLD = $(CXX)
> SHLIB_CXXLDFLAGS = -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress
> SHLIB_CXX98LD = $(CXX98) $(CXX98STD)
> SHLIB_CXX98LDFLAGS = -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress
> SHLIB_CXX11LD = $(CXX11) $(CXX11STD)
> SHLIB_CXX11LDFLAGS = -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress
> SHLIB_CXX14LD = $(CXX14) $(CXX14STD)
> SHLIB_CXX14LDFLAGS = -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress
> SHLIB_CXX17LD = $(CXX17) $(CXX17STD)
> SHLIB_CXX17LDFLAGS = -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress
> SHLIB_EXT = .so
> SHLIB_FFLAGS = 
> SHLIB_LD = $(CC)
> SHLIB_LDFLAGS = -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress# $(CFLAGS) $(CPICFLAGS)
> SHLIB_LIBADD = 
> ## We want to ensure libR is picked up from $(R_HOME)/lib
> ## before e.g. /usr/local/lib if a version is already installed.
> SHLIB_LINK = $(SHLIB_LD) $(SHLIB_LDFLAGS) $(LIBR0) $(LDFLAGS)
> SHLIB_OPENMP_CFLAGS = -fopenmp
> SHLIB_OPENMP_CXXFLAGS = -fopenmp
> SHLIB_OPENMP_FFLAGS = -fopenmp
> STRIP_STATIC_LIB = strip -S
> STRIP_SHARED_LIB = strip -x
> TCLTK_CPPFLAGS = -I/usr/local/include -I/usr/local/include -I/opt/X11/include
> TCLTK_LIBS = -L/usr/local/lib -ltcl8.6 -L/usr/local/lib -ltk8.6 -L/opt/X11/lib -lX11 -Wl,-weak-lXss -lXext
> YACC = bison -y
> 
> ## Legacy settings:  no longer used by R as of 3.6.0
> ## Setting FC often sets F77 (on Solaris make even if set)
> ## so must follow FC in this file.
> F77 = gfortran
> FCPICFLAGS = -fPIC
> F77_VISIBILITY = 
> SHLIB_FCLD = $(FC)
> SHLIB_FCLDFLAGS = -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress
> SHLIB_OPENMP_FCFLAGS = -fopenmp
> 
> 
> ## for linking to libR.a
> STATIC_LIBR = #  "$(R_HOME)/lib$(R_ARCH)/libR.a"  $(BLAS_LIBS) $(FLIBS)  $(LIBINTL) -lreadline  $(LIBS)
> 
> ## These are recorded as macros for legacy use in packages
> ## set on AIX, formerly for old glibc (-D__NO_MATH_INLINES)
> R_XTRA_CFLAGS = 
> ##  was formerly set on HP-UX
> R_XTRA_CPPFLAGS =  -I"$(R_INCLUDE_DIR)" -DNDEBUG
> ## currently unset
> R_XTRA_CXXFLAGS = 
> ## used for gfortran in R > 3.6.0
> R_XTRA_FFLAGS = 
> 
> ## SHLIB_CFLAGS SHLIB_CXXFLAGS SHLIB_FFLAGS are apparently currently unused
> ## SHLIB_CXXFLAGS is undocumented, there is no SHLIB_FCFLAGS
> ALL_CFLAGS =  $(PKG_CFLAGS) $(CPICFLAGS) $(SHLIB_CFLAGS) $(CFLAGS)
> ALL_CPPFLAGS =  -I"$(R_INCLUDE_DIR)" -DNDEBUG $(PKG_CPPFLAGS) $(CLINK_CPPFLAGS) $(CPPFLAGS)
> ALL_CXXFLAGS =  $(PKG_CXXFLAGS) $(CXXPICFLAGS) $(SHLIB_CXXFLAGS) $(CXXFLAGS)
> ALL_OBJCFLAGS = $(PKG_OBJCFLAGS) $(CPICFLAGS) $(SHLIB_CFLAGS) $(OBJCFLAGS)
> ALL_OBJCXXFLAGS = $(PKG_OBJCXXFLAGS) $(CXXPICFLAGS) $(SHLIB_CXXFLAGS) $(OBJCXXFLAGS)
> ALL_FFLAGS =  $(PKG_FFLAGS) $(FPICFLAGS) $(SHLIB_FFLAGS) $(FFLAGS)
> ## can be overridden by R CMD SHLIB
> P_FCFLAGS = $(PKG_FFLAGS)
> ALL_FCFLAGS =  $(P_FCFLAGS) $(FPICFLAGS) $(SHLIB_FFLAGS) $(FCFLAGS)
> ## LIBR here as a couple of packages use this without SHLIB_LINK
> ALL_LIBS = $(PKG_LIBS) $(SHLIB_LIBADD) $(LIBR) $(LIBINTL)
> 
> .SUFFIXES:
> .SUFFIXES: .c .cc .cpp .d .f .f90 .f95 .m .mm .M .o
> 
> .c.o:
>   $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -c $< -o $@
> .c.d:
>   @echo "making $@ from $<"
>   @$(CC) -MM $(ALL_CPPFLAGS) $< > $@
> .cc.o:
>   $(CXX) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -c $< -o $@
> .cpp.o:
>   $(CXX) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -c $< -o $@
> .cc.d:
>   @echo "making $@ from $<"
>   @$(CXX) -M $(ALL_CPPFLAGS) $< > $@
> .cpp.d:
>   @echo "making $@ from $<"
>   @$(CXX) -M $(ALL_CPPFLAGS) $< > $@
> .m.o:
>   $(OBJC) $(ALL_CPPFLAGS) $(ALL_OBJCFLAGS) -c $< -o $@
> .m.d:
>   @echo "making $@ from $<"
>   @clang -MM $(ALL_CPPFLAGS) $< > $@
> .mm.o:
>   $(OBJCXX) $(ALL_CPPFLAGS) $(ALL_OBJCXXFLAGS) -c $< -o $@
> .M.o:
>   $(OBJCXX) $(ALL_CPPFLAGS) $(ALL_OBJCXXFLAGS) -c $< -o $@
> .f.o:
>   $(FC) $(ALL_FFLAGS) -c $< -o $@
> ## @FCFLAGS_f9x@ are flags needed to recognise the extensions
> .f95.o:
>   $(FC) $(ALL_FCFLAGS) -c  $< -o $@
> .f90.o:
>   $(FC) $(ALL_FCFLAGS) -c  $< -o $@
> 
mattfidler commented 5 years ago

Hi @Cyprian95,

I used a the single line of code in Makevars to install.

The error you show seems to be on the installation of StanHeaders, so perhaps you can retry installing nlmixr after you installed the recent StanHeaders. There is likely a (undeclared) version requirement in nlmixr

mattfidler commented 5 years ago

Here is the offending compile line:

ode_cmt1.cpp:7:10: fatal error: 'stan/math/rev/core.hpp' file not found
#include <stan/math/rev/core.hpp>

Also how do you install R? I install R from CRAN. Perhaps you use homebrew? I haven't tested that approach.

Cyprian95 commented 5 years ago

@mattfidler, I have used the Cran version, but in-between reinstallations, I have not removed XCode. I will try to go through everything once more and if that fails as well, will do a hard reboot of my mac. Thank you very much for your help! I will update how it turned out in the end :)

vjd commented 5 years ago

@mattfidler FWIW, I would like to share a similar experience. I ended up not using Mac or Linux as I could not get it to work even after a day of trying to get this to install. reticulate's python 3 detection was a hit or miss and I had to end up using use_python() after every restart. I will have to give it a spin again sometime based on information here.

The windows experience was surprisingly smoother and it works out of the box.

mattfidler commented 5 years ago

Thanks @vjd

We are eventually dropping python (There is an experimental branch that works without python), so that should be easier. I have been told that the Mac cran binaries will include all the necesary components so install should be simply (at that future point) installing the R package and the R toolchain for compiling binaries.

mattfidler commented 5 years ago

The easiest way on a mac is to probably use the Docker image, actually. So if you want to try that approach let me know.

mattfidler commented 5 years ago

@Cyprian95,

Did you get this working?

ghost commented 5 years ago

Hey, Trying to download nlmixr on Mac 10.14.6, once I get to the RxODE download step the following error occurs:

`Downloading GitHub repo nlmixrdevelopment/RxODE@master Your system is ready to build packages! ✔ checking for file ‘/private/var/folders/44/pnlmng852qq4dzdk6s2gfwsc0000gn/T/RtmpZ4Lhv2/remotes3a3441d1b8f/nlmixrdevelopment-RxODE-c54dcb3/DESCRIPTION’ (399ms) ─ preparing ‘RxODE’: (612ms) ✔ checking DESCRIPTION meta-information ... ─ cleaning src ─ running ‘cleanup’ ─ checking for LF line-endings in source and make files and shell scripts (390ms) ─ checking for empty or unneeded directories Removed empty directory ‘RxODE/man-roxygen’ ─ building ‘RxODE_0.9.1-4.tar.gz’

If you could please help, I'd really appreciate it!

Thank you

mattfidler commented 5 years ago

The easiest way to install nlmixr on Mac right now is to install from CRAN that is:

install.packages("nlmixr")

Otherwise the install instructions should follow the readme on this website.

If that doesn't work, I would take the docker approach.

ghost commented 5 years ago

@mattfidler Thank you so much ! I think it worked. How do I test to check that it has downloaded properly? thank you again

mattfidler commented 5 years ago

You have to make sure you can compile C programs and run sympy.

An easy way to test that is:

library(RxODE)
mod1 <-RxODE({
    C2 = centr/V2;
    C3 = peri/V3;
    d/dt(depot) =-KA*depot;
    d/dt(centr) = KA*depot - CL*C2 - Q*C2 + Q*C3;
    d/dt(peri)  =                    Q*C2 - Q*C3;
    d/dt(eff)  = Kin - Kout*(1-C2/(EC50+C2))*eff;
});

If this is successful you can test if you have sympy installed correctly:

> rxSymPyVersion()
Using sympy via reticulate
[1] 1
mattfidler commented 5 years ago

I'm supposing this is fixed. If not feel free to open a new issue.