質問

I'm trying to build a program that uses QT and OpenCV. It compiles correctly, but when I run the application I get:

Starting /Users/Me/MyApp/Contents/MacOS/Foo...
dyld: Library not loaded: /usr/local/lib/libavformat.54.29.104.dylib
  Referenced from: /usr/local/lib/libopencv_highgui.2.4.3.dylib
  Reason: image not found
The program has unexpectedly finished.
/Users/Me/MyApp/Contents/MacOS/Foo exited with code 0

I've had a look in my /usr/local/lib, the files are properly linked there, the issue is that libav is now at a higher version and opencv doesn't reflect this (e.g. looking at the opencv dylib in a hex editor I see that it wants what it says above, but what's actually in my lib folder is e.g. version 54.59.106. I've tried runnning brew update/upgrade and relinking everything, but no luck.

I can make a quick fix by copying the offending dylibs and renaming them to older versions. This does cause the program to open correctly, but it's a bit of a hack.

Obviously I could probably fix this with a reinstall of the relevant libraries, but that takes precious time.. from this thread it seems like the only option, but I don't know if that's been fixed yet: https://github.com/mxcl/homebrew/issues/11832

役に立ちましたか?

解決

Seems like the only way to fix this was to run:

brew rm ffmpeg && brew install ffmpeg

brew rm opencv && brew install opencv

Probably didn't need to repour ffmpeg, but I didn't see any harm in it. Turns out this happens sometimes when a package updates to a major new version and the other package hasn't also been updated yet.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top