patrikhuber / eos

A lightweight 3D Morphable Face Model library in modern C++
Apache License 2.0
1.89k stars 596 forks source link

Build error v1.2.1 on Mac OS X Catalina #321

Closed pranny closed 1 year ago

pranny commented 3 years ago

I cloned and checked out v1.2.1, and followed build instructions with Generator as "Unix Makefiles". I am getting this error below.

Make output

Pranavs-MacBook-Pro-2:build pranav$ make install
Scanning dependencies of target fit-model-simple
[ 10%] Building CXX object examples/CMakeFiles/fit-model-simple.dir/fit-model-simple.cpp.o
In file included from /Users/pranav/workspace/eos/examples/fit-model-simple.cpp:26:
In file included from /Users/pranav/workspace/eos/include/eos/fitting/RenderingParameters.hpp:35:
In file included from /Users/pranav/workspace/eos/3rdparty/cereal/include/cereal/archives/json.hpp:62:
/Users/pranav/workspace/eos/3rdparty/cereal/include/cereal/external/rapidjson/document.h:597:9: warning: 'GenericValue' has a non-throwing exception specification but can still
      throw [-Wexceptions]
        CEREAL_RAPIDJSON_ASSERT(type <= kNumberType);
        ^
/Users/pranav/workspace/eos/3rdparty/cereal/include/cereal/archives/json.hpp:46:3: note: expanded from macro 'CEREAL_RAPIDJSON_ASSERT'
  throw ::cereal::RapidJSONException("rapidjson internal assertion failure: " #x); }
  ^
/Users/pranav/workspace/eos/3rdparty/cereal/include/cereal/external/rapidjson/document.h:2357:66: note: in instantiation of member function
      'rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >::GenericValue' requested here
    bool StartObject() { new (stack_.template Push<ValueType>()) ValueType(kObjectType); return true; }
                                                                 ^
/Users/pranav/workspace/eos/3rdparty/cereal/include/cereal/external/rapidjson/reader.h:1671:77: note: in instantiation of member function
      'rapidjson::GenericDocument<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>, rapidjson::CrtAllocator>::StartObject' requested here
            bool hr = (dst == IterativeParsingObjectInitialState) ? handler.StartObject() : handler.StartArray();
                                                                            ^
/Users/pranav/workspace/eos/3rdparty/cereal/include/cereal/external/rapidjson/reader.h:1832:39: note: in instantiation of function template specialization
      'rapidjson::GenericReader<rapidjson::UTF8<char>, rapidjson::UTF8<char>, rapidjson::CrtAllocator>::Transit<272, rapidjson::BasicIStreamWrapper<std::__1::basic_istream<char> >,
      rapidjson::GenericDocument<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>, rapidjson::CrtAllocator> >' requested here
            IterativeParsingState d = Transit<parseFlags>(state, t, n, is, handler);
                                      ^
/Users/pranav/workspace/eos/3rdparty/cereal/include/cereal/external/rapidjson/reader.h:487:20: note: in instantiation of function template specialization
      'rapidjson::GenericReader<rapidjson::UTF8<char>, rapidjson::UTF8<char>, rapidjson::CrtAllocator>::IterativeParse<272,
      rapidjson::BasicIStreamWrapper<std::__1::basic_istream<char> >, rapidjson::GenericDocument<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>,
      rapidjson::CrtAllocator> >' requested here
            return IterativeParse<parseFlags>(is, handler);
                   ^
/Users/pranav/workspace/eos/3rdparty/cereal/include/cereal/external/rapidjson/document.h:2159:40: note: in instantiation of function template specialization
      'rapidjson::GenericReader<rapidjson::UTF8<char>, rapidjson::UTF8<char>, rapidjson::CrtAllocator>::Parse<272, rapidjson::BasicIStreamWrapper<std::__1::basic_istream<char> >,
      rapidjson::GenericDocument<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>, rapidjson::CrtAllocator> >' requested here
        parseResult_ = reader.template Parse<parseFlags>(is, *this);
                                       ^
/Users/pranav/workspace/eos/3rdparty/cereal/include/cereal/external/rapidjson/document.h:2185:16: note: in instantiation of function template specialization
      'rapidjson::GenericDocument<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>, rapidjson::CrtAllocator>::ParseStream<272, rapidjson::UTF8<char>,
      rapidjson::BasicIStreamWrapper<std::__1::basic_istream<char> > >' requested here
        return ParseStream<kParseDefaultFlags, Encoding, InputStream>(is);
               ^
/Users/pranav/workspace/eos/3rdparty/cereal/include/cereal/archives/json.hpp:438:21: note: in instantiation of function template specialization
      'rapidjson::GenericDocument<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>,
      rapidjson::CrtAllocator>::ParseStream<rapidjson::BasicIStreamWrapper<std::__1::basic_istream<char> > >' requested here
        itsDocument.ParseStream<>(itsReadStream);
                    ^
/Users/pranav/workspace/eos/3rdparty/cereal/include/cereal/external/rapidjson/document.h:592:14: note: function declared non-throwing here
    explicit GenericValue(Type type) CEREAL_RAPIDJSON_NOEXCEPT : data_() {
             ^                       ~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/pranav/workspace/eos/3rdparty/cereal/include/cereal/external/rapidjson/document.h:756:9: warning: 'operator=' has a non-throwing exception specification but can still throw
      [-Wexceptions]
        CEREAL_RAPIDJSON_ASSERT(this != &rhs);
        ^
/Users/pranav/workspace/eos/3rdparty/cereal/include/cereal/archives/json.hpp:46:3: note: expanded from macro 'CEREAL_RAPIDJSON_ASSERT'
  throw ::cereal::RapidJSONException("rapidjson internal assertion failure: " #x); }
  ^
/Users/pranav/workspace/eos/3rdparty/cereal/include/cereal/external/rapidjson/document.h:2162:24: note: in instantiation of member function
      'rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >::operator=' requested here
            ValueType::operator=(*stack_.template Pop<ValueType>(1));// Move value from stack to document
                       ^
/Users/pranav/workspace/eos/3rdparty/cereal/include/cereal/external/rapidjson/document.h:2185:16: note: in instantiation of function template specialization
      'rapidjson::GenericDocument<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>, rapidjson::CrtAllocator>::ParseStream<272, rapidjson::UTF8<char>,
      rapidjson::BasicIStreamWrapper<std::__1::basic_istream<char> > >' requested here
        return ParseStream<kParseDefaultFlags, Encoding, InputStream>(is);
               ^
/Users/pranav/workspace/eos/3rdparty/cereal/include/cereal/archives/json.hpp:438:21: note: in instantiation of function template specialization
      'rapidjson::GenericDocument<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>,
      rapidjson::CrtAllocator>::ParseStream<rapidjson::BasicIStreamWrapper<std::__1::basic_istream<char> > >' requested here
        itsDocument.ParseStream<>(itsReadStream);
                    ^
/Users/pranav/workspace/eos/3rdparty/cereal/include/cereal/external/rapidjson/document.h:755:19: note: function declared non-throwing here
    GenericValue& operator=(GenericValue& rhs) CEREAL_RAPIDJSON_NOEXCEPT {
                  ^                            ~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
[ 20%] Linking CXX executable fit-model-simple
[ 20%] Built target fit-model-simple
Scanning dependencies of target fit-model-multi
[ 30%] Building CXX object examples/CMakeFiles/fit-model-multi.dir/fit-model-multi.cpp.o
In file included from /Users/pranav/workspace/eos/examples/fit-model-multi.cpp:31:
In file included from /Users/pranav/workspace/eos/include/eos/render/render.hpp:27:
  /Users/pranav/workspace/eos/include/eos/render/SoftwareRenderer.hpp:400:42: error: template parameter redefines default argument
  template <typename T, glm::precision P = glm::defaultp>
                                         ^
  /Users/pranav/workspace/eos/include/eos/render/SoftwareRenderer.hpp:56:42: note: previous default template argument defined here
  template <typename T, glm::precision P = glm::defaultp>
                                         ^
  1 error generated.
  make[2]: *** [examples/CMakeFiles/fit-model-multi.dir/fit-model-multi.cpp.o] Error 1
  make[1]: *** [examples/CMakeFiles/fit-model-multi.dir/all] Error 2
  make: *** [all] Error 2

Build output log

Pranavs-MacBook-Pro-2:build pranav$ cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=../install  -DEOS_GENERATE_PYTHON_BINDINGS=on -DPYTHON_EXECUTABLE=`which python3` ..
-- The CXX compiler identification is AppleClang 11.0.3.11030032
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Options:
-- EOS_BUILD_EXAMPLES: ON
-- EOS_BUILD_CERES_EXAMPLE: OFF
-- EOS_BUILD_UTILS: OFF
-- EOS_BUILD_DOCUMENTATION: OFF
-- EOS_GENERATE_PYTHON_BINDINGS: on
-- EOS_GENERATE_MATLAB_BINDINGS: OFF
-- Eigen3 found: TRUE, version: 3.3.4
-- Eigen3 include dir found at /Users/pranav/workspace/eos/3rdparty/eigen
-- Found OpenCV: /usr/local/Cellar/opencv/4.4.0 (found version "4.4.0") found components: core
-- OpenCV 4.x detected - including imgcodecs for compatibility
-- Found OpenCV: /usr/local/Cellar/opencv/4.4.0 (found suitable version "4.4.0", minimum required is "4") found components: core imgproc imgcodecs
-- Found Boost: /usr/local/lib/cmake/Boost-1.73.0/BoostConfig.cmake (found suitable version "1.73.0", minimum required is "1.50.0") found components: system filesystem program_options
-- Boost found at /usr/local/include
-- pybind11 v2.6.0 dev
-- Found PythonInterp: /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 (found version "3.7.2")
-- Found PythonLibs: /Library/Frameworks/Python.framework/Versions/3.7/lib/libpython3.7m.dylib
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/pranav/workspace/eos/build
patrikhuber commented 3 years ago

Hi Pranav,

Thank you for reporting this. Looks like the default template argument of clip_polygon_to_plane_in_4d is specified twice and AppleClang doesn't like that, and for some reasons other compilers accept it.

The fix should be simple: Here https://github.com/patrikhuber/eos/blob/41d5af0971ebcf1d65a7f5bcf2465c1451c7484d/include/eos/render/SoftwareRenderer.hpp#L400, can you change this to template <typename T, glm::precision P> and see whether it fixes the error?

Thanks!

pranny commented 3 years ago

HI Patrik,

That does solve the issue. It was a very minor issue, and I could've caught it but C++ isn't my first language. Thanks for the quick resolution. Closing this issue now.

patrikhuber commented 3 years ago

Thanks a lot for reporting back. Great that this worked. I'll re-open / leave this open, as I should probably check this and fix it / change it permanently.

DenysVolkov commented 3 years ago

Hello Patrik and Pranav,

I am also trying to build EOS on MacOS Catalina, so decided to post my issue here instead op opening new issue. Sorry, for a silly question - I am new to C++ so all these building procedures is something new for me. Anyhow, I am trying to follow the installation instructions from README.md and here what I have when trying to build in the terminal:

(base) MBP-Denys:eos denys.volkov$ cmake -G "Unix Makefiles" ../eos -DCMAKE_INSTALL_PREFIX=../install/ -- Options: -- EOS_BUILD_EXAMPLES: ON -- EOS_BUILD_CERES_EXAMPLE: OFF -- EOS_BUILD_UTILS: OFF -- EOS_BUILD_DOCUMENTATION: OFF -- EOS_GENERATE_PYTHON_BINDINGS: OFF -- EOS_GENERATE_MATLAB_BINDINGS: OFF -- Eigen3 found: TRUE, version: 3.3.4 -- Eigen3 include dir found at /Users/denys.volkov/Documents/Stuff/Projects/CIEM/Code/Step_3_3dmm_fitting/denys/Using EOS/eos/3rdparty/eigen -- OpenCV 2.x detected -- Boost found at /usr/local/include -- Configuring done CMake Error at examples/CMakeLists.txt:29 (add_executable): Target "fit-model-simple" links to target "JPEG::JPEG" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing?

CMake Error at examples/CMakeLists.txt:41 (add_executable): Target "fit-model-multi" links to target "JPEG::JPEG" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing?

CMake Error at examples/CMakeLists.txt:47 (add_executable): Target "generate-obj" links to target "JPEG::JPEG" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing?

CMake Error at examples/CMakeLists.txt:35 (add_executable): Target "fit-model" links to target "JPEG::JPEG" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing?

-- Generating done CMake Generate step failed. Build files cannot be regenerated correctly.

Seems to be some problems with JPEG but I can't figure out how to fix it myself. I would be most appreciated if you could check what's wrong with my settings. Thank you in advance!

patrikhuber commented 3 years ago

Hi @DenysVolkov,

eos does not need libjpeg, I think this comes as a transitive dependency from OpenCV. Maybe the eos CMake scripts have to be updated in the way they use OpenCV, but I rather think that this is some issue related to OpenCV's CMake scripts. I would recommend that you post this question on the OpenCV forums or on StackOverflow. You should also post the exact versions of things you're using (if your log output is correct and you're using OpenCV 2.x, that's quite old, I'd recommend updating).

Note that the eos library doesn't need OpenCV (and thus doesn't need libjpeg). Only the examples do, for reading images. So you could set up your own project and start using the eos library, without needing to compile the examples with OpenCV.

DenysVolkov commented 3 years ago

Hi @patrikhuber ,

Thank you very much for such a quick reply! You were right - the problem was that I had old OpenCV. Ones I updated it to newer version it all worked out perfectly!

patrikhuber commented 1 year ago

I've just released eos v1.4.0, which removed all of glm, and now uses Eigen everywhere. So these default template argument errors with glm should be gone now as well. If there are other/new issues with macOS, please let me know via new issues! :-)