12. February 2018

Incompatible library version: requires version 19.0.0 or later, but .dylib provides version 18.0.0

I was trying to compile simple test application with FreeType2 on macOS just by a command line. Application compiled without problem.

The application was not able to start and displayed following error:

Compilation of FreeType
dyld: Library not loaded: /usr/local/lib/libfreetype.6.dylib
  Referenced from: /Users/georgik/projects/freetype-2.6.5/./fttest
  Reason: Incompatible library version: fttest requires version 19.0.0 or later, but libfreetype.6.dylib provides version 18.0.0

There is one handy tool on macOS which helps in cases like this one: otool.

otool -L ./ft-test
./fttest:
  /usr/local/lib/libfreetype.6.dylib (compatibility version 19.0.0, current version 19.5.0)
  /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.0.0)
  /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 495.0.0

The problem was caused by two versions of libfreetype on the macOS. One library was stored in /usr/local/lib and the other was stored in my project directory.

How to fix the issue? There are two options:

  • Remove unwanted library which is causing ambiguity
  • Set proper paths to DYLD_LIBRARY_PATH before starting the application
  • Quick search

  • Links

  • Twitter

    Follow @jurajmichalek on twitter.

  • Comments

  • Tags

  • Topics