jcaiuwyo / cantera

Automatically exported from code.google.com/p/cantera
0 stars 0 forks source link

Mac OS X Mountain Lion Install with Enthought Python #112

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I have never been able to get EPD and Cantera to work well with each other. I 
finally got the install to work yesterday and wanted to add a few of my steps, 
so that hopefully installing Cantera on a Mac will be possible for the common 
man.

First I installed XCode and the Command Line Tools from the App Store. 
Then I installed the EPD 64-bit OS X Python.
I installed the XQuartz from (http://xquartz.macosforge.org/trac/wiki)
Then I installed Homebrew.
From Homebrew, I installed 'gfortran'.
I installed Sundials from PNNL.

I was then finally able to pull down the Cantera code using svn and try to 
compile it. I got many errors about dependencies, when using clang to compile. 
My eventual working 'cantera.conf' contents is below:

CXX = 'clang++'
CC = 'clang'
python_package = 'full'
python_cmd = '/Library/Frameworks/EPD64.framework/Versions/Current/bin/python'
matlab_toolbox = 'n'
use_sundials = 'y'
sundials_include = '/usr/local/include'
sundials_libdir = '/usr/local/lib'
env_vars = 'all'
cxx_flags = '-v -isystem /usr/include/c++/4.2.1'
cc_flags = '-isystem /usr/include -isystem include -isystem 
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/S
DKs/MacOSX10.8.sdk/usr/include'

Making this software easier to compile and more accessible, should be number 
one priority for this project. If people have to go in and add compiler flags, 
just to get it to install properly, no one will want to use it. Hopefully the 
number of steps necessary to install this software can be drastically reduced 
in the near future. Being able to use 'pip' and install Cantera in a virtualenv 
would be a boon.

Original issue reported on code.google.com by jarod.mc...@gmail.com on 11 Sep 2012 at 5:36

GoogleCodeExporter commented 9 years ago
It should not be necessary to specify any of those include or library paths. 
Something is wrong with your compiler's setup if /usr/include isn't in the 
compiler's built-in search path.

I'd be curious what output you get from the following command (from the Cantera 
source directory):

    clang++ -v -fshow-source-location include/cantera/base/ct_defs.h

And also, please provide the output from 'scons build' (as well as the 
resulting config.log) you get when you try compiling without the custom values 
for cxx_flags and cc_flags.

'pip install cantera' is not going to happen because Cantera isn't just a 
Python module.

Original comment by yarmond on 11 Sep 2012 at 8:18

GoogleCodeExporter commented 9 years ago
Here is the output from 'clang++ -v -fshow-source-location 
include/cantera/base/ct_defs.h'

Apple clang version 4.0 (tags/Apple/clang-421.0.60) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin12.1.0
Thread model: posix
clang: warning: treating 'c-header' input as 'c++-header' when in C++ mode, 
this behavior is deprecated
 "/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.8.0 -emit-pch -disable-free -disable-llvm-verifier -main-file-name ct_defs.h -pic-level 1 -mdisable-fp-elim -relaxed-aliasing -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 133.3 -v -resource-dir /usr/bin/../lib/clang/4.0 -fmodule-cache-path /var/folders/hp/q_sr95t17sbcg1szr1q50xy00000gn/T/clang-module-cache -fdeprecated-macro -fdebug-compilation-dir /Users/jarodmccormick/Desktop/cantera -ferror-limit 19 -fmessage-length 80 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-dispatch-method=mixed -fobjc-default-synthesize-properties -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o include/cantera/base/ct_defs.h.gch -x c++-header include/cantera/base/ct_defs.h
clang -cc1 version 4.0 based upon LLVM 3.1svn default target 
x86_64-apple-darwin12.1.0
ignoring nonexistent directory 
"/usr/include/c++/4.2.1/i686-apple-darwin10/x86_64"
ignoring nonexistent directory "/usr/include/c++/4.0.0"
ignoring nonexistent directory "/usr/include/c++/4.0.0/i686-apple-darwin8/"
ignoring nonexistent directory "/usr/include/c++/4.0.0/backward"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/4.2.1
 /usr/include/c++/4.2.1/backward
 /usr/local/include
 /usr/bin/../lib/clang/4.0/include
 /usr/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.

Original comment by jarod.mc...@gmail.com on 11 Sep 2012 at 9:44

GoogleCodeExporter commented 9 years ago
And here is the config.log file without the extra cxx and cc flags.

scons build fails with the following output:

clang++ -o build/src/python/pycantera.os -c -Wall -fcolor-diagnostics 
-Wno-deprecated-declarations -O3 -DNDEBUG -g -fPIC -fno-strict-aliasing 
-fno-common -dynamic -DNDEBUG -g -O3 -arch x86_64 -isysroot 
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/S
DKs/MacOSX10.8.sdk/usr/include -Isrc 
-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer
/SDKs/MacOSX10.8.sdk/usr/include -I/usr/local/include 
-I/Library/Frameworks/EPD64.framework/Versions/7.3/include/python2.7 
-I/Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/n
umpy/core/include src/python/pycantera.cpp
In file included from src/python/pycantera.cpp:24:
In file included from src/clib/ct.h:7:
In file included from src/clib/clib_defs.h:7:
/usr/local/include/cantera/base/ct_defs.h:19:10: fatal error: 'cmath' file not
      found
#include <cmath>
         ^
1 error generated.
scons: *** [build/src/python/pycantera.os] Error 1
scons: building terminated because of errors.

Original comment by jarod.mc...@gmail.com on 11 Sep 2012 at 9:59

Attachments:

GoogleCodeExporter commented 9 years ago
I think the issue is with some of the compiler flags that are being picked up 
from the Python configuration variables "BASECFLAGS" and "OPT". Can you provide 
the output of the command:

     python -c 'from distutils.sysconfig import *; print get_config_var("BASECFLAGS"); print get_config_var("OPT")'

Whichever of these contains the "-isysroot ..." option is the one causing the 
problem. Please try editing src/python/SConscript and changing on lines 11 and 
12 from:

    CPPFLAGS=((gcv('BASECFLAGS') or '').split() +
              (gcv('OPT') or '').split()),

to:

    CPPFLAGS=[]

And compiling again. Assuming that fixes the compilation errors, can you also 
confirm that 'scons test' succeeds as well? If this works, it will require a 
bit of testing to make sure that this change doesn't have any adverse effects 
on other platforms.

Original comment by yarmond on 12 Sep 2012 at 2:57

GoogleCodeExporter commented 9 years ago
Fixed in r1901.

Original comment by yarmond on 30 Oct 2012 at 3:53