What can cause dlopen: no suitable image found (can't map)?

Tobias picture Tobias · Dec 17, 2009 · Viewed 10.4k times · Source

What can cause the following error when loading an additional bundle using dlopen:

dlopen($(OBJ_DIR)/Test-20091217211256.ob, 6): no suitable image found.  Did find:
    $(OBJ_DIR)/Test-20091217211256.ob: can't map

Before this error, the process allocates large amounts of memory.

(Substituted $(OBJ_DIR) in the error for the actual path to make it more legible).

Answer

Adam Rosenfield picture Adam Rosenfield · May 27, 2011

One possibility is that the shared library you're trying to open isn't actually a shared library. Run the file(1) program on your library to make sure it's actually a shared library. It should report something like Mach-O 64-bit dynamically linked shared library x86_64 on a 64-bit system or Mach-O dynamically linked shared library i386 on a 32-bit system.