bakercp / ofxDlib

An openFrameworks wrapper for dlib. http://dlib.net/
MIT License
52 stars 15 forks source link

duplicate symbol _jpeg_natural_order (conflict between dlib internal jpeg and freeimage) #22

Closed shiyamon closed 6 years ago

shiyamon commented 6 years ago

Hi, I am trying to compile my oF project with VS Code on Mac using an extension below. https://github.com/hiroMTB/vscode_oF

When I try compile a project with ofxDlib I get the error

duplicate symbol _jpeg_natural_order in: /mypath/of_v0.10.0RC4_osx_release/addons/ofxDlib/libs/dlib/lib/osx/libdlib.a(jutils.cpp.o) /mypath/of_v0.10.0RC4_osx_release/libs/FreeImage/lib/osx/freeimage.a(jutils.o-x86_64) ld: 1 duplicate symbol for architecture x86_64

It seems that a jpeg library included in libdlib.a conflicts with freeimage in oF. As Xcode projects generated by ProjectGenerator don't show this error, I think I am missing some configuration. Do you have any idea for this?

Another idea is re-compile libdlib.a without JPEG support. I also tried re-compile dlib-19.10 with CMake but got the other error,

"_USER_ERROR__missing_dlib_all_source_cpp_fileORinconsistent_use_of_DEBUG_or_ENABLE_ASSERTS_preprocessordirectives"

Enabling "DLIB_ENABLE_ASSERTS" seems not solving this problem.

bakercp commented 6 years ago

Here are my notes on this.

https://github.com/bakercp/ofxDlib/blob/master/scripts/formulas/dlib.sh#L40-L53

I haven't been able to get it to work with QTCreator or anything other than project generator / Xcode without disabling JPEG support. You can modify the forumula and re-run boostrap / apothecary to recompile.

shiyamon commented 6 years ago

Thank you for your quick response. Recompiling without JPEG works!