HalfdanJ / ofxFaceTracker2

Landmark detection addon for openFrameworks using DLIB
Other
206 stars 60 forks source link

compile issue on macOS - error: conflicting types for 'cblas_dtrsm' #49

Open vvzen opened 5 years ago

vvzen commented 5 years ago

Hi!

I'm trying to compile the example-simple project using the make system from command line, but I get this error: error: conflicting types for 'cblas_dtrsm'. I tried it on two different computers, both with macOS Sierra.

I googled it and I was not able to find a way to fix it, it seems to be related to a conflict between dlib and another macOS library. Do you have any hint?

screen shot 2018-08-05 at 13 27 22

This is the full error log ⚠️ :

In file included from /Users/vv/code/of/of_v0.10.0_osx_release/addons/ofxFaceTracker2/example-simple/src/main.cpp:2: In file included from /Users/vv/code/of/of_v0.10.0_osx_release/addons/ofxFaceTracker2/example-simple/src/ofApp.h:10: In file included from /Users/vv/code/of/of_v0.10.0_osx_release/addons/ofxFaceTracker2/src/ofxFaceTracker2.h:12: In file included from /Users/vv/code/of/of_v0.10.0_osx_release/addons/ofxFaceTracker2/libs/dlib/include/dlib/image_processing/frontal_face_detector.h:7: In file included from /Users/vv/code/of/of_v0.10.0_osx_release/addons/ofxFaceTracker2/libs/dlib/include/dlib/image_processing/../image_processing/object_detector.h:7: In file included from /Users/vv/code/of/of_v0.10.0_osx_release/addons/ofxFaceTracker2/libs/dlib/include/dlib/image_processing/../geometry.h:10: In file included from /Users/vv/code/of/of_v0.10.0_osx_release/addons/ofxFaceTracker2/libs/dlib/include/dlib/image_processing/../geometry/point_transforms.h:9: In file included from /Users/vv/code/of/of_v0.10.0_osx_release/addons/ofxFaceTracker2/libs/dlib/include/dlib/image_processing/../geometry/../matrix/../optimization/../matrix.h:11: In file included from /Users/vv/code/of/of_v0.10.0_osx_release/addons/ofxFaceTracker2/libs/dlib/include/dlib/image_processing/../matrix/matrix_la.h:13: In file included from /Users/vv/code/of/of_v0.10.0_osx_release/addons/ofxFaceTracker2/libs/dlib/include/dlib/image_processing/../geometry/../matrix/matrix_lu.h:11: /Users/vv/code/of/of_v0.10.0_osx_release/addons/ofxFaceTracker2/libs/dlib/include/dlib/image_processing/../geometry/../matrix/matrix_trsm.h:15:18: error: conflicting types for 'cblas_strsm' void cblas_strsm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, ^ /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/cblas.h:595:6: note: previous declaration is here void cblas_strsm(const enum CBLAS_ORDER __Order, const enum CBLAS_SIDE __Side, ^ In file included from /Users/vv/code/of/of_v0.10.0_osx_release/addons/ofxFaceTracker2/example-simple/src/main.cpp:2: In file included from /Users/vv/code/of/of_v0.10.0_osx_release/addons/ofxFaceTracker2/example-simple/src/ofApp.h:10: In file included from /Users/vv/code/of/of_v0.10.0_osx_release/addons/ofxFaceTracker2/src/ofxFaceTracker2.h:12: In file included from /Users/vv/code/of/of_v0.10.0_osx_release/addons/ofxFaceTracker2/libs/dlib/include/dlib/image_processing/frontal_face_detector.h:7: In file included from /Users/vv/code/of/of_v0.10.0_osx_release/addons/ofxFaceTracker2/libs/dlib/include/dlib/image_processing/../image_processing/object_detector.h:7: In file included from /Users/vv/code/of/of_v0.10.0_osx_release/addons/ofxFaceTracker2/libs/dlib/include/dlib/image_processing/../geometry.h:10: In file included from /Users/vv/code/of/of_v0.10.0_osx_release/addons/ofxFaceTracker2/libs/dlib/include/dlib/image_processing/../geometry/point_transforms.h:9: In file included from /Users/vv/code/of/of_v0.10.0_osx_release/addons/ofxFaceTracker2/libs/dlib/include/dlib/image_processing/../geometry/../matrix/../optimization/../matrix.h:11: In file included from /Users/vv/code/of/of_v0.10.0_osx_release/addons/ofxFaceTracker2/libs/dlib/include/dlib/image_processing/../matrix/matrix_la.h:13: In file included from /Users/vv/code/of/of_v0.10.0_osx_release/addons/ofxFaceTracker2/libs/dlib/include/dlib/image_processing/../geometry/../matrix/matrix_lu.h:11: /Users/vv/code/of/of_v0.10.0_osx_release/addons/ofxFaceTracker2/libs/dlib/include/dlib/image_processing/../geometry/../matrix/matrix_trsm.h:21:18: error: conflicting types for 'cblas_dtrsm' void cblas_dtrsm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, ^ /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/cblas.h:628:6: note: previous declaration is here void cblas_dtrsm(const enum CBLAS_ORDER __Order, const enum CBLAS_SIDE __Side,

Namasté

ofZach commented 5 years ago

I haven't seen this issue -- if it's helpful this thread suggests a potential fix:

https://sourceforge.net/p/dclib/discussion/442518/thread/b1934e14/?limit=25

vvzen commented 5 years ago

Thanks @ofZach ! I already saw that thread but to be honest I have no idea how to apply the fix that they're suggesting.. if anybody has a pointer it would be appreciated! 🥇

vvzen commented 5 years ago

UPDATE: I worked up the courage and went into the headers rabbit hole, trying to do what was suggested in the sourceforge link posted by zach. The issue is actually that within the Accelerate framework (/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/cblas.h) there are a couple of functions with the same name of the ones used by dlib.

I also found this issue in the main dlib repo, documenting the same thing: https://github.com/davisking/dlib/issues/746

So I opened to the ofxFaceTracker2/libs/dlib/include/dlib/matrix/matrix_trsm.hfile and I renamed the two functions cblas_strsm and cblas_dtrsm to cblas_strsmFIX and cblas_dtrsmFIX, just to see what could happen.

UPDATE 2: Ok, I found that a more elegant way to fix it is to replace this file : ofxFaceTracker2/libs/dlib/include/dlib/matrix/matrix_trsm.h with the same one from the dlib repo : https://github.com/davisking/dlib/blob/master/dlib/matrix/matrix_trsm.h , which is using #ifndef directives.

Now - it doesn't give this error anymore, but it complains about ofMutex. error: unknow type name 'ofMutex'. I'm using the latest openframeworks downloaded from the website.

UPDATE 3: it gives me the same issues even if I compile with Xcode.

screen shot 2018-08-05 at 19 09 52