This looks like it's trying to link against 32-bit versions of FFMPEG or similar libraries but not finding them. 32-bit programs need to be linked against 32-bit versions of all their libraries. Those libs were probably built 64-bit only. The key errors look like this.
ignoring file /usr/local/lib/libavcodec.dylib, file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture being linked (i386)
Your error message output is kind of wonky and garbled from what looks like parallel make jobs interleaving their output. Use the single-job version described in the Homebrew Troubleshooting Guide to make debugging easier.
This looks like a problem with the formula and dependency definitions that's distinct from the one you linked (which is about the --32-bit
switch not attempting to build a 32-bit binary in the first place). The fix is to probably go through all the libs that OpenCV depends on (along with their dependencies, transitively) and reinstall them with the --universal
switch, too. The default would probably have been to build only 64-bit versions of them. Homebrew does not have a mechanism to express dependencies on bitness or other build options (e.g. --universal
) of packages something is indirectly dependent on.
When running brew install opencv --universal
on OS X 10.8.3, I was able to reproduce similar link errors, complaining about symbols in libjpeg, and when I rebuilt jpeg with --universal
, they cleared up, only to be replaced by other link errors, which cleared up with --universal
rebuilds of other libraries, eventually producing a 32-bit opencv build. This thing links against a lot of libs.
Here's the process:
- Build opencv in single-job mode.
- Identify the library file it failed to link against. It's probably the one in the "ignoring" message.
- Determine what package that file is from. Check it and its parent dirs to see where they're symlinked in to
Cellar
- Rebuild that package, and its dependencies if necessary, with
--universal
- Repeat until all the link errors finally disapper
There's possibly an easier way. When brew
is automatically installing dependencies, it'll propagate the --universal
switch. So you can try removing all your homebrew packages (make a list of them first), then install just opencv with brew install opencv --universal
and let it pick up all its transitive dependencies and make them universal too, and then install the rest of your packages back. (If you keep the list in a text file, you'll be able to pipe it to brew
pretty easily.)
This is probably worth reporting as a new issue on the Homebrew issue tracker on GitHub. They can help you sort it out, and maybe improve the --universal
checking of indirect dependencies, if that's what's going on here. Or it may be that the dependency checking is defeated by the fact that opencv itself is being built with --32-bit
and not the more common --universal
.