PDC Exec format error when compling

I'm on Ubuntu and I'm trying to make the device file. It gets to 100% and throws out this error and I can't figure out why:

[100%] Linking C executable hello_world_DEVICE.elf
/usr/bin/cmake -E cmake_link_script CMakeFiles/hello_world_DEVICE.dir/link.txt --verbose=1
/usr/bin/arm-none-eabi-gcc -specs=nano.specs -specs=nosys.specs -nostartfiles -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -D__FPU_USED=1 -T/home/odroid/code/PlaydateSDK-2.0.3//C_API/buildsupport/link_map.ld -Wl,-Map=game.map,--cref,--gc-sections,--no-warn-mismatch,--emit-relocs --entry eventHandlerShim CMakeFiles/hello_world_DEVICE.dir/home/odroid/code/PlaydateSDK-2.0.3/C_API/buildsupport/setup.c.obj CMakeFiles/hello_world_DEVICE.dir/src/main.c.obj -o hello_world_DEVICE.elf libchipmunk.a -L /usr/local/lib
/usr/bin/arm-none-eabi-strip --strip-unneeded -R .comment -g hello_world_DEVICE.elf -o /home/odroid/code/Game/Source/pdex.elf
cd /home/odroid/code/Game && /home/odroid/code/PlaydateSDK-2.0.3//bin/pdc -sdkpath /home/odroid/code/PlaydateSDK-2.0.3/ Source hello_world.pdx
/bin/sh: 1: /home/odroid/code/PlaydateSDK-2.0.3//bin/pdc: Exec format error
make[2]: *** [CMakeFiles/hello_world_DEVICE.dir/build.make:119: hello_world_DEVICE.elf] Error 126
make[2]: *** Deleting file 'hello_world_DEVICE.elf'
make[2]: Leaving directory '/home/odroid/code/Game/build'
make[1]: *** [CMakeFiles/Makefile2:114: CMakeFiles/hello_world_DEVICE.dir/all] Error 2
make[1]: Leaving directory '/home/odroid/code/Game/build'
make: *** [Makefile:94: all] Error 2

Might anyone have any idea?

Are you on an ARM platform, by chance? AFAIK the linux sdk is only compiled for x86 right now.

For some reason I Thought we had to be on arm to get it to compile since it was for an arm device. Gah. I set up a raspberry pi device just to get this compiled.

Nope! It's the magic of cross-compilation. :smiley: I'll file an issue to make that clearer in the docs, and also add a check in the makefile so that it gives a clearer error message.

1 Like

So I have it back on a windows machine, it works when I compile it for the Simulator. But I don't know why it's not compiling right for the device. I put it on the device and it crashes instantly, I am using Visual Studio 2022, in the doc it says: This does an optimized build with the current tool chain. To release build for Playdate hardware, you will need to use the ARM tool chain listed above. In Visual Studio this argument is ignored; to do a release build with Visual Studio select Release from the build popup menu.

So I'm thinking that means the configuration drop down at the top? I have that set to arm64-release. Is there another pop up that doesn't pop up or that I don't see? I'm assuming it's being compiled still for the simulator and not for the device....I have no idea.

When I tried to build it using arm64-release, it doesn't work in the simulator any more, which means I suppose it's building right for the device...but then I side load it and it crashes immediately, I'm not sure why it's crashing. I don't know how to get logs or console output to see why it's crashing when it's on the device like this. This is using C and not LUA

I can't post the file yet since I'm too new, so I put it here on drive: hello_world.pdx.zip - Google Drive