Author Topic: No matching architecture in universal wrapper?  (Read 5228 times)

dhbenson

  • Newbie
  • *
  • Posts: 4
    • View Profile
No matching architecture in universal wrapper?
« on: July 21, 2010, 07:53:14 »
Hi there,

I'm developing a VAMP host using the host-sdk.  My code links to the "libvamp-hostsdk.a" library.

I'm getting weird behaviour when I try to load plugin libraries.  When I compile the example plugins, the resulting "vamp-example-plugins.dylib" loads just fine.  When I try to load libraries that I've downloaded from the net, though, I get errors like this:

>>
Vamp::HostExt::PluginLoader: Unable to load library "/Users/davebenson/Documents/examples/qm-vamp-plugins.dylib": dlopen(/Users/davebenson/Documents/examples/qm-vamp-plugins.dylib, 5): no suitable image found.  Did find:
   /Users/davebenson/Documents/examples/qm-vamp-plugins.dylib: no matching architecture in universal wrapper

>>

Strangely, though, when I use the same plugin library in Sonic Visualizer it loads perfectly.  Any idea what the problem is?  Why the errors?

I'm working on a 2009 MacBook Pro, Intel Core 2 Duo processor, running OS 10.6.4.

Many thanks for your help,


Dave

cannam

  • Administrator
  • Full Member
  • *****
  • Posts: 229
    • View Profile
Re: No matching architecture in universal wrapper?
« Reply #1 on: July 21, 2010, 11:11:13 »

The problem here is that starting with 10.6, the default compiler mode in OS/X is now to produce 64-bit rather than 32-bit binaries.

All of the publicly distributed Vamp plugins and hosts (at least the ones that we know about and refer to on the Vamp plugins website) are 32-bit only.  But when you compile your own host and your own plugins on 10.6 using the default compiler flags, the results are 64-bit.  Although OS/X 10.5 and 10.6 will happily run either 32- or 64-bit binaries, you can't load a 64-bit plugin into a 32-bit host or vice versa.  Consequently the publicly available plugins will not work in your host and the publicly available hosts will not load your plugin.

The short-term fix is to compile your host in 32-bit mode, and if you are compiling plugins also, to do so either in 32-bit mode or as 32- and 64-bit universal binaries (or even 32-bit and 64-bit Intel plus 32-bit PPC).

To do this, use the flags "-arch i386" when compiling and linking a host; and either "-arch i386", "-arch i386 -arch x86_64", or "-arch i386 -arch x86_64 -arch ppc" when compiling and linking a plugin.

(The long-term solution is for us first to ensure that all plugins being distributed are compiled as 32- and 64-bit universal binaries, and then to do the same for the hosts.  But until the plugins all support 64-bit architectures,
the hosts must remain 32-bit only because otherwise OS/X will run them in 64-bit mode and they'll be unable to load 32-bit plugins.)

This change caught us somewhat by surprise (stupidly perhaps) and although work is now under way to improve the way the default SDK handles and documents this situation, this work is not quite done yet.  I'm sorry about all the inconvenience.


Chris

dhbenson

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: No matching architecture in universal wrapper?
« Reply #2 on: July 23, 2010, 00:26:18 »
Chris,

Ok, great! I recompiled the host as a 32-bit binary and now everything's working fine. Thanks so much for your speedy and informative response. :)

Best,


Dave