Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building on os x 10.11.3 el capitan #70

Open
inancgumus opened this issue Feb 23, 2016 · 26 comments
Open

Building on os x 10.11.3 el capitan #70

inancgumus opened this issue Feb 23, 2016 · 26 comments

Comments

@inancgumus
Copy link

When try to build as:

mkdir build && cd build
cmake ..

cmake gives the following error:

FindEigen3.cmake
CMake Error at CMakeLists.txt:47 (find_package):
  By not providing "FindEigen3.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Eigen3", but
  CMake did not find one.

  Could not find a package configuration file provided by "Eigen3" with any
  of the following names:

    Eigen3Config.cmake
    eigen3-config.cmake

  Add the installation prefix of "Eigen3" to CMAKE_PREFIX_PATH or set
  "Eigen3_DIR" to a directory containing one of the above files.  If "Eigen3"
  provides a separate development package or SDK, be sure it has been
  installed.


-- Configuring incomplete, errors occurred!
See also "/Users/inanc/dev/deepdetect/build/CMakeFiles/CMakeOutput.log".

_CMAKE_MODULE_PATH set to:_

export CMAKE_MODULE_PATH=/usr/local/share/cmake/Modules

# the content of this directory contains cmake for eigen:

$  ls $CMAKE_MODULE_PATH | grep -i eigen
FindEigen3.cmake

It completely does not respect the path being set as described in the message. Such as: While CMAKE_MODULE_PATH is set to homebrew`s eigen cmake file directory, it does not respect that.

Can I send a bug fix for this?

@beniz
Copy link
Collaborator

beniz commented Feb 23, 2016

hi @DeeperX OSX is not a supported platform, only Ubuntu 14.04LTS is at the moment. However, any patch and fixes that you can submit and that do not break the reference platform builds are highly welcome and are to be brought into the codebase, yes.

@beniz
Copy link
Collaborator

beniz commented Feb 23, 2016

Also, have you tried cmake -DCMAKE_MODULE_PATH=/path/to/where ?

@inancgumus
Copy link
Author

inancgumus commented Feb 23, 2016

Hey @beniz Yes, I've did triy that but still had no chance. I can send a patch but I can't validate whether it would work on ubuntu or no.

@beniz
Copy link
Collaborator

beniz commented Feb 23, 2016

Great please do open a PR with description and usage example or send a patch if you cannot do otherwise, I can do the checking against the reference platform.

@beniz
Copy link
Collaborator

beniz commented Mar 1, 2016

Not sure where you are at with this one @DeeperX but a workaround to move a step further on OSX could be edit deepdetect/CMakeLists.txt, comment out find_package(Eigen3 REQUIRED) and replace include_directories("${EIGEN3_INCLUDE_DIR}") with include_directories("/path/to/eigen3"). If this works, then something else will probably fail, but this could pave the way to an OSX (unsupported) build.

@beniz
Copy link
Collaborator

beniz commented Mar 1, 2016

@neo01124
Copy link

Not sure where you are at with this one @DeeperX but a workaround to move a step further on OSX could be edit deepdetect/CMakeLists.txt, comment out find_package(Eigen3 REQUIRED) and replace include_directories("${EIGEN3_INCLUDE_DIR}") with include_directories("/path/to/eigen3").

Doing this leads me to -

-- Boost version: 1.60.0
-- Found the following Boost libraries:
--   filesystem
--   thread
--   system
--   chrono
--   date_time
--   atomic
-- CUDA detected: 7.5
-- Added CUDA NVCC flags for: sm_30
CMake Error at cmake/Cuda.cmake:264 (deepdetect_detect_darwin_version):
  Unknown CMake command "deepdetect_detect_darwin_version".
Call Stack (most recent call first):
  CMakeLists.txt:59 (include)


-- Configuring incomplete, errors occurred!

I couldn't find deepdetect_detect_darwin_version() in the repository, does this come from some other repo?

@beniz
Copy link
Collaborator

beniz commented Jun 21, 2016

I see a similar function in build/caffe_dd/src/caffe_dd/cmake/Utils.cmake. Not sure where Utils.cmake does come from, but you could try to modify it and put it into the deepdetect/cmake repository.

neo01124 referenced this issue in neo01124/deepdetect Jun 28, 2016
The functions deepdetect_detect_darwin_version() and deepdetect_option() can't be found while executing 
cmake ..

I have used @beniz suggestions pertaining to this https://github.com/beniz/deepdetect/issues/70#issuecomment-227422068 to fix that.
@neo01124
Copy link

I took deepdetect_detect_darwin_version() & deepdetect_option() from /caffe/cmake/Utils.cmake and put them in deepdetect/cmake/Cuda.cmake. This gives me a successful execution of

cmake ..

This is the output of cmake - http://pastebin.com/hvFSmwrV

make gives the following errors - http://pastebin.com/FJpPZuAP

All the errors seem to be of the type -
In file included from ./include/caffe/common.hpp:7: ./include/caffe/llogging.h:153:63: error: dynamic_cast from rvalue to reference type 'std::ostringstream &' (aka 'basic_ostringstream<char> &') throw CaffeErrorException(std::string(__FILE__) + ":" + SSTR(__LINE__) + " / Fatal Caffe error"); // XXX: cannot report the exact location of the trigger... ^~~~~~~~~~~~~~ ./include/caffe/llogging.h:70:19: note: expanded from macro 'SSTR' #define SSTR( x ) dynamic_cast< std::ostringstream & >( \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Any suggestion about what I could try?

@beniz
Copy link
Collaborator

beniz commented Jun 28, 2016

Thanks for pushing this further.

I'll be honest, this looks bad. It comes from our custom https://github.com/beniz/caffe/blob/master/include/caffe/llogging.h

Can you try replacing dynamic_cast with static_cast ?

EDIT: beware that Caffe is downloaded when calling cmake on a new build repository. To try the trick above you need to edit build/caffe_dd/src/caffe_dd/include/caffe/llogging.h.

@neo01124
Copy link

Thanks for replying.
Looks like the same bunch of errors with static_cast - http://pastebin.com/rzUmh4Cp

Could it be related to not having some library not being installed or configured properly or related to eigen in some way?

@beniz beniz changed the title Does not install eigen on os x 10.11.3 el capitan Building on os x 10.11.3 el capitan Jun 29, 2016
@beniz
Copy link
Collaborator

beniz commented Jun 29, 2016

So the difficulty appears to be with compiling our custom version of Caffe, available here: https://github.com/beniz/caffe/tree/master_dd_integ

FYI, this version replaces the fatal errors from original Caffe with C++ exception that can be safely caught by dd. If you would like to dig this further, you can try to directly compile the github repository above.

I will try to replicate your issue by building it up with clang and let you know.

@beniz
Copy link
Collaborator

beniz commented Jun 29, 2016

So, I cannot reproduce your error with clang, though there are other unrelated issues. If you know how to install gcc on OSX and select it for compiling Caffe, it should work, from gcc 4.8 to gcc 5.x.

@neo01124
Copy link

neo01124 commented Jun 30, 2016

I've started using an ec2 instance but I'll try this later. Thanks

@jordan-green-zz
Copy link

jordan-green-zz commented Jan 9, 2017

@neo01124 I had a similar issue on Ubuntu, which was related to Eigen being header only (and as such a cmake file not being needed). I overcame the issue by changing the CMakeLists.txt to:

find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library
    PATHS
    ${CMAKE_INSTALL_PREFIX}/include
    ${KDE4_INCLUDE_DIR}
    PATH_SUFFIXES eigen3 eigen
)

Hope this helps!
@beniz has anyone else had this issue? If you don't see a reason this would break builds on other platforms, I'm happy to PR it?

@beniz
Copy link
Collaborator

beniz commented Jan 9, 2017

Hi, this is strange that you would have an issue with Eigen on Ubuntu, unless you are using your own local version, or that there's a conflict due to Tensorflow build. I'll check on that particular case later on today though AFAIK all our daily builds are fine.

Is your patch for OSX ? I'm not sure I understand the KDE4 include ? I'm all in favor of a community supported OSX build. If your changes help with OSX you may be interested to build upon #153 and re-PR as needed with building instructions. If you are building on another platform, let me know which one.

@victorv
Copy link

victorv commented Mar 14, 2017

Same problem on :

Distributor ID: Ubuntu
Description: Ubuntu 14.04.5 LTS
Release: 14.04
Codename: trusty

@beniz
Copy link
Collaborator

beniz commented Mar 14, 2017

see whether #75 applies

@victorv
Copy link

victorv commented Mar 14, 2017

I am sure I can easily fix the problem by adding the FindEIGEN3 file which is missing in /usr/share... path. I want to find a clean install solution and also find a root cause.

@beniz
Copy link
Collaborator

beniz commented Mar 14, 2017

AFAIK root cause is cmake3 not including FindEigen whereas cmake2 did.

@victorv
Copy link

victorv commented Mar 14, 2017

Looks like cmake 3.x changed the syntax for modules and FindEIGEN3 was dropped in favor of pkg_config. I fixed the problem on Ubuntu 14.04.5 LTS - here is the PR.

@victorv
Copy link

victorv commented Mar 16, 2017

Using compile time casting rather than runtime casting avoids the problem noted earlier -

--- a/include/caffe/llogging.h
+++ b/include/caffe/llogging.h
@@ -67,8 +67,7 @@ class DateLogger {

#ifdef CAFFE_THROW_ON_ERROR
#include
-#define SSTR( x ) dynamic_cast< std::ostringstream & >(( std::ostringstream() << std::dec << x )).str()
+#define SSTR( x ) #x
class CaffeErrorException : public std::exception
{
public:

Deepdetect on darwin works using our caffe which is the latest caffe release. Updating deepdetect's caffe is a bit more involved. Let me know if there is still interest in supporting deepdetect on OS X.

@beniz
Copy link
Collaborator

beniz commented Mar 16, 2017

Hi, thanks. There will not be professional support for OSX. However, if they are small enough, non impacting changes, that would simplify the building on OSX, we would of course integrated them into master.
Regarding Caffe, I'd be surprised you can use the official Caffe release with DD without a lot of issues...

@victorv
Copy link

victorv commented Mar 16, 2017

@beniz thanks for the feedback. What are the issues with the latest caffe on DD?

We don't need support nor are we looking to run on OS X but if others are interested in it, we can update our fork.

@inancgumus
Copy link
Author

OS X support will be good actually, however someone can run it through a container as well.

@beniz
Copy link
Collaborator

beniz commented Mar 16, 2017

No troll intended, but from our experience, OSX support would be hell :) More seriously, see my comment above for inclusion of non impacting changes. Also, if some of you are successfully running the docker builds from OSX, please let us know so that we can point to a short documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants