Cantera Installation windows help

489 views
Skip to first unread message

Pradeep

unread,
Mar 30, 2016, 9:59:50 AM3/30/16
to Cantera Users' Group
Hi all,

   I am trying to build cantera in Windows with intel FORTRAN and MSVC 10.0. But for C and C++ I have installed MinGW. When I tried to build cantera using scons, I get the following error

C:\Cantera\cantera-2.2.0>scons install
scons: Reading SConscript files ...
INFO: SCons is using the following Python interpreter: C:\Python27\python.exe
INFO: Compiling with MSVC 10.0
INFO: Compiling for architecture: amd64
INFO: Compiling using the following toolchain(s): ['default']
Configuration variables read from 'cantera.conf' and command line:
    CXX = 'g++'
    CC = 'gcc'
    python_package = 'full'
    f90_interface = 'y'
    FORTRAN = 'ifort'
    FORTRANFLAGS = '-03'
    use_sundials = 'y'
    blas_lapack_libs = 'lapack,blas'
    env_vars = 'all'
    F77 = 'ifort'

Checking for C++ header file cmath... no
ERROR: The C++ compiler is not correctly configured.
See 'config.log' for details.

C:\Cantera\cantera-2.2.0>

I never use C or C++, and so to check the installation in MinGW I simply compiled and executed some basic C and C++ programs and it worked well. I don't know why it is reporting C++ compiler is not correctly configured. 

I have attached 'Cantera.conf' and 'config.log' for your kind perusal. 
cantera.conf
config.log

Bryan W. Weber

unread,
Mar 30, 2016, 11:39:26 AM3/30/16
to Cantera Users' Group
Dear Pradeep,

You cannot use both MSVC and MinGW. They are different compilers and you need to pick one or the other. Why do you want to use them together? If you look at the documentation, there is an extra option you need to specify to use MinGW: http://www.cantera.org/docs/sphinx/html/compiling.html#windows-mingw

Regards,
Bryan

Ray Speth

unread,
Mar 30, 2016, 11:40:12 AM3/30/16
to Cantera Users' Group
Pradeep,

If you want to use MinGW, you have to specify the option toolchain=mingw like it says in the compilation instructions.

However, before you do that, you should make sure that the Intel Fortran compiler works with MinGW as the C/C++ compiler, rather than just MSVC. It doesn't make any sense to say that you are using MSVC 10.0 and MinGW, since you can only use one C/C++ compiler.

Regards,
Ray

On Wednesday, March 30, 2016 at 9:59:50 AM UTC-4, Pradeep wrote:

Pradeep

unread,
Mar 31, 2016, 5:06:29 AM3/31/16
to Cantera Users' Group
Hi, 
   Thank you for your comments. I fixed that error. I use only intel compiler now with MSVC. But I got a different error now. Building and testing cantera was successful. 

*****************************
***    Testing Summary    ***
*****************************

Tests passed: 130
Up-to-date tests skipped: 0
Tests failed: 0

*****************************
scons: done building targets.


But while installing I receive following error message. 


C:\Cantera\cantera-2.2.1>scons install
scons: Reading SConscript files ...
INFO: SCons is using the following Python interpreter: C:\Python27\python.exe
INFO: Compiling with MSVC 10.0
INFO: Compiling for architecture: amd64
INFO: Compiling using the following toolchain(s): ['default']
Configuration variables read from 'cantera.conf' and command line:
    python_package = 'minimal'
    f90_interface = 'y'
    FORTRAN = 'ifort'
    FORTRANFLAGS = '-03'
    use_sundials = 'n'
    env_vars = 'all'
    boost_inc_dir = 'C:\\cantera\\boost_1_60_0'
    F77 = 'ifort'

Checking for C++ header file cmath... (cached) yes
Checking for C header file sys/times.h... (cached) no
Checking for C header file unistd.h... (cached) no
Checking for C header file fenv.h... (cached) no
Checking whether erf is declared... (cached) no
Checking for ::isnan(1.0)... (cached) no
Checking for std::isnan(1.0)... (cached) no
Checking for _isnan(1.0)... (cached) yes
Checking for C++ header file boost/math/special_functions/erf.hpp... (cached) yes
Checking for std::shared_ptr<int> x... (cached) yes
Checking for CVodeCreate(CV_BDF, CV_NEWTON) in C++ library sundials_cvodes... (cached) no
Checking for double x; log(x) in C library None... (cached) yes
INFO: Using 'ifort' to build the Fortran 90 interface
INFO: Not building the Python 3 package because the Python 3 interpreter 'python3' could not be found.
scons: done reading SConscript files.
scons: Building targets ...
scons: *** [C:\Program Files\Cantera\include] C:\Program Files\Cantera\include: Access is denied
scons: building terminated because of errors.

How this error can be resolved ? 

Bryan W. Weber

unread,
Mar 31, 2016, 7:36:28 AM3/31/16
to Cantera Users' Group
Dear Pradeep,

Please run the install (and only the install) from an Administrator command prompt. FWIW, the error is very clear - you do not have permission as a regular user to write to the "C:\Program Files" folder, so you need to have Administrator permission, just like installing to /usr/local on Linux requires sudo.

Alternatively, if you have the WiX toolset: http://cantera.github.io/docs/sphinx/html/compiling.html#sec-dependencies, http://wixtoolset.org/releases/ you can put in a regular (not Administrator) command prompt

scons msi

and it will build standard MSI installers. Then you can double-click the correct file (either the full interface in Cantera.msi or the Python interface in the ones named with Python) to install Cantera. Actually the second way would be my personal recommendation, since the MSI handles the permissions and provides an uninstaller for easy removal later.

Regards,
Bryan

Pradeep

unread,
Apr 1, 2016, 7:30:23 AM4/1/16
to Cantera Users' Group
Hi Bryan,

   Sorry to come back with the same error. I tried to clean the build target by typing scons clean and  tried to build to build it again. but I'm getting the error as C++ compiler is not correctly configured. 

I have attached the config.log and cantera.conf for your perusal. 
config.log
cantera.conf

Bryan W. Weber

unread,
Apr 1, 2016, 9:10:48 AM4/1/16
to Cantera Users' Group
Dear Pradeep,

You have to use the VSYYYY x64 Command Prompt to do the compilation (where YYYY is the year of your version of Visual Studio), so that all the proper environment variables are set. You should also set the option msvc_version in your cantera.conf file, either to '12.0' for VS2013 or '14.0' for VS2015. Then it is not necessary to set CC and CXX, those will be set automatically by SCons if you give the msvc_version.

Regards,
Bryan

Pradeep

unread,
Apr 4, 2016, 8:30:14 AM4/4/16
to Cantera Users' Group
Dear Bryan,
   I tried to install from administrator Command prompt. But I think my earlier installation is messing my current installation. I use intel for my FORTRAN. But I receive error for gfortran. For more clearer description I have included the error messages as follows:


....
....
Install file: "build\data\water.xml" as "C:\Program Files\Cantera\data\water.xml"
Install file: "interfaces\cython\cantera\ck2cti.py" as "C:\Program Files\Cantera\bin\ck2cti.py"
Install file: "interfaces\cython\cantera\ctml_writer.py" as "C:\Program Files\Cantera\bin\ctml_writer.py"
gfortran -o build\src\fortran\fctxml_interface.o -c -03 -Ibuild\src\fortran -Isrc\fortran -Isrc\fortran -Jbuild\src\fortran src\fortran\fctxml_interface.f90
gfortran: error: unrecognized command line option '-03'
scons: *** [build\src\fortran\fctxml_interface.o] Error 1
scons: building terminated because of errors.

C:\Cantera\cantera-2.2.1>

How Can I fix this error ? 

Ray Speth

unread,
Apr 4, 2016, 11:42:13 AM4/4/16
to Cantera Users' Group
Pradeep,

Please (always) provide the full input and output of whatever commands you are running. Truncating the output hides a lot of information that could be useful in diagnosing the problem. All the portion of the log that you included tells us is that Scons is trying to use gfortran, but nothing about why.

In this case, it may also be helpful to provide the output of the command 'scons build dump'.

Regards,
Ray

Pradeep

unread,
Apr 4, 2016, 9:04:52 PM4/4/16
to Cantera Users' Group
Dear Ray,
   I have build the cantera using the command scons build followed by scons test which returned no error. So I tried to build using the command scons install and I got the error message as above. I have attached the messages received during scons install and scons build dump along with cantera.conf and config.log for your kind perusal. 
cantera.conf
config.log
sconsdump.txt
sconsinstall.txt

Bryan W. Weber

unread,
Apr 4, 2016, 9:37:23 PM4/4/16
to Cantera Users' Group
Dear Pradeep,

If I had to guess, I would say this is a very similar problem to the one you experienced on Linux with regards to the Intel environment variables and administrator mode. You can see in the output: WARNING: Couldn't find specified Fortran compiler: 'ifort' so SCons cannot find ifort. Can you run ifort from the command line yourself (what is the output of typing just ifort? Have you properly set the environment variables for Windows)? Are you intending to use gcc to build the C++ files? Because that is happening too.

Regards,
Bryan

Pradeep

unread,
Apr 5, 2016, 1:36:41 AM4/5/16
to Cantera Users' Group
Dear Ray and Bryan,
   I made a mistake. Instead of installing from intel command prompt running in administrator mode,I tried to install using system command prompt for which path is not set clear.

   I run the same command 'scons install' in Intel compiler and it does not have the error as i had encountered earlier. I got the following errors while building from Intel command prompt. 

   Also I have attached build dump reported from the intel compiler for your kind perusal. 
sconsins.txt
sconsins2.txt
sconsdumpintel.txt

Ray Speth

unread,
Apr 5, 2016, 1:54:26 PM4/5/16
to Cantera Users' Group
Pradeep,

Thank you, it is helpful to see the detailed output. The behavior of switching to a different Fortran compiler after failing to find the one you specified is clearly unexpected and the source of a fair amount of the confusion here. I have changed the current development version so that if the explicitly-specified Fortran compiler cannot be found, SCons will simply exit with an error message.

As for the current failure, it looks like 'sconsinst.txt' is the output to stdout and 'sconsins2.txt' is the output to stderr (i.e. you ran something like 'scons install >sconsinst.txt 2>sconsins2.txt'), is that correct?

I guess you're getting into uncharted territory here, as I think using Cantera with the Intel Fortran compiler on Windows is an unusual combination. From the error message, it looks like it doesn't understand the command line arguments that are being passed in. You will need to figure out what the correct command arguments are for ifort to be able to compile a F90 source file with the desired optimization level and putting the resulting .mod file in the right directory (build\src\fortran). You can experiment with this directly from the command prompt without invoking SCons, e.g. by running

ifort -o build\src\fortran\fctxml_interface.obj -c -03 -Ibuild\src\fortran -Isrc\fortran -Isrc\fortran -module build\src\fortran src\fortran\fctxml_interface.f90

Which will presumably give you the same warning messages as before and fail to generate the .mod file in the correct location. Once you figure out what the correct compiler options are, you can post them here and we can help with identifying the right SCons options or modifications to SConstruct as necessary.

Regards,
Ray

Pradeep

unread,
Apr 6, 2016, 9:46:14 AM4/6/16
to Cantera Users' Group
Dear Ray,

   I changed two options from the command you have suggested and ran without any warnings. 

1) -03(zero three) I changed to O3(o three)
2)-module changed to -I.

and after that it compiles without any errors. 

the changed command are as follows:
'ifort -o build\src\fortran\fctxml_interface.obj -c -O3 -Ibuild\src\fortran -Isrc\fortran -Isrc\fortran -I build\src\fortran src\fortran\fctxml_interface.f90'

How can I fix this now ? 

Ray Speth

unread,
Apr 6, 2016, 11:19:36 AM4/6/16
to Cantera Users' Group
Pradeep,

The zero is just a typo in your original input for the value of FORTRANFLAGS so you can just modify the arguments passed to 'scons build' for that one.

I do not think that -I is a perfect substitute for -module. It appears that on Windows, the syntax is '/module:path'. Please try modifying SConstruct, near line 915 to read:

elif 'ifort' in env['FORTRAN']:
    env['FORTRANMODDIRPREFIX'] = '/module:'

Regards,
Ray

Pradeep

unread,
Apr 8, 2016, 11:29:19 AM4/8/16
to Cantera Users' Group
Dear Ray and Bryan,

   I don't how to compile the sample files. I think I have successfully build Cantera without sundials using Intel compiler, but with sundials I get same error because of sundials 32bit installation.
Now, after installing Cantera, I got the message as follows,

...
Cantera has been successfully installed.

File locations:

  applications                C:\Program Files\Cantera\bin
  library files               C:\Program Files\Cantera\lib
  C++ headers                 C:\Program Files\Cantera\include
  samples                     C:\Program Files\Cantera\samples
  data files                  C:\Program Files\Cantera\data
scons: done building targets.

C:\CTsrc\cantera-2.2.1> 

from the intel command prompt. I moved to the samples directory and made the command 'nmake', but I receive the following errors:

C:\Program Files\Cantera\samples\f90>nmake

Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
Copyright (C) Microsoft Corporation.  All rights reserved.

makefile(1) : fatal error U1052: file '..\..\include\cantera\Cantera.mak' not found
Stop.

C:\Program Files\Cantera\samples\f90>

Did I made it wrong? How can I build and run sample f77 and f90 programs?
Reply all
Reply to author
Forward
0 new messages