TadasBaltrusaitis / OpenFace

OpenFace – a state-of-the art tool intended for facial landmark detection, head pose estimation, facial action unit recognition, and eye-gaze estimation.
Other
6.84k stars 1.84k forks source link

Mac Os build problem #776

Open sergio-dl opened 4 years ago

sergio-dl commented 4 years ago

Hello everybody, Could you please help me, I am having problems when trying to build OpenFace for mac os. when the commande make is run, I get :

[ 2%] Building CXX object lib/local/LandmarkDetector/CMakeFiles/LandmarkDetector.dir/src/CCNF_patch_expert.cpp.o In file included from /applications/OpenFace-master/lib/local/LandmarkDetector/src/CCNF_patch_expert.cpp:35: In file included from /applications/OpenFace-master/lib/local/LandmarkDetector/include/stdafx.h:19: In file included from /usr/local/Cellar/opencv/4.1.1_2/include/opencv4/opencv2/core/core.hpp:48: In file included from /usr/local/Cellar/opencv/4.1.1_2/include/opencv4/opencv2/core.hpp:54: In file included from /usr/local/Cellar/opencv/4.1.1_2/include/opencv4/opencv2/core/base.hpp:58: In file included from /usr/local/Cellar/opencv/4.1.1_2/include/opencv4/opencv2/core/cvstd.hpp:62: /Library/Developer/CommandLineTools/usr/include/c++/v1/cmath:313:9: error: no member named 'signbit' in the global namespace using ::signbit; ~~^ /Library/Developer/CommandLineTools/usr/include/c++/v1/cmath:314:9: error: no member named 'fpclassify' in the global namespace using ::fpclassify; ~~^ /Library/Developer/CommandLineTools/usr/include/c++/v1/cmath:315:9: error: no member named 'isfinite' in the global namespace; did you mean 'finite'? using ::isfinite; ~~^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/math.h:749:12: note: 'finite' declared here extern int finite(double) ^ In file included from /applications/OpenFace-master/lib/local/LandmarkDetector/src/CCNF_patch_expert.cpp:35: In file included from /applications/OpenFace-master/lib/local/LandmarkDetector/include/stdafx.h:19: In file included from /usr/local/Cellar/opencv/4.1.1_2/include/opencv4/opencv2/core/core.hpp:48: In file included from /usr/local/Cellar/opencv/4.1.1_2/include/opencv4/opencv2/core.hpp:54: In file included from /usr/local/Cellar/opencv/4.1.1_2/include/opencv4/opencv2/core/base.hpp:58: In file included from /usr/local/Cellar/opencv/4.1.1_2/include/opencv4/opencv2/core/cvstd.hpp:62: /Library/Developer/CommandLineTools/usr/include/c++/v1/cmath:316:9: error: no member named 'isinf' in the global namespace using ::isinf; ~~^ /Library/Developer/CommandLineTools/usr/include/c++/v1/cmath:317:9: error: no member named 'isnan' in the global namespace using ::isnan; ~~^ /Library/Developer/CommandLineTools/usr/include/c++/v1/cmath:318:9: error: no member named 'isnormal' in the global namespace using ::isnormal; ~~^ /Library/Developer/CommandLineTools/usr/include/c++/v1/cmath:319:7: error: no member named 'isgreater' in the global namespace; did you mean '::std::greater'? using ::isgreater; ^~ /Library/Developer/CommandLineTools/usr/include/c++/v1/functional:720:29: note: '::std::greater' declared here struct _LIBCPP_TEMPLATE_VIS greater : binary_function<_Tp, _Tp, bool> ^ In file included from /applications/OpenFace-master/lib/local/LandmarkDetector/src/CCNF_patch_expert.cpp:35: In file included from /applications/OpenFace-master/lib/local/LandmarkDetector/include/stdafx.h:19: In file included from /usr/local/Cellar/opencv/4.1.1_2/include/opencv4/opencv2/core/core.hpp:48: In file included from /usr/local/Cellar/opencv/4.1.1_2/include/opencv4/opencv2/core.hpp:54: In file included from /usr/local/Cellar/opencv/4.1.1_2/include/opencv4/opencv2/core/base.hpp:58: In file included from /usr/local/Cellar/opencv/4.1.1_2/include/opencv4/opencv2/core/cvstd.hpp:62: /Library/Developer/CommandLineTools/usr/include/c++/v1/cmath:320:7: error: no member named 'isgreaterequal' in the global namespace; did you mean '::std::greater_equal'? using ::isgreaterequal; ^~ /Library/Developer/CommandLineTools/usr/include/c++/v1/functional:749:29: note: '::std::greater_equal' declared here struct _LIBCPP_TEMPLATE_VIS greater_equal : binary_function<_Tp, _Tp, bool> ^ In file included from /applications/OpenFace-master/lib/local/LandmarkDetector/src/CCNF_patch_expert.cpp:35: In file included from /applications/OpenFace-master/lib/local/LandmarkDetector/include/stdafx.h:19: In file included from /usr/local/Cellar/opencv/4.1.1_2/include/opencv4/opencv2/core/core.hpp:48: In file included from /usr/local/Cellar/opencv/4.1.1_2/include/opencv4/opencv2/core.hpp:54: In file included from /usr/local/Cellar/opencv/4.1.1_2/include/opencv4/opencv2/core/base.hpp:58: In file included from /usr/local/Cellar/opencv/4.1.1_2/include/opencv4/opencv2/core/cvstd.hpp:62: /Library/Developer/CommandLineTools/usr/include/c++/v1/cmath:321:9: error: no member named 'isless' in the global namespace using ::isless; ~~^ /Library/Developer/CommandLineTools/usr/include/c++/v1/cmath:322:9: error: no member named 'islessequal' in the global namespace using ::islessequal; ~~^ /Library/Developer/CommandLineTools/usr/include/c++/v1/cmath:323:9: error: no member named 'islessgreater' in the global namespace using ::islessgreater; ~~^ /Library/Developer/CommandLineTools/usr/include/c++/v1/cmath:324:9: error: no member named 'isunordered' in the global namespace using ::isunordered; ~~^ /Library/Developer/CommandLineTools/usr/include/c++/v1/cmath:325:9: error: no member named 'isunordered' in the global namespace using ::isunordered; ~~^ In file included from /applications/OpenFace-master/lib/local/LandmarkDetector/src/CCNF_patch_expert.cpp:35: In file included from /applications/OpenFace-master/lib/local/LandmarkDetector/include/stdafx.h:27: In file included from /usr/local/include/dlib/image_processing/frontal_face_detector.h:7: In file included from /usr/local/include/dlib/image_processing/../image_processing/object_detector.h:7: In file included from /usr/local/include/dlib/image_processing/../geometry.h:10: In file included from /usr/local/include/dlib/image_processing/../geometry/point_transforms.h:9: In file included from /usr/local/include/dlib/image_processing/../geometry/../matrix/../optimization/../matrix.h:11: In file included from /usr/local/include/dlib/image_processing/../matrix/matrix_la.h:9: /usr/local/include/dlib/image_processing/../geometry/../matrix/../optimization/optimization_line_search.h:218:31: error: expected unqualified-id if (temp == 0 || std::fpclassify(temp) == FP_SUBNORMAL) ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/math.h:127:5: note: expanded from macro 'fpclassify' ( sizeof(x) == sizeof(float) ? __fpclassifyf((float)(x)) \ ^ 14 errors generated. make[2]: [lib/local/LandmarkDetector/CMakeFiles/LandmarkDetector.dir/src/CCNF_patch_expert.cpp.o] Error 1 make[1]: [lib/local/LandmarkDetector/CMakeFiles/LandmarkDetector.dir/all] Error 2 make: *** [all] Error 2

Thank you for your help ! Sergio

TadasBaltrusaitis commented 4 years ago

This seems like an issue external to OpenFace and similar to the following issues: https://github.com/Andersbakken/rtags/issues/937 https://github.com/PointCloudLibrary/pcl/issues/2750

This might give you a starting point to resolving it.

awandzel commented 4 years ago

This post helped fix it for me:

(1) Make sure Xcode is up to date. There's no telling what an outdated Xcode on Catalina might do to your build environment. (2) Use the -isysroot /sdk/path compiler flag, where /sdk/path is the result of xcrun --show-sdk-path. I'm not sure what CMake's best practice is, but try doing set(CMAKE_OSX_SYSROOT /sdk/path)

awandzel commented 4 years ago

If that doesn't work then per the same post: this has helped a colleague of mine:

  1. Using

    include</Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h> instead of in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath

sylvia935 commented 3 years ago

@awandzel I'm sorry, I'm not super familiar with compilers and Xcode, could you explain a bit further about these?

  1. Where do I need to put the -isysroot /sdk/path compiler flag? The original answer on stackoverflow didn't tell this as well.
  2. The set(CMAKE_OSX_SYSROOT /sdk/path) need to be put to anywhere in CMakeLists.txt right?
  3. If I go for the 2nd solution
Using
#include</Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h> instead of <math.h> in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath

What should I do to make this change? in terminal or Xcode or somewhere else?

Thank you very much!

Jordan-ldr commented 3 years ago

If that doesn't work then per the same post: this has helped a colleague of mine:

  1. Using

    include</Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h> instead of in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath

I had the same issue as @sergio-dl and the answer of @awandzel helped me. Thanks

awandzel commented 3 years ago

@sylvia935

I recently reran into the same problem and this solution solved it on IOS 10.15.6 Catalina. Adding more detail:

Locate the file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath

Edit file replacing #include with

include </Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h>

Recompile (be sure to clear your cmake cache)

Reference: https://stackoverflow.com/questions/58628377/catalina-c-using-cmath-headers-yield-error-no-member-named-signbit-in-th

idiotWu commented 3 years ago

Same issue here and fixed by switching SDK via

sudo xcode-select -s /Library/Developer/CommandLineTools