Cantera / cantera

Chemical kinetics, thermodynamics, and transport tool suite
https://cantera.org
Other
599 stars 346 forks source link

2.2.0 installation with MATLAB fails runCanteraTests.m.passed #285

Closed Gflat closed 8 years ago

Gflat commented 9 years ago

Troubleshooting a mac installation issue using homebrew/science (https://github.com/Homebrew/homebrew-science/issues/2170).

It seems that the installation is checking an outdated DYLD_ variable in the MATLAB installation path rather than preferring the (good) libraries available from the system.

Logs: https://gist.github.com/9f64e649446792e7c8ff

otool output using system libraries:

/usr/local/lib/libsundials_cvodes.2.dylib:
    /usr/local/lib/libsundials_cvodes.2.dylib (compatibility version 3.0.0, current version 3.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)

otool output using MATLAB libraries:

/Applications/MATLAB_R2014b.app/bin/maci64/libsundials_cvodes.2.dylib:
    @rpath/libsundials_cvodes.2.dylib (compatibility version 2.0.0, current version 2.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
tdsmith commented 9 years ago

This is the error message that's being thrown during the test:

===== Test Case Failure =====
Location: /private/tmp/cantera20150709-16151-icy3o9/test/matlab/testImport.m
Name:     testImportCTI

/private/tmp/cantera20150709-16151-icy3o9/interfaces/matlab/toolbox/@XML_Node/XML_Node.m at <a href="matlab: opentoline('/private/tmp/cantera20150709-16151-icy3o9/interfaces/matlab/toolbox/@XML_Node/XML_Node.m',20)">line 20</a>
/private/tmp/cantera20150709-16151-icy3o9/interfaces/matlab/toolbox/@Solution/Solution.m at <a href="matlab: opentoline('/private/tmp/cantera20150709-16151-icy3o9/interfaces/matlab/toolbox/@Solution/Solution.m',47)">line 47</a>
/private/tmp/cantera20150709-16151-icy3o9/interfaces/matlab/toolbox/importPhase.m at <a href="matlab: opentoline('/private/tmp/cantera20150709-16151-icy3o9/interfaces/matlab/toolbox/importPhase.m',17)">line 17</a>
/private/tmp/cantera20150709-16151-icy3o9/test/matlab/testImport.m at <a href="matlab: opentoline('/private/tmp/cantera20150709-16151-icy3o9/test/matlab/testImport.m',10)">line 10</a>

************************************************
                Cantera Error!                  
************************************************

Procedure: ct2ctml_string
Error:   Error converting input file "/private/tmp/cantera20150709-16151-icy3o9/data/inputs/h2o2.cti" to CTML.
Python command was: '/usr/local/opt/python/bin/python2.7'
The exit code was: 1
-------------- start of converter log --------------
sys.path: ['', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-12.0.5-py2.7.egg', '/usr/local/lib/python2.7/site-packages/setuptools-12.0.5-py2.7.egg', '/private/tmp/cantera20150709-16151-icy3o9/build/python2', '/private/tmp/cantera20150709-16151-icy3o9/cython/lib/python2.7/site-packages', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/usr/local/Cellar/numpy/1.9.1/libexec/nose/lib/python2.7/site-packages', '/Library/Python/2.7/site-packages', '/usr/local/lib/python2.7/site-packages']

Traceback (most recent call last):
  File "<string>", line 4, in <module>
  File "/private/tmp/cantera20150709-16151-icy3o9/build/python2/cantera/__init__.py", line 1, in <module>
    from ._cantera import *
ImportError: dlopen(/private/tmp/cantera20150709-16151-icy3o9/build/python2/cantera/_cantera.so, 2): Library not loaded: /usr/local/lib/libsundials_cvodes.2.dylib
  Referenced from: /private/tmp/cantera20150709-16151-icy3o9/build/python2/cantera/_cantera.so
  Reason: Incompatible library version: _cantera.so requires version 3.0.0 or later, but libsundials_cvodes.2.dylib provides version 2.0.0
--------------- end of converter log ---------------

so we suspect MATLAB is overriding the dynamic linker search path and is finding its own libsundials_cvodes.2.dylib instead of the one in /usr/local/lib. We would like to know what we can do to encourage MATLAB to find the sundials against which we built cantera.

speth commented 9 years ago

This is a pretty typical problem with Matlab (on Linux, the issue is usually with outdated versions of libstdc++ bundled with Matlab). While I would primarily regard this as a problem in Matlab, there is a hackish workaround in this case (which I posted previously on the Cantera Users' Group): get Cantera to link statically to the Sundials library by removing the Sundials shared libraries from /usr/local/lib before installing Cantera.

speth commented 8 years ago

This isn't quite fixed yet -- this will be effectively resolved once the Homebrew formula is updated to always use the Sundials submodule, and there's still an issue with the Matlab test hanging, even though the resulting module works just fine.

speth commented 8 years ago

Resolved by homebrew/homebrew-science@c7327d96 for both Cantera 2.2 and the current development version.