metrumresearchgroup / Torsten

library of C++ functions that support applications of Stan in Pharmacometrics
BSD 3-Clause "New" or "Revised" License
52 stars 11 forks source link

[BUG] installation failed #52

Open hainiwen opened 5 months ago

hainiwen commented 5 months ago

Description

Hi there! I'm trying to use Torsten since I want to do a PKPD project. I got the idea that Torsten needs cmdstan and then cmdstandr to work. And i suppose i need the stan that's inside Torsten's repository and I install from there. So i go: cd C:\Torsten\cmdstan

However, I failed to install the Stan with mingw32:

image

Information:

Before this, I installed MinGW for mingw32 to work.

Current Version:

v0.87.1

hainiwen commented 5 months ago

hi sorry, me again! i tried to get around the issue by using a macbook, now i got some new issues.

so followed the installation guide, the terminal said both torsten and cmdstan are installed. however when i run the example in r, with cmdstanr installed and cmdstan path set, it's still not compiling.

cmdstanr::set_cmdstan_path("Downloads/Torsten/cmdstan") CmdStan path set to: /Users/hainiwen/Downloads/Torsten/cmdstan file <- file.path(cmdstan_path(), "examples", "bernoulli", "bernoulli.stan") mod <- cmdstan_model(file) Compiling Stan program... fatal error: malformed or corrupted AST file: 'could not find file '/Users/hainiwen/Downloads/Torsten-master/cmdstan/stan/src/stan/services/util/create_rng.hpp' referenced by AST file 'stan/src/stan/model/model_header_12_0.hpp.gch'' 1 error generated.

make: *** [/var/folders/f2/v4k0sfb52fbbtdvj58hw0q1r0000gn/T/RtmpruQZ1e/model-4b336de0993] Error 1

Error: An error occured during compilation! See the message above for more information. In addition: Warning message: CmdStan's precompiled header (PCH) files may need to be rebuilt. If your model failed to compile please run rebuild_cmdstan(). If the issue persists please open a bug report.

hainiwen commented 5 months ago

hi and hi again! i solve the above mentioned bug in mac by make -clean and make-build again. the issue with windows remian. i suspect it's something worng with rtools40, while i followed the guide about installing mingw32, mingw64, and they are all there in my windows, and i put just one of them in the environment variable. still, it's not recognizing mingw32-make in the commander. with MinGW it seems to have a compatability issue now. So, still, don't know what to do with windows.

hainiwen commented 5 months ago

hi and hi again! i solve the above mentioned bug in mac by make -clean and make-build again. the issue with windows remian. i suspect it's something worng with rtools40, so i re-installed rtools43, and now I got something new!


C:/Torsten/cmdstan/stan/lib/stan_math/lib/tbb" ' 'mingw32-make' -C "stan/lib/stan_math/lib/tbb" -r -f "C:/Torsten/cmdstan/stan/lib/stan_math/lib/tbb_2020.3/build/Makefile.tbbmalloc" compiler=gcc cfg=release stdver=c++1y malloc CXXFLAGS="-Wno-unknown-warning-option -Wno-deprecated-copy -Wno-missing-attributes -Wno-class-memaccess -Wno-sized-deallocation " mingw32-make[1]: Entering directory 'C:/Torsten/cmdstan/stan/lib/stan_math/lib/tbb' g++ -c -MMD -O2 -DUSE_WINTHREAD -D_WIN32_WINNT=0x0502 -DMINGW_HAS_SECURE_API=1 -DMSVCRT_VERSION__=0x0700 -msse -mthreads -m64 -mrtm -Wno-unknown-warning-option -Wno-deprecated-copy -Wno-missing-attributes -Wno-class-memaccess -Wno-sized-deallocation -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1 -fno-rtti -fno-exceptions -DTBBMALLOC_BUILD=1 -Wno-parentheses -Wno-uninitialized -Wno-non-virtual-dtor -flifetime-dse=1 -I../tbb_2020.3/src -I../tbb_2020.3/src/rml/include -I../tbb_2020.3/include -I../tbb_2020.3/src/tbbmalloc -I../tbb_2020.3/src/tbbmalloc ../tbb_2020.3/src/tbbmalloc/backend.cpp In file included from C:/RBuildTools/4.3/ucrt64/include/c++/13.2.0/stdlib.h:36, from C:/RBuildTools/4.3/ucrt64/lib/gcc/x86_64-w64-mingw32/13.2.0/include/mm_malloc.h:27, from C:/RBuildTools/4.3/ucrt64/lib/gcc/x86_64-w64-mingw32/13.2.0/include/xmmintrin.h:34, from C:/RBuildTools/4.3/ucrt64/lib/gcc/x86_64-w64-mingw32/13.2.0/include/immintrin.h:31, from ../tbb_2020.3/include/tbb/machine/gcc_itsx.h:57, from ../tbb_2020.3/include/tbb/machine/gcc_ia32_common.h:107, from ../tbb_2020.3/include/tbb/machine/gcc_generic.h:232, from ../tbb_2020.3/include/tbb/tbb_machine.h:197, from ../tbb_2020.3/src/tbbmalloc/Synchronize.h:20, from ../tbb_2020.3/src/tbbmalloc/Customize.h:29, from ../tbb_2020.3/src/tbbmalloc/TypeDefinitions.h:54, from ../tbb_2020.3/src/tbbmalloc/tbbmalloc_internal.h:21, from ../tbb_2020.3/src/tbbmalloc/backend.cpp:19: C:/RBuildTools/4.3/ucrt64/include/c++/13.2.0/cstdlib:141:11: error: 'at_quick_exit' has not been declared in '::' 141 | using ::at_quick_exit; | ^~~~~ C:/RBuildTools/4.3/ucrt64/include/c++/13.2.0/cstdlib:164:11: error: 'quick_exit' has not been declared in '::' 164 | using ::quick_exit; | ^~~~~~ C:/RBuildTools/4.3/ucrt64/include/c++/13.2.0/stdlib.h:43:14: error: 'at_quick_exit' has not been declared in 'std' 43 | using std::at_quick_exit; | ^~~~~ C:/RBuildTools/4.3/ucrt64/include/c++/13.2.0/stdlib.h:46:14: error: 'quick_exit' has not been declared in 'std' 46 | using std::quick_exit; | ^~~~~~ cc1plus.exe: note: unrecognized command-line option '-Wno-unknown-warning-option' may have been intended to silence earlier diagnostics mingw32-make[1]: [C:/Torsten/cmdstan/stan/lib/stan_math/lib/tbb_2020.3/build/Makefile.tbbmalloc:65: backend.o] Error 1 mingw32-make[1]: Leaving directory 'C:/Torsten/cmdstan/stan/lib/stan_math/lib/tbb' mingw32-make: [stan/lib/stan_math/make/libraries:187: stan/lib/stan_math/lib/tbb/tbbmalloc.def] Error 2


Any idea how to solve this? Lots of thanks!!!!

yizhang-yiz commented 5 months ago

There seem some problems with your mingw32 path setting. See https://discourse.mc-stan.org/t/problem-installing-cmdstan-with-r4-2-and-rtools42/28846.

hainiwen commented 5 months ago

Hi Yi, Thanks for your quick reply! I followed the thread you mentioned and I got the same error. My PATH are here: image And there are where my RTOOLS placed and both bins have files in the folders.

The full errors are here: C:\Torsten\cmdstan>mingw32-make build INFO: Could not find files for the given pattern(s). tbb_root="../tbb_2020.3" CXX="g++" CC="gcc" LDFLAGS='-Wl,-L,"C:/Torsten/cmdstan/stan/lib/stan_math/lib/tbb" -Wl,-rpath,"C:/Torsten/cmdstan/stan/lib/stan_math/lib/tbb" ' 'mingw32-make' -C "stan/lib/stan_math/lib/tbb" -r -f "C:/Torsten/cmdstan/stan/lib/stan_math/lib/tbb_2020.3/build/Makefile.tbbmalloc" compiler=gcc cfg=release stdver=c++1y malloc CXXFLAGS="-Wno-unknown-warning-option -Wno-deprecated-copy -Wno-missing-attributes -Wno-class-memaccess -Wno-sized-deallocation " mingw32-make[1]: Entering directory 'C:/Torsten/cmdstan/stan/lib/stan_math/lib/tbb' g++ -c -MMD -O2 -DUSE_WINTHREAD -D_WIN32_WINNT=0x0502 -DMINGW_HAS_SECURE_API=1 -DMSVCRT_VERSION__=0x0700 -msse -mthreads -m64 -mrtm -Wno-unknown-warning-option -Wno-deprecated-copy -Wno-missing-attributes -Wno-class-memaccess -Wno-sized-deallocation -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1 -fno-rtti -fno-exceptions -DTBBMALLOC_BUILD=1 -Wno-parentheses -Wno-uninitialized -Wno-non-virtual-dtor -flifetime-dse=1 -I../tbb_2020.3/src -I../tbb_2020.3/src/rml/include -I../tbb_2020.3/include -I../tbb_2020.3/src/tbbmalloc -I../tbb_2020.3/src/tbbmalloc ../tbb_2020.3/src/tbbmalloc/backend.cpp In file included from C:/RBuildTools/4.3/ucrt64/include/c++/13.2.0/stdlib.h:36, from C:/RBuildTools/4.3/ucrt64/lib/gcc/x86_64-w64-mingw32/13.2.0/include/mm_malloc.h:27, from C:/RBuildTools/4.3/ucrt64/lib/gcc/x86_64-w64-mingw32/13.2.0/include/xmmintrin.h:34, from C:/RBuildTools/4.3/ucrt64/lib/gcc/x86_64-w64-mingw32/13.2.0/include/immintrin.h:31, from ../tbb_2020.3/include/tbb/machine/gcc_itsx.h:57, from ../tbb_2020.3/include/tbb/machine/gcc_ia32_common.h:107, from ../tbb_2020.3/include/tbb/machine/gcc_generic.h:232, from ../tbb_2020.3/include/tbb/tbb_machine.h:197, from ../tbb_2020.3/src/tbbmalloc/Synchronize.h:20, from ../tbb_2020.3/src/tbbmalloc/Customize.h:29, from ../tbb_2020.3/src/tbbmalloc/TypeDefinitions.h:54, from ../tbb_2020.3/src/tbbmalloc/tbbmalloc_internal.h:21, from ../tbb_2020.3/src/tbbmalloc/backend.cpp:19: C:/RBuildTools/4.3/ucrt64/include/c++/13.2.0/cstdlib:141:11: error: 'at_quick_exit' has not been declared in '::' 141 | using ::at_quick_exit; | ^~~~~ C:/RBuildTools/4.3/ucrt64/include/c++/13.2.0/cstdlib:164:11: error: 'quick_exit' has not been declared in '::' 164 | using ::quick_exit; | ^~~~~~ C:/RBuildTools/4.3/ucrt64/include/c++/13.2.0/stdlib.h:43:14: error: 'at_quick_exit' has not been declared in 'std' 43 | using std::at_quick_exit; | ^~~~~ C:/RBuildTools/4.3/ucrt64/include/c++/13.2.0/stdlib.h:46:14: error: 'quick_exit' has not been declared in 'std' 46 | using std::quick_exit; | ^~~~~~ cc1plus.exe: note: unrecognized command-line option '-Wno-unknown-warning-option' may have been intended to silence earlier diagnostics mingw32-make[1]: [C:/Torsten/cmdstan/stan/lib/stan_math/lib/tbb_2020.3/build/Makefile.tbbmalloc:65: backend.o] Error 1 mingw32-make[1]: Leaving directory 'C:/Torsten/cmdstan/stan/lib/stan_math/lib/tbb' mingw32-make: [stan/lib/stan_math/make/libraries:187: stan/lib/stan_math/lib/tbb/tbbmalloc.def] Error 2

C:\Torsten\cmdstan>

yizhang-yiz commented 5 months ago

Can you try adding the following in 'cmdstan/make/local' file? If there's no such file you may create one.

CXXFLAGS += -Wno-nonnull
TBB_CXXFLAGS= -U__MSVCRT_VERSION__ -D__MSVCRT_VERSION__=0x0E00
hainiwen commented 5 months ago

Can you try adding the following in 'cmdstan/make/local' file? If there's no such file you may create one.

CXXFLAGS += -Wno-nonnull
TBB_CXXFLAGS= -U__MSVCRT_VERSION__ -D__MSVCRT_VERSION__=0x0E00

Hi Yi,

Yes, I have put these lines into local.example file, but the same error again. I also did clean-all before i re-install.