macOS: shared `.pdx` fails to open in simulator `dlopen` complains "pdex.dylib: no suitable image found"

EDIT: This is resolved. The issue was that the simulator output wasn't building for both Intel and M1 archs.

I'm trying to share a .pdx with others so they can run it in the Simulator -- but it's failing to load for them.


  • We are both on macOS/Apple Silicon, with latest SDK 1.12.3
    • I don't think it should matter, but I'm on macOS 12.5 and they are on 11.6
  • Both my own project and SDK example projects (eg: Hello World) fail in the same way


dlopen complains with:

dlopen(/path/to/game.pdex/pdex.dylib, 6): no suitable image found. Did find: 
/path/to/game.pdex/pdex.dylib: mach-o, but wrong architecture 
/path/to/game.pdex/pdex.dylib: mach-o, but wrong architecture

My dev setup is like:

  • macOS 12.5
  • Using Makefile from the SDK like:
HEAP_SIZE      = 8388208
STACK_SIZE     = 61800

PRODUCT = game.pdx

# Locate the SDK
ifeq ($(SDK),)
SDK = $(shell egrep '^\s*SDKRoot' ~/.Playdate/config | head -n 1 | cut -c9-)

ifeq ($(SDK),)
$(error SDK path not found; set ENV value PLAYDATE_SDK_PATH)

VPATH += Source

# List C source files here
SRC =	\
		source \

# List all user directories here

# List user asm files

# List all user C define here, like -D_DEBUG=1

# Define ASM defines here

# List the user directory to look for the libraries here

# List all user libraries here

I thought it might have been a quarantining issue, as if you open a pdx downloaded from the internet via Finder, macOS sometimes quarantines the dylib contained within the pdx bundle but that's not it. Even after removing the quarantine bit, the issue persists.

Other projects found here/on the web do work for them - so this seems to be a "built by me" issue.

Any suggestions on things to try? I would have expected the example C projects to "just work".

You probably need to compile the simulator build for both Intel and M1 Macs.

Add this to your Makefile:

# Make sure we compile a universal binary for M1 and Intel macs
DYLIB_FLAGS+=-arch x86_64 -arch arm64

and I agree the sample code in the SDK should have that too...

1 Like

Thanks; let me try that. I figured building fat wouldn't have been the issue since we are both on M1 Macs, but let's see what happens!

I figured building fat wouldn't have been the issue since we are both on M1 Macs, but let's see what happens!

One of you may be running an older SDK which has an Intel-only Simulator (i.e. running with Rosetta).

Ah yeah, that makes sense! And, also what makes even more sense here is that I missed that they actually were testing on an Intel machine! Oops. :sweat_smile:

Now that it's properly building fat, all is well.

We did have to de-quarantine the dylib; but that's a separate issue. Might be interesting to provide instructions on how to do that for users who open pdex bundles from Finder directly rather than sticking them in the SDK's Games folder.

Thanks for the help @DidierMalenfant :slight_smile:

1 Like

Thanks for the help

Avec plaisir...