Help needed in compiling Cantera 2.1 source code.

728 views
Skip to first unread message

tuks123

unread,
Aug 7, 2013, 4:45:17 AM8/7/13
to canter...@googlegroups.com
This is the first time I am compiling Cantera source code. I absolutely have no knowledge of 'SCons', 'Boost', 'TSVN', etc.
 
I want to build and install Cantera 2.1 for use with Python 2.7.5 (No Matlab and no Sundials).
 
System configuration I am using is:
- Windows XP with Service Pack2 (64  bit)
- Microsoft Visual Studio 2008 installed.
- Python 2.7.5 (64bit) installed
- NumPy 1.7.1 (64bit) installed.
 
I have tried to follow the steps given in links below.
But I am unable to compile and install the Cantera.
 
Steps I followed are:
1. Downloaded and unzipped Cantera 2.1 source code into local drive say "D:\Tuks". [successful]
2. Downloaded and installed latest version TortoiseSVN 1.8.1. [successful]
3. Downloaded, unzipped SCons 2.2.0 into local drive and then installed by running "python setup.py install". [successful]
4. Downloaded and unzipped boost 1_54_0 into local drive. Followed boost build & installation instructions but couldn't get is installed. [Un-successfull]
 
 
Boost installation steps followed are given below:
a. Downloaded and unzipped boost 1_54_0 into local drive.
b. copy all contents of unzipped boost_1_54_0 folder into 'C:\Program Files\boost\boost_1_54_0" folder.
c. Open commanprompt into "C:\Program Files\boost\boost_1_54_0"
d. Run 'bootstrap.bat' [successful]
e. Run '.\b2' [successful]
 
After this, I Run the 'scons build' command from cantera-2.1.0b2 source code folder. Several configuration errors are reported. The config.log file is attached. [Un-successfull]
 
Can somebody help me with simple steps?
 
I may be doing some silly mistakes because I am not familiar with code compilation.
 
Thanks
Tuks.
 
 
config.log

Ray Speth

unread,
Aug 8, 2013, 10:53:49 PM8/8/13
to canter...@googlegroups.com
Tuks,

You have to tell SCons where to find Boost, using the options 'boost_inc_dir' and boost_lib_dir', e.g.

    scons build boost_inc_dir="C:\Program Files\boost\boost_1_54_0"

I'm a little unclear on whether you got Boost installed successfully or not. If you aren't trying to build a multithreaded version of Cantera (if you're just using it from Python, you don't need to) then you don't actually need any of the compiled parts of Boost; all you need is the header files that you got by extracting the archive. Otherwise, you'll have to look at the output of the Boost build commands to know where the compiled libraries ended up (I think you need to run 'b2 install' as well).

Regards,
Ray

tuks123

unread,
Aug 9, 2013, 3:40:02 AM8/9/13
to canter...@googlegroups.com
Hi Ray,
 
Thanks for reply!
 
Earlier I assumed we need to build boost to build Cantera.
 
Now it's clear that we don't need to build boost.
 
I unzipped 'boost_1_54_0.zip'. Then copied 'erf.hpp' file (needed to build Cantera) from "boost_1_54_0\boost\math\special_functions\" folder into "C:\Program Files\boost\boost_1_54_0\boost\math\special_functions\" folder. The I set boost include directory [build boost_inc_dir="C:\Program Files\boost\boost_1_54_0"] into cantera.conf file before building Cantera. The cantera.conf file is attached here.
 
The "C:\Program Files\boost\boost_1_54_0" was included in Windows enviroment variables "in Path as well in user variables'. But I still get 'erf.hpp' not found error. The scons build output is also attached.
 
Am I missing some settngs here?
 
Thanks
Tuks.
cantera.conf
scons_build_output.txt

tuks123

unread,
Aug 9, 2013, 10:25:25 AM8/9/13
to canter...@googlegroups.com
Hi Ray,
 
As you suggested, I run 'b2 install' command from boost_1_54_0 folder. And it installed boost in "C:\Boost\" folder. This folder has structure like 'C:\Boost\include\boost-1_54\boost" and "C:\Boost\lib".
 
I included both these paths in environmental variables.
 
But I still get 'erf' error.
 
I run following batch file to build Cantera (from Cantera-2.1.0b2 folder). This batch file contains following commands.
scons build --prefix="C:/Program Files/Cantera" --python_package='full' ^
--python_array_home="C:/Python27/Lib/site-packages/numpy" ^
--python_prefix="C:/Python27/Lib/site-packages" ^
--boost_inc_dir="C:/Boost/include/boost-1_54"
--boost_lib_dir="C:/Boost/lib"
The build OUTPUT is like:

D:\Tuks\cantera-2.1.0b2>scons build --prefix="C:/Program Files/Cantera" --python_package='full' --python_array_home="C:/Python27/Lib/site-packages/numpy"

--python_prefix="C:/Python27/Lib/site-packages" --boost_inc_dir="C:/Boost/include/boost-1_54"

scons: Reading SConscript files ...

Configuration variables read from 'cantera.conf' and command line:

WARNING: failed to propagate environment variable LD_LIBRARY_PATH

WARNING: failed to propagate environment variable PYTHONPATH

INFO: Skipping compilation of the Fortran 90 interface.

Checking for C++ header file cmath... yes

Checking for C header file sys/times.h... no

Checking for C header file unistd.h... no

Checking whether erf is declared... no

Checking for C++ header file boost/math/special_functions/erf.hpp... no

Checking for CVodeCreate(CV_BDF, CV_NEWTON) in C++ library sundials_cvodes... no

Checking for double x; log(x) in C library None... yes

WARNING: Cython not found or incompatible version: Found 0.0.0 but 0.17 or newer is required

INFO: Building the legacy Python package using numpy.

WARNING: The 'python_package=full' option is deprecated. This legacy Python package will be removed in Cantera 2.2. The new Python package may be build using 'python_package=new'.

INFO: Not building the Python 3 package because the Python 3 interpreter 'python3' could not be found
INFO: Sundials was not found. Building with minimal ODE solver capabilities.

ERROR: Couldn't find 'erf' in either <math.h> or Boost.Math

See 'config.log' for details.

I tried with building Cantera 2.0.2 and results is same error.
 
Am I doing some mistake in giving PATH to 'boost' directory?
 
Thanks
Tuks
config.log

Ray Speth

unread,
Aug 9, 2013, 11:23:29 AM8/9/13
to canter...@googlegroups.com
Hi Tuks,

The main problem is that you aren't specifying the SCons options in the correct way. It should be:

    scons build prefix="C:/Program Files/Cantera" python_package='full' ...

with no dashes. 

Since you are installing the Python module to the default location and you have Numpy installed in the default location, you do not need to specify values for those options.

Finally, the Windows "PATH" environment variable has no effect on where the compiler looks for header or library files. You always need to specify additional include and library paths explicitly to the build system (SCons).

Regards,
Ray

H.C. Lee

unread,
Aug 10, 2013, 8:14:38 AM8/10/13
to canter...@googlegroups.com
For those who are compiling/building Cantera in Windows platform:-

     32 bit
     1) Install Python 2.7.5 or newer
     2) Download Numpy (Must) and Cython (if desired) and install them.
     3) Download sundials from http://code.google.com/p/cantera/downloads/list
            - Extract the files and place it under c:/sundials for ease
            - If you prefer, you can download the sundials and install it using Cmake.
     3) Download boost (Don't have to install, just copy the entire folder)
     4) Download Window SDK from http://www.microsoft.com/download/en/details.aspx?id=3138
     5) Run scons build/test/install.

Example of *cantera.conf* file:-
prefix = 'C:\\Cantera'
python_package = 'new'
python_cmd = 'C:\\Python27\\python.exe'
python_array_home = 'C:\\Python27\\Lib\\site-packages\\numpy'
python3_package = 'y'
matlab_toolbox = 'y'
matlab_path = "C:\Program Files (x86)\MATLAB\R2012a"
f90_interface = 'n'
debug_verbose = 'yes'
use_sundials = 'y'
sundials_include = 'C:\\sundials\\include'
sundials_libdir = 'C:\\sundials\\lib'
boost_inc_dir = 'C:\\boost_1_54_0'
boost_lib_dir = 'C:\\boost_1_54_0\\libs'
F77 = None

If you get an error indicating missing "vcvarsall.bat" file, then download the file and place it under "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC' folder. I have not tried x64, but I believe it is almost the same.

Cheers,
Lee

tuks123

unread,
Aug 12, 2013, 3:17:29 AM8/12/13
to canter...@googlegroups.com
HI Lee and Ray,
 
Thanks for help. I was succeessfull in building and installing Cantera 2.1.0b2 with python 2.7.5 on Windows XP machine.
 
Probably using 'sundials' has rectified the issue. I am happy that I have Cantera 2.1 running now.
 
The 'cantera.conf' file used is attached here.
 
I couldn't create MSI installer for Cantera. The 'scons msi' gives error [AttributeError: 'SConsEnvironment' object has no attribute 'WiX':], output is also attached here.
 
Thanks again.
Tuks.
cantera.conf
scons_msi_error.txt

H.C. Lee

unread,
Aug 12, 2013, 11:42:35 AM8/12/13
to canter...@googlegroups.com
The reason for the failure to create MSI installer for Cantera is because you did not install WiX on your system.

You can download WiX from http://wix.sourceforge.net/ and install it.

With the WiX installed, you should be able to create MSI installer.

Cheers,
Lee

tuks123

unread,
Aug 20, 2013, 12:18:22 AM8/20/13
to canter...@googlegroups.com
Hi Lee,
 
I installed WiX and was able to create MSI installer.
 
But I don't see 'ck2cti.exe' in Cantear\bin folder, when I install Cantera 2.1 using 'scons install' OR using newly creatd MSI.
 
Is 'ck2cti.exe' depreciated in this version of Cantera? If yes, then how to conver chemkin files into cti?
 
Thanks
Tuks

Ray Speth

unread,
Aug 20, 2013, 10:22:07 AM8/20/13
to canter...@googlegroups.com
Hi Tuks,

The old ".exe" version of ck2cti was deprecated in Cantera 2.0, and removed in 2.1. You can use the new "ck2cti.py" script, which should be installed in the Cantera "bin" folder. The command line syntax is a bit different, but you can get the documentation for it by running:

    python C:\path\to\ck2cti.py --help

Regards,
Ray
Reply all
Reply to author
Forward
0 new messages