ecell / homebrew-ecell4

This project is NOT maintained now. Please use "pip install ecell" to install E-Cell4 on Mac or Linux.
GNU General Public License v2.0
0 stars 0 forks source link

[MacBook on OS X Yosemite] error: implicit instantiation of undefined template #1

Closed DSamuylov closed 8 years ago

DSamuylov commented 9 years ago

Hello,

I am trying to install ecell to my MacBook on OS X Yosemite, and I am having an error. I tried to reinstall boost, but it still doesn't work... I would highly appreciate if you could help me in solving this issue.

$ brew install ecell4
==> Installing ecell4 from ecell/homebrew-ecell4
==> Downloading http://dev.e-cell.org/downloads/ecell-4.0.0.zip
Already downloaded: /Library/Caches/Homebrew/ecell4-4.0.0.zip
==> cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/ecell4/4.0.0
==> make BesselTables
==> Downloading http://cython.org/release/Cython-0.23.2.zip
Already downloaded: /Library/Caches/Homebrew/ecell4--cython-0.23.2.zip
==> python -c import setuptools... --no-user-cfg install --prefix=/private/tmp/e
==> python setup.py build_ext
Last 15 lines from /Users/denis/Library/Logs/Homebrew/ecell4/04.python:
In file included from lib/ecell4/core.cpp:261:
In file included from ../ecell4/core/RandomNumberGenerator.hpp:11:
../ecell4/core/Real3.hpp:217:13: error: implicit instantiation of undefined template 'boost::hash<double>'
            hash<argument_type::value_type>()(val[2]);
            ^
/usr/local/include/boost/functional/hash/hash_fwd.hpp:23:31: note: template is declared here
    template <class T> struct hash;
                              ^
In file included from lib/ecell4/core.cpp:262:
In file included from ../ecell4/core/UnitSpecies.hpp:18:
../ecell4/core/get_mapper_mf.hpp:7:10: fatal error: 'unordered_map' file not found
#include <unordered_map>
         ^
6 errors generated.
error: command 'clang' failed with exit status 1

READ THIS: https://git.io/brew-troubleshooting
If reporting this issue please do so at (not Homebrew/homebrew):
  https://github.com/ecell/homebrew-ecell4/issues
kozo2 commented 9 years ago

Thanks @DSamuylov I forgot to add --HEAD option to how to tap ecell4. Could you try brew install ecell4 --HEAD instead ?

DSamuylov commented 9 years ago

Thank you for a prompt reply! I tried and I still have the same problem:

$ brew install ecell4 --HEAD
==> Installing ecell4 from ecell/homebrew-ecell4
==> Cloning https://github.com/ecell/ecell4.git
Updating /Library/Caches/Homebrew/ecell4--git
==> Checking out branch master
==> cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/ecell4/HEAD
==> make BesselTables
==> Downloading http://cython.org/release/Cython-0.23.2.zip
Already downloaded: /Library/Caches/Homebrew/ecell4--cython-0.23.2.zip
==> python -c import setuptools... --no-user-cfg install --prefix=/private/tmp/e
==> python setup.py build_ext
Last 15 lines from /Users/denis/Library/Logs/Homebrew/ecell4/04.python:
In file included from lib/ecell4/core.cpp:262:
In file included from ../ecell4/core/RandomNumberGenerator.hpp:11:
../ecell4/core/Real3.hpp:217:13: error: implicit instantiation of undefined template 'boost::hash<double>'
            hash<argument_type::value_type>()(val[2]);
            ^
/usr/local/include/boost/functional/hash/hash_fwd.hpp:23:31: note: template is declared here
    template <class T> struct hash;
                              ^
In file included from lib/ecell4/core.cpp:263:
In file included from ../ecell4/core/UnitSpecies.hpp:18:
../ecell4/core/get_mapper_mf.hpp:7:10: fatal error: 'unordered_map' file not found
#include <unordered_map>
         ^
6 errors generated.
error: command 'clang' failed with exit status 1

READ THIS: https://git.io/brew-troubleshooting
If reporting this issue please do so at (not Homebrew/homebrew):
  https://github.com/ecell/homebrew-ecell4/issues

My colleague tried to install it on a similar MacBook with OS X Yosemite and it worked for him. So maybe it is because I miss some libraries or should use a specific compiler?

kozo2 commented 9 years ago

Hi @DSamuylov Where did you install homebrew? If you did not install homebrew to /usr/local, could you please install homebrew to /usr/local and retry brew uninstall ecell4; brew install ecell4 --HEAD ?

DSamuylov commented 9 years ago

It is there:

$ which brew
/usr/local/bin/brew
kozo2 commented 9 years ago

Could you try mdfind -name unordered_map.hpp ? If there is no unordered_map.hpp , could you please retry brew update; brew upgrade; brew install boost; brew install ecell4 --HEAD ?

DSamuylov commented 9 years ago

Here we go:

$ mdfind -name unordered_map.hpp
/usr/local/Cellar/boost/1.58.0/include/boost/unordered_map.hpp
/usr/local/Cellar/boost/1.58.0/include/boost/unordered/unordered_map.hpp
/usr/local/Cellar/boost/1.58.0/include/boost/tr1/unordered_map.hpp
/usr/local/Cellar/boost/1.58.0/include/boost/ptr_container/ptr_unordered_map.hpp
/usr/local/Cellar/boost/1.58.0/include/boost/ptr_container/serialize_ptr_unordered_map.hpp
/usr/local/Cellar/boost/1.58.0/include/boost/serialization/unordered_map.hpp
/usr/local/lib/R/3.2/site-library/BH/include/boost/unordered/unordered_map.hpp
/usr/local/lib/R/3.2/site-library/BH/include/boost/unordered_map.hpp
/usr/local/Cellar/boost155/1.55.0_1/include/boost/ptr_container/ptr_unordered_map.hpp
/usr/local/Cellar/boost155/1.55.0_1/include/boost/ptr_container/serialize_ptr_unordered_map.hpp
/usr/local/Cellar/boost155/1.55.0_1/include/boost/unordered_map.hpp
/usr/local/Cellar/boost155/1.55.0_1/include/boost/unordered/unordered_map.hpp
/usr/local/Cellar/boost155/1.55.0_1/include/boost/tr1/unordered_map.hpp

I also tried to update brew as you wrote, and here the output:

...
Warning: boost-1.58.0 already installed
==> Installing ecell4 from ecell/homebrew-ecell4
==> Cloning https://github.com/ecell/ecell4.git
Updating /Library/Caches/Homebrew/ecell4--git
==> Checking out branch master
==> cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/ecell4/HEAD
==> make BesselTables
==> Downloading http://cython.org/release/Cython-0.23.2.zip
Already downloaded: /Library/Caches/Homebrew/ecell4--cython-0.23.2.zip
==> python -c import setuptools... --no-user-cfg install --prefix=/private/tmp/e
==> python setup.py build_ext
Last 15 lines from /Users/denis/Library/Logs/Homebrew/ecell4/04.python:
In file included from lib/ecell4/core.cpp:262:
In file included from ../ecell4/core/RandomNumberGenerator.hpp:11:
../ecell4/core/Real3.hpp:217:13: error: implicit instantiation of undefined template 'boost::hash<double>'
            hash<argument_type::value_type>()(val[2]);
            ^
/usr/local/include/boost/functional/hash/hash_fwd.hpp:23:31: note: template is declared here
    template <class T> struct hash;
                              ^
In file included from lib/ecell4/core.cpp:263:
In file included from ../ecell4/core/UnitSpecies.hpp:18:
../ecell4/core/get_mapper_mf.hpp:7:10: fatal error: 'unordered_map' file not found
#include <unordered_map>
         ^
6 errors generated.
error: command 'clang' failed with exit status 1

READ THIS: https://git.io/brew-troubleshooting
If reporting this issue please do so at (not Homebrew/homebrew):
  https://github.com/ecell/homebrew-ecell4/issues
kozo2 commented 9 years ago

It there /usr/local/include/boost/unordered_map.hpp ?

DSamuylov commented 9 years ago

Yes:

$ ls -l /usr/local/include/boost/unordered_map.hpp
-rw-r--r--  1 denis  admin   568B Oct  9 16:25 /usr/local/include/boost/unordered_map.hpp
kozo2 commented 9 years ago

Could you please add the following line to your .bashrc or .zshrc ?

export CPATH=/usr/local/include

And please retry brew install ecell4 --HEAD.

Thank you for your report, it seems we need to improve our homebrew formula.

kozo2 commented 9 years ago

And you might need to add this line to your .bashrc or .zshrc too.

export LIBRARY_PATH=/usr/local/lib
kozo2 commented 9 years ago

After add these lines, please make sure to source .bashrc or .zshrc before running homebrew.

source ~/.bashrc #or source ~/.zshrc
brew install ecell4 --HEAD
DSamuylov commented 9 years ago
$ echo $LIBRARY_PATH
/usr/local/lib

$ echo $CPATH
/usr/local/include

$ brew install ecell4 --HEAD
==> Installing ecell4 from ecell/homebrew-ecell4
==> Cloning https://github.com/ecell/ecell4.git
Updating /Library/Caches/Homebrew/ecell4--git
==> Checking out branch master
==> cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/ecell4/HEAD
==> make BesselTables
==> Downloading http://cython.org/release/Cython-0.23.2.zip
Already downloaded: /Library/Caches/Homebrew/ecell4--cython-0.23.2.zip
==> python -c import setuptools... --no-user-cfg install --prefix=/private/tmp/e
==> python setup.py build_ext
Last 15 lines from /Users/denis/Library/Logs/Homebrew/ecell4/04.python:
In file included from lib/ecell4/core.cpp:262:
In file included from ../ecell4/core/RandomNumberGenerator.hpp:11:
../ecell4/core/Real3.hpp:217:13: error: implicit instantiation of undefined template 'boost::hash<double>'
            hash<argument_type::value_type>()(val[2]);
            ^
/usr/local/include/boost/functional/hash/hash_fwd.hpp:23:31: note: template is declared here
    template <class T> struct hash;
                              ^
In file included from lib/ecell4/core.cpp:263:
In file included from ../ecell4/core/UnitSpecies.hpp:18:
../ecell4/core/get_mapper_mf.hpp:7:10: fatal error: 'unordered_map' file not found
#include <unordered_map>
         ^
6 errors generated.
error: command 'clang' failed with exit status 1

READ THIS: https://git.io/brew-troubleshooting
If reporting this issue please do so at (not Homebrew/homebrew):
  https://github.com/ecell/homebrew-ecell4/issues

It seems weird because it worked without any problem on a computer of a similar configuration of my colleague...

kaizu commented 9 years ago

I added a line to show the contents of config.h. Here, I show the result below in my environment, which is osx yosemite 10.10.5, brew 0.9.5, clang-700.1.76, and Xcode 7.1.

dhcp255-71:~ kaizu$ brew install ecell4 --HEAD --verbose
==> Installing ecell4 from ecell/homebrew-ecell4
==> Cloning https://github.com/ecell/ecell4.git
Updating /Library/Caches/Homebrew/ecell4--git
git config remote.origin.url https://github.com/ecell/ecell4.git
git config remote.origin.fetch +refs/heads/master:refs/remotes/origin/master
git fetch origin
==> Checking out branch master
git checkout -f master --
Already on 'master'
Your branch is up-to-date with 'origin/master'.
git reset --hard origin/master
HEAD is now at 4ac1f5c add Gitter badge
git submodule foreach --recursive git submodule sync
git submodule update --init --recursive
==> cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/ecell4/HEAD
-- The C compiler identification is AppleClang 7.0.0.7000176
-- The CXX compiler identification is AppleClang 7.0.0.7000176
-- Check for working C compiler: /usr/local/Library/ENV/4.3/clang
-- Check for working C compiler: /usr/local/Library/ENV/4.3/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/local/Library/ENV/4.3/clang++
-- Check for working CXX compiler: /usr/local/Library/ENV/4.3/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Boost version: 1.58.0
-- Looking for C++ include unordered_map
-- Looking for C++ include unordered_map - found
-- Performing Test HAVE_TR1_UNORDERED_MAP
-- Performing Test HAVE_TR1_UNORDERED_MAP - Failed
-- Looking for C++ include boost/unordered_map.hpp
-- Looking for C++ include boost/unordered_map.hpp - found
-- Performing Test HAVE_TR1_FUNCTIONAL
-- Performing Test HAVE_TR1_FUNCTIONAL - Failed
-- Looking for C++ include functional
-- Looking for C++ include functional - found
-- Looking for C++ include boost/functional/hash.hpp
-- Looking for C++ include boost/functional/hash.hpp - found
-- Performing Test HAVE_DECL_INFINITY
-- Performing Test HAVE_DECL_INFINITY - Success
-- Performing Test HAVE_ISFINITE
-- Performing Test HAVE_ISFINITE - Success
-- Performing Test HAVE_SINCOS
-- Performing Test HAVE_SINCOS - Failed
-- Configuring done
CMake Warning (dev):
  Policy CMP0042 is not set: MACOSX_RPATH is enabled by default.  Run "cmake
  --help-policy CMP0042" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  MACOSX_RPATH is not specified for the following targets:

   ecell4-bd
   ecell4-core
   ecell4-egfrd
   ecell4-gillespie
   ecell4-lattice
   ecell4-meso
   ecell4-ode

This warning is for project developers.  Use -Wno-dev to suppress it.

-- Generating done
-- Build files have been written to: /tmp/ecell420151022-3508-1jdcnlj
==> cat ecell4/core/config.h
/* WARNING! All changes made to this file will be lost! */
#ifndef __ECELL4_CONFIG_H
#define __ECELL4_CONFIG_H

#ifdef _MSC_BUILD
#define WIN32_MSC 1
#else
/* #undef WIN32_MSC */
#endif

/* #undef WITH_HDF5 */
/* #undef HAVE_VTK */
/* #undef HAVE_BOOST_REGEX */

#define HAVE_UNORDERED_MAP 1
#define HAVE_STD_HASH 1
#define HAVE_BOOST_UNORDERED_MAP_HPP 1
#define HAVE_BOOST_FUNCTIONAL_HASH_HPP 1
/* #undef HAVE_TR1_UNORDERED_MAP */
/* #undef HAVE_TR1_FUNCTIONAL */

#endif /* __ECELL4_CONFIG_H */
==> make BesselTables
Scanning dependencies of target make_cjy_table
Scanning dependencies of target make_sjy_table
...
==> python setup.py build_ext
running build_ext
cythoning lib/ecell4/core.pyx to lib/ecell4/core.cpp
building 'ecell4.core' extension
creating build
creating build/temp.macosx-10.10-intel-2.7
creating build/temp.macosx-10.10-intel-2.7/lib
creating build/temp.macosx-10.10-intel-2.7/lib/ecell4
creating build/ecell4
creating build/ecell4/core
clang -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I. -I.. -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c lib/ecell4/core.cpp -o build/temp.macosx-10.10-intel-2.7/lib/ecell4/core.o

This is the list of headers:

dhcp255-71:~ kaizu$ mdfind -name unordered_map.hpp
/usr/local/Cellar/boost/1.58.0/include/boost/tr1/unordered_map.hpp
/usr/local/Cellar/boost/1.58.0/include/boost/unordered/unordered_map.hpp
/usr/local/Cellar/boost/1.58.0/include/boost/unordered_map.hpp
/usr/local/Cellar/boost/1.58.0/include/boost/ptr_container/ptr_unordered_map.hpp
/usr/local/Cellar/boost/1.58.0/include/boost/ptr_container/serialize_ptr_unordered_map.hpp
/usr/local/Cellar/boost/1.58.0/include/boost/serialization/unordered_map.hpp
kozo2 commented 9 years ago

@DSamuylov If you are still in trouble, please try https://bintray.com/kozo2/generic/ecell4-wheels/view#files instead.

You can install ecell4 with

pip install THE_WHL_FILE
DSamuylov commented 9 years ago

@kozo2 I just tried with:

$ brew install ecell4 --HEAD --verbose

and it seems it works!

reading manifest file 'lib/ecell4.egg-info/SOURCES.txt'
writing manifest file 'lib/ecell4.egg-info/SOURCES.txt'
Copying lib/ecell4.egg-info to /usr/local/Cellar/ecell4/HEAD/libexec/lib/python2.7/site-packages/ecell4-4.0.0b2-py2.7.egg-info
running install_scripts
writing list of installed files to 'installed.txt'
==> Cleaning
==> Finishing up
==> Summary
🍺  /usr/local/Cellar/ecell4/HEAD: 68 files, 62M, built in 5.5 minutes

Thank you a lot!

However if I try:

$ pip install THE_WHL_FILE
Collecting THE-WHL-FILE
  Could not find a version that satisfies the requirement THE-WHL-FILE (from versions: )
No matching distribution found for THE-WHL-FILE
kozo2 commented 9 years ago

@DSamuylov Sorry, first please download appropriate whl file from https://bintray.com/kozo2/generic/ecell4-wheels/view#files And please replace THE_WHL_FILE to the downloaded filename.

DSamuylov commented 9 years ago

@kozo2 Ohh yes sure.. I just checked quickly that I can import now ecell4 from python. Should I still try to run pip?

kozo2 commented 9 years ago

@DSamuylov You don't need to run pip now. Please run PYTHONPATH=/usr/local/Cellar/ecell4/HEAD/libexec/lib/python2.7/site-packages python