Bad file descriptor

Full console output

====================[ Build | hello_world_DEVICE | PlaydateArm ]================
"C:\Program Files\JetBrains\CLion 2023.3.1\bin\cmake\win\x64\bin\cmake.exe" --build "C:\Users\Matthew\Desktop\PlaydateProjects\Hello World\cmake-build-playdatearm" --target hello_world_DEVICE -j 10
[1/3] Building C object CMakeFiles/hello_world_DEVICE.dir/C_/Users/Matthew/Documents/PlaydateSDK/C_API/buildsupport/setup.c.obj
[2/3] Building C object CMakeFiles/hello_world_DEVICE.dir/src/main.c.obj
[3/3] Linking C executable hello_world_DEVICE.elf
FAILED: hello_world_DEVICE.elf 
cmd.exe /C "cd . && C:\PROGRA~2\ARMGNU~1\13C7F1~1.2RE\bin\AR19DD~1.EXE -g -nostartfiles -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -D__FPU_USED=1 -TC:/Users/Matthew/Documents/PlaydateSDK/C_API/buildsupport/link_map.ld -Wl,,--cref,--gc-sections,--no-warn-mismatch,--emit-relocs --entry eventHandlerShim CMakeFiles/hello_world_DEVICE.dir/src/main.c.obj CMakeFiles/hello_world_DEVICE.dir/C_/Users/Matthew/Documents/PlaydateSDK/C_API/buildsupport/setup.c.obj -o hello_world_DEVICE.elf   && cmd.exe /C "cd /D "C:\Users\Matthew\Desktop\PlaydateProjects\Hello World\cmake-build-playdatearm" && "C:\Program Files (x86)\Arm GNU Toolchain arm-none-eabi\13.2 Rel1\bin\arm-none-eabi-strip.exe" --strip-unneeded -R .comment -g hello_world_DEVICE.elf -o "C:/Users/Matthew/Desktop/PlaydateProjects/Hello World/Source/pdex.elf" && cd /D "C:\Users\Matthew\Desktop\PlaydateProjects\Hello World" && C:\Users\Matthew\Documents\PlaydateSDK\bin\pdc -sdkpath C:/Users/Matthew/Documents/PlaydateSDK Source hello_world.pdx""
C:/PROGRA~2/ARMGNU~1/13C7F1~1.2RE/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld.exe: warning: hello_world_DEVICE.elf has a LOAD segment with RWX permissions
C:\Program Files (x86)\Arm GNU Toolchain arm-none-eabi\13.2 Rel1\bin\arm-none-eabi-strip.exe: C:/Users/Matthew/Desktop/PlaydateProjects/Hello World/Source/pdex.elf: Bad file descriptor
ninja: build stopped: subcommand failed.

I'm working on windows with CLion. I'm trying to build the hello world example and I've followed the steps outlined here: Inside Playdate with C

My settings look like this:

The download link for gcc-arm-none-eabi isn't very helpful so I wonder if I could have downloaded the wrong version of that? Ether way I'd be very greatful for some help.

It does look like perhaps you grabbed the wrong version. I have GNU Arm Embedded Toolchain 10 2021.10. Make sure to also grab the 64 bit version.

1 Like

I've found a release page for the version you referenced but it lacks a 64 bit version. Downloads | 10.3-2021.10 – Arm Developer I've searched elsewhere without any luck. Can you tell me more specifically where to find the correct version?

I've made a little progress. The problem I was having originally was caused by me acidentally deleting the Source directory for the hello world example. The build process now runs to completion and produces a directory named hello_world.pdx containing pdex.bin and I've tried opening this in the simulator and it won't work sadly. I'm guessing it's to do with the fact that I still don't have the 64 bit toolchain. If you have a link for that it would be really useful.

I'll post the simulator error here but it isn't very helpful:

22:51:39: Loading: C:\Users\Matthew\Desktop\PlaydateProjects\Hello World\hello_world.pdx\
22:51:39: Loading: Failed
Load failed, error: (null)

You're building for the device. You need to remove the cmake tool chain file arg from cmake to build for the sim.

That was it! thanks very much.

I was thinking of the simulator as an emulator. Clearly that's not the case.