Issue with scons build

665 views
Skip to first unread message

Marcelo Damasceno

unread,
Jun 29, 2015, 10:30:16 AM6/29/15
to canter...@googlegroups.com
I'm trying to compile cantera 2.2.0 with intel compilers, in order to couple it with a computational code of mine. I'm having this weird error while I'm running scons build:

marcelomrd@marcelomrd-mflab:~/Softwares/Sources/cantera-2.2.0$ scons build env_vars=all CC=icc CXX=icpc F77=ifort F90=ifort blas_lapack_libs=mkl_rt blas_lapack_dir=/home/marcelomrd/Softwares/Binaries/intel/composer_xe_2013.3.163/mkl/lib/intel64 prefix=/home/marcelomrd/Softwares/Binaries/cantera
scons: Reading SConscript files ...
INFO: SCons is using the following Python interpreter: /usr/bin/python
Encountered unexpected command line argument: 'F90'

It does not accept f90=ifort as a valid option... Could someone help me with that?

Bryan W. Weber

unread,
Jun 29, 2015, 11:16:56 AM6/29/15
to canter...@googlegroups.com
Hi Marcelo,

The option should be FORTRAN=ifort. This can be seen in the code: https://github.com/Cantera/cantera/blob/master/SConstruct#L379, but I don't think the documentation has been updated yet. I'll open an issue on GitHub to track this.

Thanks!
Bryan

Marcelo Damasceno

unread,
Jun 29, 2015, 1:04:54 PM6/29/15
to canter...@googlegroups.com

Weird...I have taken this option from the cantera tutorial, available at http://www.cantera.org/docs/sphinx/html/compiling.html:

Your final SCons call might then look something like:

scons build env_vars=all CC=icc CXX=icpc F90=ifort F77=ifort blas_lapack_libs=mkl_rt blas_lapack_dir=$(MKLROOT)/lib/intel64

Anyway, with your advice I was able to advance a little bit more, but I'm still stuck in this compilation.... The actual issue is the following:

Checking for C++ header file cmath... no
ERROR: The C++ compiler is not correctly configured.

Thanks again!

Nick Curtis

unread,
Jun 29, 2015, 1:31:45 PM6/29/15
to canter...@googlegroups.com
Marcelo,
What is the result of running icpc -V on the command line?

You should see something like this:
Intel(R) C++ Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 15.0.3.187 Build 20150407
Copyright (C) 1985-2015 Intel Corporation.  All rights reserved.

You can also go into the config.log file to see more about the specific error that occurred.
Finally, check Bryan's site for very good instructions on compilation of Cantera w/ the Intel Compilers

Nick

Marcelo Damasceno

unread,
Jun 29, 2015, 1:44:05 PM6/29/15
to canter...@googlegroups.com
Hi, Nick! 
I'm using the following version (that's the result you asked):
Intel(R) C++ Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 13.1.1.163 Build 20130313
Copyright (C) 1985-2013 Intel Corporation.  All rights reserved.

The relevant part of config.log is the following:
icpc -o .sconf_temp/conftest_0.o -c -vec-report0 -diag-disable 1478 -pthread -O3 -g -DNDEBUG .sconf_temp/conftest_0.cpp
sh: 1: icpc: not found
scons: Configure: no

I don't know why, but scons is not considering icpc as a valid command, but it is working fine when I type it in any folder in terminal...

Nick Curtis

unread,
Jun 29, 2015, 1:58:01 PM6/29/15
to canter...@googlegroups.com

Hi Marcelo,
Try adding the:

env_vars=all

to your .conf file (or calling scons with env_vars=all in the argument list).
This passed all your environment variables to scons (PATH, LD_LIBRARY_PATH, etc.) which does not happen by default

Nick

Nick Curtis

unread,
Jun 29, 2015, 1:59:30 PM6/29/15
to canter...@googlegroups.com
Oh, sorry.
I just noticed that was included in the call in your original post.  If it didn't get left out in the mean-time I'm not sure what the issue would be

Nick

Marcelo Damasceno

unread,
Jun 29, 2015, 2:03:24 PM6/29/15
to canter...@googlegroups.com
env_vars=all is already there... One more thing, in Bryan's site, the option f90=ifort seems valid:

f90_interface = 'y'
F90 = 'ifort'

Bryan W. Weber

unread,
Jun 29, 2015, 2:03:45 PM6/29/15
to canter...@googlegroups.com
Dear Marcelo,

The command was changed in January of last year, and I guess we forgot to update the documentation. You're the first to notice, so thank you!

Best,
Bryan

On Monday, June 29, 2015 at 1:58:01 PM UTC-4, Nick Curtis wrote:

Bryan W. Weber

unread,
Jun 29, 2015, 2:07:12 PM6/29/15
to canter...@googlegroups.com
Dear Marcelo,

I wrote those instructions before the change was made :-) Are you by any chance running as the root user (i.e. with sudo)? If so, you need to source the Intel environment variables from within the root environment.

Bryan

Marcelo Damasceno

unread,
Jun 29, 2015, 2:15:12 PM6/29/15
to canter...@googlegroups.com
As a matter of fact, I was. I had already run it as a simple user too, but i've forgotten to attach to this conversation... It returns the following error message:

icpc -o .sconf_temp/conftest_0.o -c -vec-report0 -diag-disable 1478 -pthread -O3 -g -DNDEBUG .sconf_temp/conftest_0.cpp
/usr/include/c++/4.9/cmath(41): catastrophic error: cannot open source file "bits/c++config.h"
  #include <bits/c++config.h>

Marcelo Damasceno

unread,
Jun 29, 2015, 2:22:32 PM6/29/15
to canter...@googlegroups.com
Looks like it is trying to use GCC instead of intel. Any chance there was a modification in the command for c++, as it happened for fortran?

Nick Curtis

unread,
Jun 29, 2015, 2:26:08 PM6/29/15
to canter...@googlegroups.com
The intel compilers are simply wrappers for GCC (with of course a lot of other optimizations, etc. added on)
It is expected behavior for them to try to load GCC headers

Most likely it's cause is that your intel compiler versions don't fully support gcc-4.9.
You can try this solution, or use update-alternatives to switch to an earlier GCC

Nick

Marcelo Damasceno

unread,
Jun 29, 2015, 3:40:13 PM6/29/15
to canter...@googlegroups.com
I managed to build it rearranging some .h files to the directory that was considered by cantera. Now I'm stuck at scons test.... Only one test failed, which I think is good news.

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

Tests passed: 516
Up-to-date tests skipped: 0
Tests failed: 1
Failed tests:
    - python2:test_reactor.TestReactorSensitivities.test_parameter_order2

Ray Speth

unread,
Jun 30, 2015, 12:29:23 AM6/30/15
to canter...@googlegroups.com
Hi,

I just wanted to offer a couple of clarifications on this. The Intel compilers are not wrappers for GCC, but they do use the implementation of the C++ standard library included with GCC (libstdc++), and versions of that move in-step with versions of GCC. The versions of libstdc++ that the Intel compiler is compatible with are sometimes behind what's installed on your system, which can result in errors like the one you reported (and has nothing to do with Cantera -- you would get the same error trying to compile any C++ code with the Intel compiler). The second answer on this StackOverflow question has what I think is a better solution than moving around any header files belonging to libstdc++ on your system.

Regards,
Ray

Ray Speth

unread,
Jun 30, 2015, 12:32:07 AM6/30/15
to canter...@googlegroups.com
Marcelo,

I'd appreciate seeing the full output from the failing test. If it's just an issue with a numeric comparison that has too tight of a tolerance, it's not a big deal, but if it's anything else it might need to be looked into.

Regards,
Ray

Marcelo Damasceno

unread,
Jun 30, 2015, 1:29:43 PM6/30/15
to canter...@googlegroups.com
Hi, Ray.

I've finally managed to install cantera, I guess. I'm having some issues when I try to compile a f90 file, calling the cantera environment (a sample file, for example). That's the output of a make all:

marcelomrd@marcelomrd-mflab:~/Softwares/Binaries/cantera/share/cantera/samples/f90$ make all
ifort  -o demo demo.o -L/home/marcelomrd/Softwares/Binaries/cantera/lib -lcantera_fortran -lcantera  -L/usr/lib -lsundials_cvodes -lsundials_ida -lsundials_nvecserial /home/marcelomrd/Softwares/Binaries/intel/composer_xe_2013.3.163/mkl/lib/intel64 -lmkl_rt -L/usr/lib -lboost_system -lpthread -lstdc++
ipo: warning #11010: file format not recognized for /home/marcelomrd/Softwares/Binaries/intel/composer_xe_2013.3.163/mkl/lib/intel64
ld: cannot find /home/marcelomrd/Softwares/Binaries/intel/composer_xe_2013.3.163/mkl/lib/intel64: File format not recognized
Makefile:16: recipe for target 'demo' failed
make: *** [demo] Error 1

Ray Speth

unread,
Jun 30, 2015, 4:31:54 PM6/30/15
to canter...@googlegroups.com
Marcelo,

Can you provide copies of (a) the Makefile you're using (b) the Cantera.mak file (somewhere in /home/marcelomrd/Softwares/Binaries/cantera/share/cantera/samples) and (c) the cantera.conf file (in the Cantera source directory) that shows the options that you used when compiling Cantera.

Thanks,
Ray

Marcelo Damasceno

unread,
Jun 30, 2015, 4:41:34 PM6/30/15
to canter...@googlegroups.com
I wasn't allowed by google to send the makefile, but it is that one which is available in cantera/share/cantera/samples/f90. The other files requested are included in this post.
Cantera.mak
cantera.conf

Ray Speth

unread,
Jun 30, 2015, 11:36:04 PM6/30/15
to canter...@googlegroups.com
Hi Marcelo,

This issue should be fixed by commits 812cbc4bc4 (master) and 5a23dab3b8 (2.2 maintenance branch). If you don't want to reinstall, you can probably just edit your Cantera.mak so that the definition of the variable CANTERA_BLAS_LAPACK_LIBS starts with "-L".

Regards,
Ray

Marcelo Damasceno

unread,
Jul 1, 2015, 8:32:11 AM7/1/15
to canter...@googlegroups.com
Thank you very much, Ray! Now it works properly!

Marcelo Damasceno

unread,
Jul 1, 2015, 4:17:22 PM7/1/15
to canter...@googlegroups.com
I intend to use cantera in a parallel computational code we've been developing for studying purposes. Is there a parallel way to compile cantera or should I do it in a serial way? I'm asking that because I tried to compile the very same example code using h5pfc (hdf5-openmpi-intel) and I couldn't do it.. The whole code we use here is compiled with h5pfc and h5pcc. Any ideas?

Ray Speth

unread,
Jul 1, 2015, 5:38:14 PM7/1/15
to canter...@googlegroups.com
Marcelo,

I'm assuming that these "compilers" are just wrappers for the Intel C++ compiler that specify some compilation options and include/library paths. If that's the case, I would suggest just compiling with the Intel compilers directly, as Cantera doesn't directly interact with MPI in any case, and so doesn't need to know these paths. If that doesn't work, can you post the full output of the 'scons build' command so we can see what's going wrong?

Regards,
Ray

Marcelo Damasceno

unread,
Jul 2, 2015, 4:09:39 PM7/2/15
to canter...@googlegroups.com
I am really trying to understand what just happened here... It seems I was able to compile cantera properly, using intel compilers, As I've told before, I have compiled and run a sample f90 code, which calculate the equilibrium state properties of a case in which a given mechanism is used. I was using 

gas = importPhase('h2o2.cti','ohmech')
t = 1200.0     ! K
p = 101325.0   ! Pa
call setState_TPX(gas, t, p, 'H2:1, O2:1, AR:2')

and everything worked as expected, the reactions were shown and the calculations were correct. However, when I tried to use 

gas = importPhase('gri30.cti','gri30_mix')
t = 1200.0     ! K
p = 101325.0   ! Pa
call setState_TPX(gas, t, p, 'CH4:1, O2:2, N2:3.76')

I've got the following results:

Initial state properties:

Temperature:      -1000.0     K
Pressure:         -1000.0     Pa
Density:          -1000.0     kg/m3
Molar Enthalpy:   -1000.0     J/kmol
Molar Entropy:    -1000.0     J/kmol-K
Molar cp:         -1000.0     J/kmol-K

 Equilibrium state properties:

Temperature:      -1000.0     K
Pressure:         -1000.0     Pa
Density:          -1000.0     kg/m3
Molar Enthalpy:   -1000.0     J/kmol
Molar Entropy:    -1000.0     J/kmol-K
Molar cp:         -1000.0     J/kmol-K

Viscosity:                -1000.0      Pa-s
Thermal conductivity:     -1000.0      W/m/K

Furthermore, the first test (which was correct) returns the very same result from now one... What could I've done wrong?

Ray Speth

unread,
Jul 3, 2015, 12:01:33 AM7/3/15
to canter...@googlegroups.com
Marcelo,

In the Fortran interface, the value '-999.999' (which seems to be being rounded to -1000.0 in the results that you show) is an indicator of an error condition, since there's no support for C++ style exception handling. If a function returns that value, you should be able to get the last error message with the function 'getCanteraError' (which takes a character(*) array as an argument).

Regards,
Ray

Marcelo Damasceno

unread,
Jul 3, 2015, 9:11:18 AM7/3/15
to canter...@googlegroups.com
Well, I tried to run another sample code (f77 example named isentropic) and it seems to show what is going wrong... for some reason python is no longer finding cantera: 

***********************************************************************
CanteraError thrown by ct2ctml_string:
Error converting input file "/home/marcelomrd/Softwares/Binaries/cantera/share/cantera/data/gri30.cti" to CTML.
Python command was: 'python'
The exit code was: 1
-------------- start of converter log --------------
sys.path: ['', '/usr/local/lib/python2.7/dist-packages/setuptools-18.0.1-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/pip-7.0.3-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/Cython-0.22.1-py2.7-linux-x86_64.egg', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client']

Traceback (most recent call last):
  File "<string>", line 4, in <module>
ImportError: No module named cantera
--------------- end of converter log ---------------
***********************************************************************

I just have no idea how to fix that.... And also, why that happened if I didn't change a thing?

Marcelo Damasceno

unread,
Jul 3, 2015, 9:23:01 AM7/3/15
to canter...@googlegroups.com
Update 1: I found an article in which this issue is related to Numpy, but it seems it loads properly, in both python3 and python:

>>> import sys; print(sys.version)
3.4.3 (default, Mar 26 2015, 22:03:40) 
[GCC 4.9.2]
>>> import numpy
>>> print(numpy.__version__)
1.9.2rc1

>>> import sys; print(sys.version)
2.7.9 (default, Apr  2 2015, 15:33:21) 
[GCC 4.9.2]
>>> import numpy
>>> print(numpy.__version__)
1.9.2rc1

Bryan W. Weber

unread,
Jul 3, 2015, 9:44:47 AM7/3/15
to canter...@googlegroups.com
Dear Marcelo,

It seems you built Cantera properly, but did you ever install it with [sudo] scons install (sudo is necessary if you install into the /usr/local/ directory)? The installation step puts the Cantera files into the correct directories. Did you try to import cantera from python and python3?

Bryan

Marcelo Damasceno

unread,
Jul 3, 2015, 10:18:54 AM7/3/15
to canter...@googlegroups.com
It is not imported:

>>> import cantera
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named cantera

And yes, I installed it as a common user, in my home directory.

Bryan W. Weber

unread,
Jul 3, 2015, 10:52:45 AM7/3/15
to canter...@googlegroups.com
Hi Marcelo,

It appears from the output of sys.path you posted earlier that the directory you installed Cantera into is not on your PYTHONPATH. When you installed Cantera, there should have been some output about a script that you should source in your .bashrc or .profile. As a test, can you tell us the output of the following command:

PYTHONPATH=~/.local/lib/python2.7/site-packages python -c "import cantera; print cantera.__version__"

Best,
Bryan

Marcelo Damasceno

unread,
Jul 3, 2015, 11:42:00 AM7/3/15
to canter...@googlegroups.com
The output is the following:
marcelomrd@marcelomrd-mflab:~/Softwares/Binaries/cantera/share/cantera/samples/f90$ PYTHONPATH=~/.local/lib/python2.7/site-packages python -c "import cantera; print cantera.__version__"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named cantera

Bryan W. Weber

unread,
Jul 3, 2015, 1:39:03 PM7/3/15
to canter...@googlegroups.com
Dear Marcelo,

Into what directory did you install Cantera? Can you put that directory for PYTHONPATH instead of the default that I used and try the same line again? Based on your prefix in your cantera.conf you posted earlier try something like PYTHONPATH=/home/marcelomrd/Softwares/Binaries/cantera/lib/python2.7/site-packages

The environment variable PYTHONPATH is basically just a way to add directories to the places that Python searches for modules, so you need to put or add the installed location of the Cantera module as the value of the PYTHONPATH, unless you install to one of the default directories (which I'd recommend. For instance, the default user-writable place is ~/.local, as I used previously. If you have no reason to prefer a different directory, I'd recommend setting your prefix to ~/.local and adding the ~/.local/bin directory to your (regular) PATH variable. Python should automatically look in that directory for modules, so there should be no need to add it to your PYTHONPATH.).

Did you see any output with a directory or a script file when you ran scons install? Can you please post the last few lines of output of scons install here?

Bryan

Marcelo Damasceno

unread,
Jul 3, 2015, 2:11:47 PM7/3/15
to canter...@googlegroups.com
Hi Bryan! First of all, I'd like to thank you for the patience you are having with all this issues. Answering to your questions, I installed cantera in /home/marcelomrd/Softwares/Binaries/cantera. When I use that directory for PYTHONPATH, it seems to work fine:

marcelomrd@marcelomrd-mflab:~/Softwares/Binaries/cantera/share/cantera/samples/f90$ PYTHONPATH=/home/marcelomrd/Softwares/Binaries/cantera/lib/python2.7/site-packages python -c "import cantera; print cantera.__version__"
2.2.0

These are the last output lines of scons install:

Cantera has been successfully installed.

File locations:

  applications                /home/marcelomrd/Softwares/Binaries/cantera/bin
  library files               /home/marcelomrd/Softwares/Binaries/cantera/lib
  C++ headers                 /home/marcelomrd/Softwares/Binaries/cantera/include
  samples                     /home/marcelomrd/Softwares/Binaries/cantera/share/cantera/samples
  data files                  /home/marcelomrd/Softwares/Binaries/cantera/share/cantera/data 
  Python 2 package (cantera)  /home/marcelomrd/Softwares/Binaries/cantera/lib/python2.7/site-packages
  Python 2 samples            /home/marcelomrd/Softwares/Binaries/cantera/lib/python2.7/site-packages/cantera/examples 
  Python 3 package (cantera)  /home/marcelomrd/Softwares/Binaries/cantera/lib/python3.4/site-packages
  Python 3 samples            /home/marcelomrd/Softwares/Binaries/cantera/lib/python3.4/site-packages/cantera/examples 
  setup script                /home/marcelomrd/Softwares/Binaries/cantera/bin/setup_cantera

The setup script configures the environment for Cantera. It is recommended that
you run this script by typing:

  source /home/marcelomrd/Softwares/Binaries/cantera/bin/setup_cantera

before using Cantera, or else include its contents in your shell login script.
    
scons: done building targets.

Bryan W. Weber

unread,
Jul 3, 2015, 3:33:11 PM7/3/15
to canter...@googlegroups.com
Dear Marcello,

Its my pleasure! I'm glad that worked. Now you should test your code by adding PYTHONPATH=/home/marcelomrd/Softwares/Binaries/cantera/lib/python2.7/site-packages to the command before you run the sample code. If that works, to fix this permanently, you basically have three options at this point:

1) Add

source /home/marcelomrd/Softwares/Binaries/cantera/bin/setup_cantera

to your ~/.profile or ~/.bashrc

2) Add

export PYTHONPATH=$PYTHONPATH:/home/marcelomrd/Softwares/Binaries/cantera/lib/python2.7/site-packages
export PATH=/home/marcelomrd/Softwares/Binaries/cantera/bin:$PATH

to your ~/.profile file or your ~/.bashrc file

3) Change your prefix to the ~/.local directory as I mentioned, and add

export PATH=~/.local/bin:$PATH

to your ~/.profile or ~/.bashrc

Best,
Bryan

Marcelo Damasceno

unread,
Jul 3, 2015, 4:42:12 PM7/3/15
to canter...@googlegroups.com
Thank you, Bryan, that solved the mentioned issues!
...
Reply all
Reply to author
Forward
0 new messages