problem following Cantera Compilation Guide

552 views
Skip to first unread message

BangShiuh Chen

unread,
Feb 3, 2016, 6:38:00 PM2/3/16
to Cantera Users' Group
Hi,

I am using Window 7 64 bits. I have installed Python3.4.3, visual C++ 2013, and Cantera. And it run well on Python. I want to make some modifications so I follow the compilation guide. Under the Installation prerequisite => windows, the third statement says:
 There is no 64-bit installer for SCons under Windows, so you will need to download the ZIP version. After extracting it, start a command prompt in the unzipped folder and run:
python setup.py install
  
So I downloaded the file source code.zip and extracted in C:/program files. I opened the command prompt at cantera-2.2.1. However, I can't get it run in the command prompt. Can anyone help me? I really need your help!

Ray Speth

unread,
Feb 3, 2016, 7:37:27 PM2/3/16
to Cantera Users' Group
Hi,

It would help if you explained what happened when you try to run the command to install SCons.

Incidentally, this bit of the instructions is a bit out of date. There is a 64-bit installer for the most recent version of SCons (2.4.1) for Windows, so you can use that instead.

Regards,
Ray

BangShiuh Chen

unread,
Feb 9, 2016, 4:38:03 PM2/9/16
to Cantera Users' Group
Hi,

I succeed to install scons, then I download the source code at https://github.com/Cantera/cantera/releases (2.2.1). I unzip the file to C:\program file\ , then I run scons help and scons build. However, the information appear in the command prompt is not what I expect. I suspect my c++ has problem. It is visual studio 2013.  

Thank you,

Bang-Shiuh


New Microsoft Word Document.docx

Michael

unread,
Feb 9, 2016, 5:12:42 PM2/9/16
to canter...@googlegroups.com

Did you specify MSVC 12 in the Cantera.conf file for Visual studio 2013.  The output file you attached shows MSVC 14 which is Visual Studio 2015 and not Visual Studio 2013.

 

I have Cantera Compiled Visual Studio 2013 with Sundial 2.5.  I have not tried 2015 yet.

 

Michael

--
You received this message because you are subscribed to the Google Groups "Cantera Users' Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cantera-user...@googlegroups.com.
To post to this group, send email to canter...@googlegroups.com.
Visit this group at https://groups.google.com/group/cantera-users.
For more options, visit https://groups.google.com/d/optout.

BangShiuh Chen

unread,
Feb 9, 2016, 7:29:51 PM2/9/16
to Cantera Users' Group
Hi ,Michael,

I uninstalled vs2015. But same message appear. I don't know why. Thank you for your reply.

Bang-Shiuh 
install problem.docx

Ray Speth

unread,
Feb 9, 2016, 9:38:10 PM2/9/16
to Cantera Users' Group
Bang-Shiuh.

You should not extract the source code into the "Program Files" directory, because your normal user account does not have permissions to write to that directory (hence the error). You should extract the source code and compile it somewhere else, e.g. in your home directory.

Also, please try to copy and paste the error text instead of taking a screenshot. This will make it easier for people to see and understand the errors you are encountering. Here are instructions for copying text from the Windows command prompt: http://www.howtogeek.com/howto/windows-vista/copy-to-the-clipboard-from-the-windows-command-prompt/ 

Regards,
Ray

BangShiuh Chen

unread,
Feb 10, 2016, 10:42:24 AM2/10/16
to Cantera Users' Group
Hi,

The "scons help" works, but "scons build -j4 blas_lapack_libs=lapack,blas" has error. Do I need to fix it or just leave it? Also I wonder if I should install sundials and how(on windows), since I am doing 1D simulation? Thank you.


C:\Users\chen1671\Downloads\cantera-2.2.1\cantera-2.2.1>scons build -j4 blas_lap
ack_libs=lapack,blas
scons: Reading SConscript files ...
INFO: SCons is using the following Python interpreter: C:\Anaconda2\Scripts\..\p
ython.exe
INFO: Compiling with MSVC 12.0
INFO: Compiling for architecture: amd64
INFO: Compiling using the following toolchain(s): ['default']
Configuration variables read from 'cantera.conf' and command line:
    blas_lapack_libs = 'lapack,blas'

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) yes
Checking whether erf is declared... (cached) yes
Checking for ::isnan(1.0)... (cached) yes
Checking for std::isnan(1.0)... (cached) yes
Checking for _isnan(1.0)... (cached) yes
Checking for C++ header file boost/math/special_functions/erf.hpp... (cached) no

Checking for std::shared_ptr<int> x... (cached) yes
Checking for CVodeCreate(CV_BDF, CV_NEWTON) in C++ library sundials_cvodes... (c
ached) no
Checking for double x; log(x) in C library None... (cached) no
INFO: Skipping compilation of the Fortran 90 interface.
INFO: Found Cython version 0.23.4 for Python 2.x.
INFO: Building the full Python package.
WARNING: Couldn't find '3to2'. Python examples will not work correctly.
INFO: Not building the Python 3 package because the Python 3 interpreter 'python
3' could not be found.
INFO: Sundials was not found. Building with minimal ODE solver capabilities.
scons: done reading SConscript files.
scons: Building targets ...
cl /Fobuild\ext\gtest\src\gtest-all.obj /c ext\gtest\src\gtest-all.cc /EHsc /MD
/nologo /D_SCL_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_WARNINGS /O2 /Zi /Fdbuild\ext
\gtest\src\gtest-all.obj.pdb /DGTEST_HAS_PTHREAD=0 /DNDEBUG /Iext\gtest /Iext\gt
est\include
gtest-all.cc
cl /Fobuild\ext\libexecstream\exec-stream.obj /c ext\libexecstream\exec-stream.c
pp /EHsc /MD /nologo /D_SCL_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_WARNINGS /O2 /Zi
 /Fdbuild\ext\libexecstream\exec-stream.obj.pdb /DNDEBUG
exec-stream.cpp
cl /Fobuild\ext\f2c_math\pcoef.obj /c ext\f2c_math\pcoef.c /MD /nologo /D_SCL_SE
CURE_NO_WARNINGS /D_CRT_SECURE_NO_WARNINGS /O2 /Zi /Fdbuild\ext\f2c_math\pcoef.o
bj.pdb /DNDEBUG /DUSE_CLOCK /DMSDOS /Iext\f2c_libs
cl /Fobuild\ext\f2c_math\polfit.obj /c ext\f2c_math\polfit.c /MD /nologo /D_SCL_
SECURE_NO_WARNINGS /D_CRT_SECURE_NO_WARNINGS /O2 /Zi /Fdbuild\ext\f2c_math\polfi
t.obj.pdb /DNDEBUG /DUSE_CLOCK /DMSDOS /Iext\f2c_libs
pcoef.c
polfit.c
cl /Fobuild\ext\f2c_math\printstring.obj /c ext\f2c_math\printstring.c /MD /nolo
go /D_SCL_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_WARNINGS /O2 /Zi /Fdbuild\ext\f2c_
math\printstring.obj.pdb /DNDEBUG /DUSE_CLOCK /DMSDOS /Iext\f2c_libs
printstring.c
cl /Fobuild\ext\f2c_math\pvalue.obj /c ext\f2c_math\pvalue.c /MD /nologo /D_SCL_
SECURE_NO_WARNINGS /D_CRT_SECURE_NO_WARNINGS /O2 /Zi /Fdbuild\ext\f2c_math\pvalu
e.obj.pdb /DNDEBUG /DUSE_CLOCK /DMSDOS /Iext\f2c_libs
ext\libexecstream\exec-stream.cpp(39) : fatal error C1083: Cannot open include f
ile: 'windows.h': No such file or directory
pvalue.c
scons: *** [build\ext\libexecstream\exec-stream.obj] Error 2
cl /Fobuild\ext\f2c_math\xercnt.obj /c ext\f2c_math\xercnt.c /MD /nologo /D_SCL_
SECURE_NO_WARNINGS /D_CRT_SECURE_NO_WARNINGS /O2 /Zi /Fdbuild\ext\f2c_math\xercn
t.obj.pdb /DNDEBUG /DUSE_CLOCK /DMSDOS /Iext\f2c_libs
xercnt.c
C:\Users\chen1671\Downloads\cantera-2.2.1\cantera-2.2.1\ext\gtest\src/gtest.cc(1
04) : fatal error C1083: Cannot open include file: 'windows.h': No such file or
directory
scons: *** [build\ext\gtest\src\gtest-all.obj] Error 2
scons: building terminated because of errors.

C:\Users\chen1671\Downloads\cantera-2.2.1\cantera-2.2.1>

Bryan W. Weber

unread,
Feb 10, 2016, 11:27:13 AM2/10/16
to Cantera Users' Group
Dear Bang-Shuih,

If I recall correctly, you also need to pass env_vars="all" to the command, so that all of the Visual Studio environment variables get passed. Try the command

scons build -j4 blas_lapack_libs=lapack,blas env_vars="all"

Are you sure you have BLAS and LAPACK libraries installed? That is not very typical for Windows. You do not need to build/install SUNDIALS, but if you want, you can build it according to the instructions included with the package.

Bryan

BangShiuh Chen

unread,
Feb 11, 2016, 5:33:24 PM2/11/16
to Cantera Users' Group
Hi,

There is an error when I enter these:

C:\Users\chen1671\Desktop\cantera-2.2.1>scons build -j4 blas_lapack_libs=lapack,
blas env_vars="all"
scons: Reading SConscript files ...
INFO: SCons is using the following Python interpreter: C:\Anaconda2\Scripts\..\p
ython.exe
INFO: Compiling with MSVC 12.0
INFO: Compiling for architecture: amd64
INFO: Compiling using the following toolchain(s): ['default']
Configuration variables read from 'cantera.conf' and command line:
    prefix = '/opt/cantera'
    blas_lapack_libs = 'lapack,blas'
    env_vars = 'all'
    optimize = False

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


Does that means my C++ is not working?

Bryan W. Weber

unread,
Feb 11, 2016, 9:28:20 PM2/11/16
to Cantera Users' Group
Yes, that's exactly what it means. What are the contents of config.log (you can post the file to the message)? Did you run SCons from a Visual Studio command prompt?

Bryan

BangShiuh Chen

unread,
Feb 12, 2016, 3:41:45 PM2/12/16
to Cantera Users' Group
Hi, 

I entered config.log in commend prompt and this appeared:

file C:\Users\chen1671\Desktop\cantera-2.2.1\SConstruct,line 726:
Configure(confdir = .sconf_temp)
scons: Configure: Checking for C++ header file cmath... 
scons: Configure: ".sconf_temp\conftest_0.cpp" is up to date.
scons: Configure: The original builder output was:
  |.sconf_temp\conftest_0.cpp <-
  |  |
  |  |#include <cmath>
  |  |
  |  |
  |
cl /Fo.sconf_temp\conftest_0.obj /c .sconf_temp\conftest_0.cpp /EHsc /MD /nologo /D_SCL_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_WARNINGS /Od /Ob0 /Zi /Fd.sconf_temp\conftest_0.obj.pdb
'cl' is not recognized as an internal or external command,
operable program or batch file.
scons: Configure: no


What is 'cl'? By the way, what version of scons should I instal if I am using MSVS 2013l? Thank you.


Bryan W. Weber

unread,
Feb 12, 2016, 4:10:13 PM2/12/16
to Cantera Users' Group
Dear Bang-Shuih,

cl is the name of the program on Windows that compiles the C/C++ files into object code. The fact that it can't be found most likely means that you did not run the Visual Studio command prompt. Please do so. If you have Windows 7, 8, or 10, you can simply search on the Windows Start Menu for "x64 vs" and something called the "x64 Native Tools Command Prompt" should be found. Use that to run SCons. You can use version 2.3 of SCons with Visual Studio 2013, I think, but the most recent version is 2.4.

Best,
Bryan

BangShiuh Chen

unread,
Feb 13, 2016, 4:40:55 PM2/13/16
to Cantera Users' Group
Hi, 

I am not so sure about how to use MSVS command prompt to run at cantera-2.2.1 file. 


C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64>scons install

scons: *** No SConstruct file found.
File "c:\Users\chen1671\AppData\Local\Enthought\Canopy\User\Lib\site-packages\sc
ons-2.4.1\SCons\Script\Main.py", line 923, in _main

Thank you!

Bryan W. Weber

unread,
Feb 13, 2016, 5:02:52 PM2/13/16
to Cantera Users' Group
Dear Bang-Shuih,

The first characters on every line tell you what directory you are working in. You need to be working in the Cantera directory (where you unzipped Cantera) for anything to work. cd is the command to change directories.

Bryan

BangShiuh Chen

unread,
Feb 14, 2016, 5:41:41 PM2/14/16
to Cantera Users' Group
Dear Bryan,

I run the MSVS command prompt.

C:\Users\chen1671\Desktop\cantera-2.2.1>scons install
scons: Reading SConscript files ...
INFO: SCons is using the following Python interpreter: C:\Anaconda2\Scripts\..\p
ython.exe
INFO: Compiling with MSVC 12.0
INFO: Compiling for architecture: amd64
INFO: Compiling using the following toolchain(s): ['default']
Configuration variables read from 'cantera.conf' and command line:
    prefix = '/opt/cantera'
    blas_lapack_libs = 'lapack,blas'
    env_vars = 'all'
    optimize = False

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) yes
Checking whether erf is declared... (cached) yes
Checking for ::isnan(1.0)... (cached) yes
Checking for std::isnan(1.0)... (cached) yes
Checking for _isnan(1.0)... (cached) yes
Checking for C++ header file boost/math/special_functions/erf.hpp... (cached) no

Checking for std::shared_ptr<int> x... (cached) yes
Checking for CVodeCreate(CV_BDF, CV_NEWTON) in C++ library sundials_cvodes... (c
ached) no
Checking for double x; log(x) in C library None... (cached) yes
INFO: Skipping compilation of the Fortran 90 interface.
INFO: Found Cython version 0.23.4 for Python 2.x.
INFO: Building the full Python package.
WARNING: Couldn't find '3to2'. Python examples will not work correctly.
INFO: Not building the Python 3 package because the Python 3 interpreter 'python
3' could not be found.
INFO: Sundials was not found. Building with minimal ODE solver capabilities.
scons: done reading SConscript files.
scons: Building targets ...
ConfigBuilder(["include\cantera\base\config.h"], ["include\cantera\base\config.h
.in"])
Generating include\cantera\base\config.h with the following settings:
    CANTERA_VERSION                     "2.2.1"
    CT_USE_STD_SHARED_PTR               1
    FTN_TRAILING_UNDERSCORE             1
    HAS_FENV_H                          1
    LAPACK_FTN_STRING_LEN_AT_END        1
    LAPACK_FTN_TRAILING_UNDERSCORE      1
    LAPACK_NAMES_LOWERCASE              1
    SUNDIALS_USE_LAPACK                 0
    SUNDIALS_VERSION                    0
    USE_GLOBAL_ISNAN                    1
    USE_STD_ISNAN                       1
    USE_UNDERSCORE_ISNAN                1

**I cut some part off**
 
link @c:\users\chen1671\appdata\local\temp\tmpnz6pgl.lnk
LINK : fatal error LNK1181: cannot open input file 'lapack.lib'
scons: *** [build\lib\cantera_shared.dll] Error 1181
scons: building terminated because of errors.


Can you help me to solve error1181? Thank you!

Bang-Shiuh Chen

Bryan W. Weber

unread,
Feb 14, 2016, 10:42:22 PM2/14/16
to Cantera Users' Group
Dear Bang-Shuih,

It is just what I told you earlier: are you sure that you have Lapack and Blas installed under the names lapack,blas and they are accessible on the path? This is really not common for Windows and the error indicates that you do not have them installed. You should delete that line from the file called cantera.conf in your cantera-2.2.1 folder, then run

scons clean
scons build

Bryan

BangShiuh Chen

unread,
Feb 15, 2016, 11:17:42 AM2/15/16
to Cantera Users' Group
Hi Bryan,

Thank you very much. I completed the compilation and no failed. By the way, is Cantera HTML documentation useful? Do you recommend me to build it? Thank you.

Bang-Shiuh 

BangShiuh Chen

unread,
Feb 15, 2016, 12:01:19 PM2/15/16
to Cantera Users' Group
Hi,

I have another problem. After I compiled cantera, I tried to run a c++ sample. For example:

#include "cantera/IdealGasMix.h"    // defines class IdealGasMix
#include "cantera/transport.h"      // transport properties
#include <cstdio>

and this appeared

IntelliSense: cannot open source file "cantera/IdealGasMix.h" c:\Users\chen1671\Desktop\cantera_cpp\cantera_cpp\cantera_cpp\Source.cpp

What should I do to run a c++ cantera code? Thank you!

Bang-Shiuh


Nick Curtis

unread,
Feb 15, 2016, 2:37:34 PM2/15/16
to Cantera Users' Group
Hi Bang,

You must add the path to the cantera include directories (probably C:\Users\chen1671\Desktop\cantera-2.2.1\ in your case), to the the list of include directories for VS (explore the solution/project compile/linking options).
You also will need to add the library directory (likely C:\Users\chen1671\Desktop\cantera-2.2.1\lib\) to the library directories and link against the cantera library (-lcantera).  
If you installed Sundials you will need to do the same for the Sundials includes/libraries

Nick

Bryan W. Weber

unread,
Feb 15, 2016, 2:43:33 PM2/15/16
to Cantera Users' Group
Dear Bang-Shuih,

The HTML documentation is very useful. However, you don't have to build it because we already did that for you and put it online: http://cantera.github.io/docs/sphinx/html/index.html

Best,
Bryan

BangShiuh Chen

unread,
Feb 15, 2016, 4:19:15 PM2/15/16
to Cantera Users' Group
Hi Nick,

Here is how I did it (attachment). It doesn't work. How should I change it? Thank you!

Bang-Shiuh 


install problem.docx

Nick Curtis

unread,
Feb 16, 2016, 2:02:40 PM2/16/16
to Cantera Users' Group
Bang,

That looks close to what you want.  I think the include directory should be:

C:\Users\chen1671\Desktop\cantera-2.2.1\include

And the lib directory:

C:\Users\chen1671\Desktop\cantera-2.2.1\lib

Although I'm not sure that it's not src/clib.  In any case, you can explore the C:\Users\chen1671\Desktop\cantera-2.2.1 folder to ensure you're giving the right paths.
The include directory should have a folder named "cantera" in it, that contains various subfolders (e.g. base, cython, oneD), and C-headers.
The lib directory should contain the cantera.lib file.

Nick

BangShiuh Chen

unread,
Feb 16, 2016, 4:04:02 PM2/16/16
to Cantera Users' Group
Hi Nick,

I got an error trying to run the demo c++ code. Do you know what is wrong? Thank you for the help!

Bang-Shiuh

Error 3 error C4996: 'std::_Copy_impl': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility 2132 1 cantera_cpp

BangShiuh Chen

unread,
Feb 16, 2016, 4:44:42 PM2/16/16
to Cantera Users' Group
Hi,

Also when I run "A very simple C++ program", errors appear.

Error 1 error LNK2019: unresolved external symbol "class Cantera::ThermoPhase * __cdecl Cantera::newPhase(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?newPhase@Cantera@@YAPEAVThermoPhase@1@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V34@@Z) referenced in function "void __cdecl simple_demo(void)" (?simple_demo@@YAXXZ) C:\Users\chen1671\Desktop\cantera_cpp\cantera_cpp\cantera_cpp\Source.obj cantera_cpp
Error 2 error LNK1120: 1 unresolved externals C:\Users\chen1671\Desktop\cantera_cpp\cantera_cpp\x64\Debug\cantera_cpp.exe cantera_cpp


Bang-Shiuh

BangShiuh Chen

unread,
Feb 22, 2016, 9:39:20 AM2/22/16
to Cantera Users' Group
Hi everyone,

Can you tell me what does "boost" do please? Is it require?

Bang-Shiuh
Reply all
Reply to author
Forward
0 new messages