peclayson / ERA_Toolbox

Matlab toolbox for obtaining dependability estimates for ERP measurements
6 stars 1 forks source link

g++ not found after RTools installation #24

Open jenniferbress opened 3 years ago

jenniferbress commented 3 years ago

Hi Peter,

Thanks so much for making this toolbox available. I'm currently trying to set it up on Windows 10, but I'm running into a problem with the RTools installation.

I ran the RTools35.exe file and followed your instructions as closely as I could, but the options didn't quite match up with the description in your manual. On the "Select Components" screen, I didn't see an option called "Package Authoring installation", so I selected the option "Tools for building R packages from source (recommended)". On the "Select Additional Tasks" screen, I didn't see an option called "Edit path" so selected "Add RTools to system PATH" instead. On System Path Report, "c:\Rtools\gcc-4.6.3\bin" wasn't on the list, so I added it manually. After that, installation completed without any errors. But when I checked for g++ in the command prompt , I got this message:

"'g++' is not recognized as an internal or external command, operable program or batch file."

I also tried running the ERA toolbox to see if it would take care of this problem during the dependent auto-install, but I got another error message:

"Error using era_installdependents>era_windepsinstall (line 672) WARNING: Command line tools not installed

Automatic installation of command line tools not supported for Windows See User Manual for instructions on how to install the Rtools package Rtools contains the necessary command line tools needed for CmdStan Sorry I was unable to automate this process for Windows users!

Error in era_installdependents (line 211) era_windepsinstall(wrkdir,urls);

Error in era_start>installdeps (line 534) era_installdependents;

Error while evaluating DestroyedObject Callback."

I'm guessing I did something wrong when running the RTools installation file, but I'm not savvy enough to figure out what. Maybe it was my manual addition to the path in the System Path Report? I would really appreciate any suggestions you may have.

Thanks! Jenny

peclayson commented 3 years ago

Hi Jenny,

I apologize for the headache! Unfortunately, I do not have access to a machine with Windows 10 right now, but I found some information on how to install the the compilers in section 1.1.3 here. Can you give that a shot and let me know how it goes?

It looks like Rtools40 is out and works with cmdstan, so you might try install a newer version of RTools.

I find that the installation for non-mac users can often be the hardest part of this process... sorry about that. I need to figure out a way to streamline and automate it....

Good luck! Peter

jenniferbress commented 3 years ago

Thanks, Peter (and sorry for the long delay)! I think I'm one step closer, but the problem still isn't completely resolved. 

After reading through the link you sent, I was able to get the system to recognize the compiler from the command prompt by adding a new directory (C:\Rtools\mingw_64\bin) to the PATH environment variable. Now, when I check for g++ in the command prompt, I get this:

Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=C:/Rtools/mingw_64/bin/../libexec/gcc/x86_64-w64-mingw32/4.9.3/lto-wrapper.exe Target: x86_64-w64-mingw32 Configured with: ../../../src/gcc-4.9.3/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/home/Jeroen/mingw-gcc-4.9.3/x86_64-493-posix-seh-rt_v3-s/mingw64 --with-gxx-include-dir=/mingw64/x86_64-w64-mingw32/include/c++ --enable-static --disable-shared --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-isl-version-check --disable-cloog-version-check --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-zlib --with-gmp=/home/Jeroen/mingw-gcc-4.9.3/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/home/Jeroen/mingw-gcc-4.9.3/prerequisites/x86_64-w64-mingw32-static --with-mpc=/home/Jeroen/mingw-gcc-4.9.3/prerequisites/x86_64-w64-mingw32-static --with-isl=/home/Jeroen/mingw-gcc-4.9.3/prerequisites/x86_64-w64-mingw32-static --with-cloog=/home/Jeroen/mingw-gcc-4.9.3/prerequisites/x86_64-w64-mingw32-static --enable-cloog-backend=isl --with-pkgversion='x86_64-posix-seh, Built by MinGW-W64 project' --with-bugurl=http://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -I/home/Jeroen/mingw-gcc-4.9.3/x86_64-493-posix-seh-rt_v3-s/mingw64/opt/include -I/home/Jeroen/mingw-gcc-4.9.3/prerequisites/x86_64-zlib-static/include -I/home/Jeroen/mingw-gcc-4.9.3/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -I/home/Jeroen/mingw-gcc-4.9.3/x86_64-493-posix-seh-rt_v3-s/mingw64/opt/include -I/home/Jeroen/mingw-gcc-4.9.3/prerequisites/x86_64-zlib-static/include -I/home/Jeroen/mingw-gcc-4.9.3/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS= LDFLAGS='-pipe -L/home/Jeroen/mingw-gcc-4.9.3/x86_64-493-posix-seh-rt_v3-s/mingw64/opt/lib -L/home/Jeroen/mingw-gcc-4.9.3/prerequisites/x86_64-zlib-static/lib -L/home/Jeroen/mingw-gcc-4.9.3/prerequisites/x86_64-w64-mingw32-static/lib ' Thread model: posix gcc version 4.9.3 (x86_64-posix-seh, Built by MinGW-W64 project)

But when I run the toolbox, I keep getting the same message saying that RTools isn't installed:

Error using era_installdependents>era_windepsinstall (line 672) WARNING: Command line tools not installed

Automatic installation of command line tools not supported for Windows See User Manual for instructions on how to install the Rtools package Rtools contains the necessary command line tools needed for CmdStan Sorry I was unable to automate this process for Windows users!

Error in era_installdependents (line 211) era_windepsinstall(wrkdir,urls);

Error in era_start>installdeps (line 534) era_installdependents;

Error while evaluating DestroyedObject Callback.

So it looks like the toolbox just isn't recognizing that RTools is installed for some reason. I'm guessing maybe it's looking for it in the wrong place. I tried adding C:\Rtools in Matlab using the "set path" command, but that didn't help. I also tried uninstalling RTools35 and installing Rtools40 instead, but that didn't seem to help either.

I'm not sure whether this is related, but when the toolbox attempts to auto-install the dependents, this window pops up: image

I haven't been sure if I should be using any specific filename; I've tried both "ERADependents" and "test" with no success.

Any suggestions?

Best, Jenny

peclayson commented 3 years ago

Hi Jenny,

Thank you for following up with this info. It's possible the the toolbox is looking for the wrong version of compiler.

Can you execute system('make -v') in the command line of MATLAB and send over the output?

Thanks! Peter

jenniferbress commented 3 years ago

Hi Peter,

Sure, here is the output:

GNU Make 4.2.1 Built for i686-pc-msys Copyright (C) 1988-2016 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

ans =

 0

Best, Jenny

peclayson commented 3 years ago

Ah, I think I found the issue!

Can you unzip and replace this file in your ERA Toolbox installation? It should be found in ERA_Toolbox/subroutines/installation Then try to run the toolbox and let it install the dependents.

era_installdependents.m.zip

Fingers crossed! Peter

jenniferbress commented 3 years ago

Making progress! I installed the file you sent, and got further than last time -- an "installation progress" window popped up showing the status of all the dependents and indicating that the command line tool had been installed. But then I got this message in the Matlab command line:

Ensuring dependents are found in the Matlab path ERA Toolbox files found Warning: Dependencies for the ERA toolbox are not located in the Matlab path. Please include the folders containing the scripts for CmdStan, MatlabProcessManager, and MatlabStan in your Matlab path. Please see UserManual.pdf for more information

Warning: automatic installation has only been tested using Windows 7 Command line tools installed CmdStan needs to be installed and built MatlabProcessManager is not installed MatlabStan is not installed Error using matlab.internal.webservices.HTTPConnector/copyContentToFile (line 412) The server returned the status 404 with message "Not Found" in response to the request to URL https://github.com/stan-dev/cmdstan/releases/download/v2.24.1/cmdstan-2.24.1.zip.

Error in websave (line 107) copyContentToFile(connection, filename);

Error in era_installdependents>era_windepsinstall (line 768)     fileout = websave('cmdstan.zip',loc);

Error in era_installdependents (line 223)     era_windepsinstall(wrkdir,urls);

Error in era_start>installdeps (line 534) era_installdependents;   Error while evaluating DestroyedObject Callback.

Before running the toolbox, I had downloaded the installation files for CmdStan, MatlabProcessManager, and MatlabStan into a folder called "ERADependents" in my MATLAB folder. It looks like the toolbox is trying to download CmdStan again rather than using the copy I downloaded, and then not finding it.

Jenny

peclayson commented 3 years ago

Ok, I've fixed the url for the .zip file for the Windows installation. Can you give this file a shot when you can?

Thanks! Peter

era_installdependents.m.zip

jenniferbress commented 3 years ago

Thanks, Peter! It installed the CmdStan files but got stuck on CmdStan Build. Now I'm getting this message:

Ensuring dependents are found in the Matlab path ERA Toolbox files found Warning: Dependencies for the ERA toolbox are not located in the Matlab path. Please include the folders containing the scripts for CmdStan, MatlabProcessManager, and MatlabStan in your Matlab path. Please see UserManual.pdf for more information

Warning: automatic installation has only been tested using Windows 7 Command line tools installed CmdStan needs to be installed and built MatlabProcessManager is not installed MatlabStan is not installed CmdStan succesfully installed curl -L https://github.com/stan-dev/stanc3/releases/download/nightly/windows-stanc -o bin/stanc --retry 5 --retry-delay 10 cd ; ./bootstrap.bat gcc g++ -c -fvisibility=hidden -o bin/cmdstan/stansummary.o src/cmdstan/stansummary.cpp sh: line 0: cd: /home/jeb2061: No such file or directory sh: ./bootstrap.bat: No such file or directory make: * [make/command:35: /stage/lib/libboost_program_options.a] Error 127 make: Waiting for unfinished jobs.... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed

0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 621 100 621 0 0 621 0 0:00:01 --:--:-- 0:00:01 3059 src/cmdstan/stansummary.cpp:1:42: fatal error: cmdstan/stansummary_helper.hpp: No such file or directory

include <cmdstan/stansummary_helper.hpp>

                                      ^ 

compilation terminated. make: *** [make/command:5: bin/cmdstan/stansummary.o] Error 1

90 20.3M 90 18.3M 0 0 18.3M 0 0:00:01 --:--:-- 0:00:01 18.3M 100 20.3M 100 20.3M 0 0 20.3M 0 0:00:01 --:--:-- 0:00:01 123M Error using era_installdependents>era_windepsinstall (line 829) WARNING: Automatic build of CmdStan failed

Please install CmdStan manually For installation instructions, see Appendix A of the User Manual

Error in era_installdependents (line 226) era_windepsinstall(wrkdir,urls);

Error in era_start>installdeps (line 534) era_installdependents;

Error while evaluating DestroyedObject Callback.

Should I try doing the installation manually instead?

Best, Jenny

peclayson commented 3 years ago

Hey Jenny,

I think we can still salvage this. Manual installation is a nightmare :)

I found this issue on the stan forums here: https://discourse.mc-stan.org/t/error-while-installing-cmdstanr-version-2-24-0/17074/6

It looks like this a problem when running RTools35 on newer versions of Stan when using Windows. (I really need to a Windows machine...). Can you try installing RTools 4.0? It shouldn't cause problems to use a higher version of RTools for the installation on the ERA Toolbox's end... I guess we will see.

Sorry for the headache!

Peter

jenniferbress commented 3 years ago

Hi Peter,

I really appreciate all the time you're taking to help me figure this out. I uninstalled RTools35, installed RTools40, and now I'm back to my original problem with the system not recognizing g++. In the Windows command prompt, I'm getting this message:

'g++' is not recognized as an internal or external command, operable program or batch file.

I searched for the g++ application and added the filepath where I found it to the PATH variable, but that didn't fix it this time. Maybe there's another filepath I should be adding?

Jenny

peclayson commented 3 years ago

When you have a sec, now that you have RTools40 installed, can you send me the outputs of system('make -v') and system('g++ -v').

Thanks! Peter

jenniferbress commented 3 years ago

Sure, here you go (both from the Matlab command line):

system('make -v') 'make' is not recognized as an internal or external command, operable program or batch file.

ans =

 1

system('g++ -v') Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=C:/RTools/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/lto-wrapper.exe Target: x86_64-w64-mingw32 Configured with: ../gcc-8.3.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,fortran --disable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts=yes --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Built by Jeroen for the R-project' --with-bugurl=https://github.com/r-windows --with-gnu-as --with-gnu-ld Thread model: posix gcc version 8.3.0 (Built by Jeroen for the R-project)

ans =

 0

Best, Jenny

peclayson commented 3 years ago

Hi Jenny,

Ok, I have an idea. Instead of using RTools40, let's use RTools35 (like we did above and got to the point where it crashed installing cmdstan).

Then, go to the era_dependentsversions.m file in subroutines/installation. Change line 46 to depvers.cmdstan = '2.23.0';

This should then make the installation use an older version of cmdstan that hopefully will work.

The issue is a problem with the g++ compiler and cmdstan. (not an ERA Toolbox issue per se). Using an older version of cmdstan shouldn't pose any problems. It just might be a little slower.

Some day I will get access to a Windows 10 machine and try to work out the kinks. I'm sorry about this!

Take care, Peter

jenniferbress commented 3 years ago

Hmm, I reinstalled RTools35 and changed the era_dependentsversions file per your instructions, and now I'm getting the same error as before when it gets to the CmdStan build.

Here is the message in the MATLAB command line:

era_start

Ensuring dependents are found in the Matlab path ERA Toolbox files found Warning: Dependencies for the ERA toolbox are not located in the Matlab path. Please include the folders containing the scripts for CmdStan, MatlabProcessManager, and MatlabStan in your Matlab path. Please see UserManual.pdf for more information

Warning: automatic installation has only been tested using Windows 7 Command line tools installed CmdStan needs to be installed and built MatlabProcessManager is not installed MatlabStan is not installed CmdStan succesfully installed curl -L https://github.com/stan-dev/stanc3/releases/download/nightly/windows-stanc -o bin/stanc --retry 5 --retry-delay 10 g++ -c -o bin/cmdstan/stansummary.o src/cmdstan/stansummary.cpp g++ -c -o bin/cmdstan/print.o src/cmdstan/print.cpp % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed

0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 621 100 621 0 0 621 0 0:00:01 --:--:-- 0:00:01 3980 src/cmdstan/stansummary.cpp:7:42: fatal error: cmdstan/stansummary_helper.hpp: No such file or directory

include <cmdstan/stansummary_helper.hpp>

                                      ^ 

compilation terminated. src/cmdstan/print.cpp:7:36: fatal error: cmdstan/print_helper.hpp: No such file or directory

include <cmdstan/print_helper.hpp>

                                ^ 

compilation terminated. make: [make/command:4: bin/cmdstan/stansummary.o] Error 1 make: Waiting for unfinished jobs.... make: *** [make/command:4: bin/cmdstan/print.o] Error 1

48 20.3M 48 9.9M 0 0 9.9M 0 0:00:02 --:--:-- 0:00:02 9.9M 100 20.3M 100 20.3M 0 0 20.3M 0 0:00:01 --:--:-- 0:00:01 95.3M Error using era_installdependents>era_windepsinstall (line 829) WARNING: Automatic build of CmdStan failed

Please install CmdStan manually For installation instructions, see Appendix A of the User Manual

Error in era_installdependents (line 226) era_windepsinstall(wrkdir,urls);

Error in era_start>installdeps (line 534) era_installdependents;

Error while evaluating DestroyedObject Callback.

And in case it's useful, here are the results of the make and g++ commands in the MATLAB command line:

system('make -v')

GNU Make 4.2.1 Built for i686-pc-msys Copyright (C) 1988-2016 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

ans =

 0

system('g++ -v') Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=C:/Rtools/mingw_64/bin/../libexec/gcc/x86_64-w64-mingw32/4.9.3/lto-wrapper.exe Target: x86_64-w64-mingw32 Configured with: ../../../src/gcc-4.9.3/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/home/Jeroen/mingw-gcc-4.9.3/x86_64-493-posix-seh-rt_v3-s/mingw64 --with-gxx-include-dir=/mingw64/x86_64-w64-mingw32/include/c++ --enable-static --disable-shared --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-isl-version-check --disable-cloog-version-check --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-zlib --with-gmp=/home/Jeroen/mingw-gcc-4.9.3/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/home/Jeroen/mingw-gcc-4.9.3/prerequisites/x86_64-w64-mingw32-static --with-mpc=/home/Jeroen/mingw-gcc-4.9.3/prerequisites/x86_64-w64-mingw32-static --with-isl=/home/Jeroen/mingw-gcc-4.9.3/prerequisites/x86_64-w64-mingw32-static --with-cloog=/home/Jeroen/mingw-gcc-4.9.3/prerequisites/x86_64-w64-mingw32-static --enable-cloog-backend=isl --with-pkgversion='x86_64-posix-seh, Built by MinGW-W64 project' --with-bugurl=http://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -I/home/Jeroen/mingw-gcc-4.9.3/x86_64-493-posix-seh-rt_v3-s/mingw64/opt/include -I/home/Jeroen/mingw-gcc-4.9.3/prerequisites/x86_64-zlib-static/include -I/home/Jeroen/mingw-gcc-4.9.3/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -I/home/Jeroen/mingw-gcc-4.9.3/x86_64-493-posix-seh-rt_v3-s/mingw64/opt/include -I/home/Jeroen/mingw-gcc-4.9.3/prerequisites/x86_64-zlib-static/include -I/home/Jeroen/mingw-gcc-4.9.3/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS= LDFLAGS='-pipe -L/home/Jeroen/mingw-gcc-4.9.3/x86_64-493-posix-seh-rt_v3-s/mingw64/opt/lib -L/home/Jeroen/mingw-gcc-4.9.3/prerequisites/x86_64-zlib-static/lib -L/home/Jeroen/mingw-gcc-4.9.3/prerequisites/x86_64-w64-mingw32-static/lib ' Thread model: posix gcc version 4.9.3 (x86_64-posix-seh, Built by MinGW-W64 project)

ans =

 0

Best, Jenny

peclayson commented 3 years ago

Hi Jenny,

I'm honestly stumped. Sorry! I'm trying to track down a Windows user that might be able to help us out. I'll keep you posted. (I guess reduced access to computing machines is a significant disadvantage to working remotely!).

I'm sorry about this.

Peter

jenniferbress commented 3 years ago

Hi Peter,

No problem, and thanks again for spending so much time on this.

Best, Jenny

On Thu, Mar 11, 2021 at 12:57 PM Peter @.***> wrote:

Hi Jenny,

I'm honestly stumped. Sorry! I'm trying to track down a Windows user that might be able to help us out. I'll keep you posted. (I guess reduced access to computing machines is a significant disadvantage to working remotely!).

I'm sorry about this.

Peter

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/peclayson/ERA_Toolbox/issues/24#issuecomment-796926632, or unsubscribe https://github.com/notifications/unsubscribe-auth/AS7LYIM5QRSYJPW2O6P5NOLTDDY57ANCNFSM4YGWU3RQ .

peclayson commented 3 years ago

Hi Jenny,

Okay, first off, I've made a beta release for you to try the windows installation here. But, there's a bit of work to do before using the toolbox to finish up the installation.

(this might be troublesome for now. Sorry about that. The Windows installation has gotten pretty bad.)

Please follow the instructions here for installing cmdstan on Windows. Note that it's important you have an R version over 4.0 before installing RTools4.0. Make sure that

C:\RTools\RTools40\usr\bin
C:\RTools\RTools40\mingw64\bin

are at the top of your path.

Then, go ahead and use R to install cmdstanr using the following (make sure you've install devtools: install.packages("devtools").

library(cmdstanr)
install_cmdstan(dir = "C:/Users/clayson/Documents/MATLAB")

Fix the path to direct it to where you want cmdstan installed. Then, add that path to the MATLAB path (e.g., here).

Then, run era_start. It should find the cmdstan build, and it will install the other dependents for you (and fix the paths within them to the cmdstan directory).

Best of luck. Let me know how it goes. I've been able to test it on a Windows 10 machine, and things are working smoothly.

Thanks, Peter

peclayson commented 3 years ago

I just wanted to let you know the steps I provided helped someone get the toolbox working on Windows 10.

https://github.com/peclayson/ERA_Toolbox/issues/26