cdcseacave / openMVS

open Multi-View Stereo reconstruction library
http://cdcseacave.github.io
GNU Affero General Public License v3.0
3.35k stars 910 forks source link

Issue with serialize in MVS/Interface.h #70

Closed hlzz closed 8 years ago

hlzz commented 8 years ago

Specifications like the version of the project, operating system, and hardware

I am using a macbook pro running OS X 10.11( El Capitan ). The cmake process works fine after a minor revision: -- cotire 1.7.8 loaded. -- Try OpenMP C flag = [ ] -- Performing Test OpenMP_FLAG_DETECTED -- Performing Test OpenMP_FLAG_DETECTED - Failed -- Try OpenMP C flag = [-fopenmp] -- Performing Test OpenMP_FLAG_DETECTED -- Performing Test OpenMP_FLAG_DETECTED - Failed -- Try OpenMP C flag = [/openmp] -- Performing Test OpenMP_FLAG_DETECTED -- Performing Test OpenMP_FLAG_DETECTED - Failed -- Try OpenMP C flag = [-Qopenmp] -- Performing Test OpenMP_FLAG_DETECTED -- Performing Test OpenMP_FLAG_DETECTED - Failed -- Try OpenMP C flag = [-openmp] -- Performing Test OpenMP_FLAG_DETECTED -- Performing Test OpenMP_FLAG_DETECTED - Failed -- Try OpenMP C flag = [-xopenmp] -- Performing Test OpenMP_FLAG_DETECTED -- Performing Test OpenMP_FLAG_DETECTED - Failed -- Try OpenMP C flag = [+Oopenmp] -- Performing Test OpenMP_FLAG_DETECTED -- Performing Test OpenMP_FLAG_DETECTED - Failed -- Try OpenMP C flag = [-qsmp] -- Performing Test OpenMP_FLAG_DETECTED -- Performing Test OpenMP_FLAG_DETECTED - Failed -- Try OpenMP C flag = [-mp] -- Performing Test OpenMP_FLAG_DETECTED -- Performing Test OpenMP_FLAG_DETECTED - Failed -- Try OpenMP CXX flag = [ ] -- Performing Test OpenMP_FLAG_DETECTED -- Performing Test OpenMP_FLAG_DETECTED - Failed -- Try OpenMP CXX flag = [-fopenmp] -- Performing Test OpenMP_FLAG_DETECTED -- Performing Test OpenMP_FLAG_DETECTED - Failed -- Try OpenMP CXX flag = [/openmp] -- Performing Test OpenMP_FLAG_DETECTED -- Performing Test OpenMP_FLAG_DETECTED - Failed -- Try OpenMP CXX flag = [-Qopenmp] -- Performing Test OpenMP_FLAG_DETECTED -- Performing Test OpenMP_FLAG_DETECTED - Failed -- Try OpenMP CXX flag = [-openmp] -- Performing Test OpenMP_FLAG_DETECTED -- Performing Test OpenMP_FLAG_DETECTED - Failed -- Try OpenMP CXX flag = [-xopenmp] -- Performing Test OpenMP_FLAG_DETECTED -- Performing Test OpenMP_FLAG_DETECTED - Failed -- Try OpenMP CXX flag = [+Oopenmp] -- Performing Test OpenMP_FLAG_DETECTED -- Performing Test OpenMP_FLAG_DETECTED - Failed -- Try OpenMP CXX flag = [-qsmp] -- Performing Test OpenMP_FLAG_DETECTED -- Performing Test OpenMP_FLAG_DETECTED - Failed -- Try OpenMP CXX flag = [-mp] -- Performing Test OpenMP_FLAG_DETECTED -- Performing Test OpenMP_FLAG_DETECTED - Failed -- Could NOT find OpenMP (missing: OpenMP_C_FLAGS OpenMP_CXX_FLAGS) -- Can't find OpenMP. Continuing without it. -- WARNING: BREAKPAD was not found: Please specify BREAKPAD directory using BREAKPAD_ROOT env. variable -- Can't find BreakPad. Continuing without it. -- Boost version: 1.60.0 -- Found the following Boost libraries: -- iostreams -- program_options -- system -- serialization -- Eigen 3.2.7 found (include: /usr/local/include/eigen3) -- OpenCV 2.4.9 found (include: /usr/local/include/opencv;/usr/local/include) -- CGAL 4.7 found (include: /usr/local/Cellar/cgal/4.7/include) -- VCG found (include: /usr/local/include) -- Found required Ceres dependency: Eigen version 3.2.7 in /usr/local/include/eigen3 -- Found required Ceres dependency: Glog in /usr/local/include -- Found Ceres version: 1.11.0 installed in: /usr/local -- CERES 1.11.0 found (include: /usr/local/include;/usr/local/include/eigen3;/usr/local/include;/usr/local/include) -- ceres library ceres -- Configuring done -- Generating done

Steps to reproduce the problem

[ 20%] Built target Common [ 31%] Built target Math [ 58%] Built target IO Scanning dependencies of target MVS [ 59%] Building CXX object libs/MVS/CMakeFiles/MVS.dir/Scene.cpp.o In file included from /Users/STW/Documents/Projects/brainstorm/src/openMVS/libs/MVS/Scene.cpp:35: /Users/STW/Documents/Projects/brainstorm/src/openMVS/libs/MVS/Interface.h:85:23: error: member reference base type 'unsigned long' is not a structure or union const_cast<_Tp&>(obj).serialize(a, 0);


/Users/STW/Documents/Projects/brainstorm/src/openMVS/libs/MVS/Interface.h:183:2: note: 
      in instantiation of function template specialization
      'ARCHIVE::Save<unsigned long>' requested here
        Save(a, size);
        ^
/Users/STW/Documents/Projects/brainstorm/src/openMVS/libs/MVS/Interface.h:90:5: error: 
      member reference base type 'unsigned long' is not a structure or union
        obj.serialize(a, 0);
        ~~~^~~~~~~~~~
/Users/STW/Documents/Projects/brainstorm/src/openMVS/libs/MVS/Interface.h:191:2: note: 
      in instantiation of function template specialization
      'ARCHIVE::Load<unsigned long>' requested here
        Load(a, size);
        ^
2 errors generated.
make[2]: **\* [libs/MVS/CMakeFiles/MVS.dir/Scene.cpp.o] Error 1
make[1]: **\* [libs/MVS/CMakeFiles/MVS.dir/all] Error 2
make: **\* [all] Error 2

I am aware that OSX is not fully supported at this stage. The project compiles smoothly except for this serialization error, if I comment out 'const_cast<_Tp&>(obj).serialize(a, 0);' and  'obj.serialize(a, 0);'. (Thanks to Meekohi's pull request: https://github.com/cdcseacave/openMVS/pull/15). Any hints about this error? I'd like to provide some helps on the mac compilation. Thanks.
cdcseacave commented 8 years ago

Strange! I just tried to compile OpenMVS with clang 3.8 on Ubuntu (as I do not have Mac) and it works fine. If you are comfortable debugging, it should be quite easy, as that file is self-contained, so if there is a problem is in that file. If you find a solution please post it here. Thx.

cdcseacave commented 8 years ago

can you please try to add this line at line 152:

ARCHIVE_DEFINE_TYPE(size_t)
cdcseacave commented 8 years ago

I have added it in the last push, so just reset your entire source code to the latest code on the repository

hlzz commented 8 years ago

Great, this patch solves the problem.

cdcseacave commented 8 years ago

Could you please help listing the steps you took to build OpenMVS on Mac? So that I complete the build Wiki. Thx!

hlzz commented 8 years ago

Sure,

  1. set OpenMVS_USE_CUDA to OFF due to an error of CMake on mac.
  2. install vcglib, eigen, boost, etc. to the right place. (some of the dependencies have already been there on my mac)
  3. mkdir build_mac && cmake ..
  4. revise the code a little bit if it encounters error. (https://github.com/cdcseacave/openMVS/pull/15/files is a super-set of the stuff that needs to be done)
  5. iterate 3-4 until successful.

Hope it helps.

cdcseacave commented 8 years ago

actually issue 15 is outdated, I have solve the clang issues, it should compile from the first try

I am in fact interested in listing the steps you took instaling the dependencies, that is the part I do not know how is done on mac so that I can fill the wiki

Could you write something similar to the Ubuntu version https://github.com/cdcseacave/openMVS/wiki/Building?

hlzz commented 8 years ago

For your reference:

# Install dependencies
brew install opencv boost cgal eigen ceres-solver
svn checkout svn://svn.code.sf.net/p/vcg/code/trunk/vcglib vcglib

# Getting the OpenMVS sources:
git clone https://github.com/cdcseacave/openMVS.git

# Build OpenMVS
cd openMVS
mkdir build_mac
cd build_mac
cmake ../ -DCMAKE_BUILD_TYPE=RELEASE -DVCG_DIR="<vcglib_path>"

I use brew to install the dependencies. The above commands should suffice. However, as I don't have a clean mac, we'd better test it on a clean osx. For example, it seems that the cgal library of homebrew is incompatible with openMVS. I built cgal from source and openMVS intelligently found it.

cdcseacave commented 8 years ago

Thank you a lot for this steps, that is what I needed.