Search code examples
c++cmacosx86-64i386

Loading a dylib from a different architecture


I currently have a program I have compiled in x86_64, it relies on quite a few libraries also compiled in x86_64 (so recompiling them all would be a big project). I am looking to run a i386 dylib, however whenever I load it using dlopen I get an error saying it was not built for my architecture. Is there any way to either convert the i386 lib directly to a x86_64 (I do not have the source code for this) or run it on an x86_64 architecture?


Solution

  • You cannot load an i386 library in an x86_64 executable.

    There only way to get an x86_64 library out of an i386 one is to recompile it for the right target. If you don't have the source code, this cannot be done.

    You can recompile all your code for i386 and use the library though.