FreeType error when building in XCode

First some back story:

I dont know what im doing.

  • How to format certain words of a cell's text label
  • Xcode 4.3 and C++11 include paths
  • C/C++/Objective-C text recognition library
  • undefined reference to boost::system::system_category() when compiling
  • Granular Synthesis in iOS 6 using AudioFileServices
  • Pushsharp apple notification A call to SSPI failed error
  • Thats a lie, I know a bit about what I’m doing. I’m a web developer so looking at code isn’t all gibberish, but trying to use Xcode is a new book for me. Anyway, I designed a game that was compiled in C++ using SFML on Windows, and now we are trying to bring it over to OS X (I am the only one of the group with a Mac).

    Using Xcode 4.6.1 and SFML 2.0 I’ve been trying to get this damn application to build, and so far it’s been nothing but headaches. The current state of getting this thing to work is not so bad, it finally builds with no errors but the build stops and this shows up:

    dyld: Library not loaded: @executable_path/../Frameworks/freetype.framework/
    Versions/A/freetype
    
    Referenced from: /Users/Eric/Library/Developer/Xcode/DerivedData/
    Test-haconqzbewevbwgukppsacykkpml/Build/Products/Debug/Test.app/
    Contents/Frameworks/sfml-graphics.framework/Versions/2.0.0/sfml-graphics
    
    Reason: Incompatible library version: sfml-graphics requires version 17.0.0 or
    later, but freetype provides version 16.0.0
    

    I just dont understand this error. I have the most updated version of FreeType. I’m not even sure what that version number is referring to considering FreeType is at 2.4.11. I can’t seem to find this error anywhere else either, any ideas?

    Solutions Collect From Internet About “FreeType error when building in XCode”

    The version numbers mentioned in the error message refer to the compatibility version of the library. This is a version number that’s baked in to a given dynamic library at the time it is built. When another binary is linked against that library, the compatibility version is copied in to the LC_LOAD_DYLIB load command that tells dyld at runtime which dynamic libraries need to be loaded. When a library is loaded by dyld, the compatibility version is checked and if the program’s version is greater that the library’s version, it is an error.

    When you run otool -L freetype.framework/Versions/A/freetype you’ll see that it reports its compatibility version as 16.0.0. If you run it on sfml-graphics.framework/Versions/2.0.0/sfml-graphics you’ll see that it reports a compatibility version of 17.0.0 for freetype.framework. So you’re hitting the error case described above.

    The most common cause of an error like this is running your application against an older version of a framework than the version you built it, and any linked frameworks, against. Note that “older” in this sense refers to the compatibility version and not any other version number associated with the framework (e.g., the marketing version).

    Without knowing the origin of the two frameworks involved (e.g., if you built them yourself, or where you got the binaries from), it’s not completely obvious where you’ve gone wrong. I will note however that the SFML git repository appears to have a version of freetype.framework with the appropriate compatibility version (17.0.0), so if you’re using a binary of sfml-graphics.framework provided by the SFML folks then picking up their FreeType framework may be your solution.