deepdetect icon indicating copy to clipboard operation
deepdetect copied to clipboard

Building on os x 10.11.3 el capitan

Open inancgumus opened this issue 10 years ago • 26 comments

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?

inancgumus avatar Feb 23 '16 17:02 inancgumus

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 avatar Feb 23 '16 17:02 beniz

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

beniz avatar Feb 23 '16 17:02 beniz

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.

inancgumus avatar Feb 23 '16 19:02 inancgumus

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 avatar Feb 23 '16 20:02 beniz

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 avatar Mar 01 '16 05:03 beniz

Also please look at http://stackoverflow.com/questions/5922016/cmake-cant-find-eigen3

beniz avatar Mar 01 '16 05:03 beniz

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?

neo01124 avatar Jun 21 '16 12:06 neo01124

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.

beniz avatar Jun 21 '16 12:06 beniz

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?

neo01124 avatar Jun 28 '16 15:06 neo01124

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.

beniz avatar Jun 28 '16 15:06 beniz

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?

neo01124 avatar Jun 29 '16 08:06 neo01124

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 avatar Jun 29 '16 08:06 beniz

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.

beniz avatar Jun 29 '16 18:06 beniz

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

neo01124 avatar Jun 30 '16 12:06 neo01124

@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?

jordan-green-zz avatar Jan 09 '17 06:01 jordan-green-zz

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.

beniz avatar Jan 09 '17 07:01 beniz

Same problem on :

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

victorv avatar Mar 14 '17 18:03 victorv

see whether #75 applies

beniz avatar Mar 14 '17 18:03 beniz

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.

victorv avatar Mar 14 '17 18:03 victorv

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

beniz avatar Mar 14 '17 18:03 beniz

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 avatar Mar 14 '17 20:03 victorv

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.

victorv avatar Mar 16 '17 03:03 victorv

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...

beniz avatar Mar 16 '17 03:03 beniz

@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.

victorv avatar Mar 16 '17 08:03 victorv

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

inancgumus avatar Mar 16 '17 09:03 inancgumus

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.

beniz avatar Mar 16 '17 10:03 beniz