I am attempting to build the C hello world project in VS Code on Mac. I have configured the cmake build to the point it calls pdc to compile the results of the build from the Source folder into the pdx. pdc crashes with a segfault 11:
[main] Building folder: Playdate-C-Hello-World
[build] Starting build
[proc] Executing command: /Applications/CMake.app/Contents/bin/cmake --build /Users/psychicteeth/Documents/GitHub/Playdate-C-Hello-World/build --config Debug --target all -j 10 --
[build] /Applications/CMake.app/Contents/bin/cmake -S/Users/psychicteeth/Documents/GitHub/Playdate-C-Hello-World -B/Users/psychicteeth/Documents/GitHub/Playdate-C-Hello-World/build --check-build-system CMakeFiles/Makefile.cmake 0
[build] /Applications/CMake.app/Contents/bin/cmake -E cmake_progress_start /Users/psychicteeth/Documents/GitHub/Playdate-C-Hello-World/build/CMakeFiles /Users/psychicteeth/Documents/GitHub/Playdate-C-Hello-World/build//CMakeFiles/progress.marks
[build] /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/Makefile2 all
[build] /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/c_template_DEVICE.dir/build.make CMakeFiles/c_template_DEVICE.dir/depend
[build] cd /Users/psychicteeth/Documents/GitHub/Playdate-C-Hello-World/build && /Applications/CMake.app/Contents/bin/cmake -E cmake_depends "Unix Makefiles" /Users/psychicteeth/Documents/GitHub/Playdate-C-Hello-World /Users/psychicteeth/Documents/GitHub/Playdate-C-Hello-World /Users/psychicteeth/Documents/GitHub/Playdate-C-Hello-World/build /Users/psychicteeth/Documents/GitHub/Playdate-C-Hello-World/build /Users/psychicteeth/Documents/GitHub/Playdate-C-Hello-World/build/CMakeFiles/c_template_DEVICE.dir/DependInfo.cmake --color=
[build] Consolidate compiler generated dependencies of target c_template_DEVICE
[build] /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/c_template_DEVICE.dir/build.make CMakeFiles/c_template_DEVICE.dir/build
[build] [ 33%] Building C object CMakeFiles/c_template_DEVICE.dir/src/main.c.obj
[build] /Applications/gcc-arm/bin/arm-none-eabi-gcc -DTARGET_EXTENSION=1 -DTARGET_PLAYDATE=1 -I/Users/psychicteeth/Developer/PlaydateSDK/C_API -Wall -Wno-unknown-pragmas -Wdouble-promotion -O2 -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -D__FPU_USED=1 -falign-functions=16 -fomit-frame-pointer -gdwarf-2 -fverbose-asm -ffunction-sections -fdata-sections -mword-relocations -fno-common -std=gnu11 -MD -MT CMakeFiles/c_template_DEVICE.dir/src/main.c.obj -MF CMakeFiles/c_template_DEVICE.dir/src/main.c.obj.d -o CMakeFiles/c_template_DEVICE.dir/src/main.c.obj -c /Users/psychicteeth/Documents/GitHub/Playdate-C-Hello-World/src/main.c
[build] [ 66%] Linking C executable c_template_DEVICE.elf
[build] /Applications/CMake.app/Contents/bin/cmake -E cmake_link_script CMakeFiles/c_template_DEVICE.dir/link.txt --verbose=1
[build] /Applications/gcc-arm/bin/arm-none-eabi-gcc -nostartfiles -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -D__FPU_USED=1 -T/Users/psychicteeth/Developer/PlaydateSDK/C_API/buildsupport/link_map.ld -Wl,-Map=game.map,--cref,--gc-sections,--no-warn-mismatch,--emit-relocs --entry eventHandlerShim CMakeFiles/c_template_DEVICE.dir/Users/psychicteeth/Developer/PlaydateSDK/C_API/buildsupport/setup.c.obj CMakeFiles/c_template_DEVICE.dir/src/main.c.obj -o c_template_DEVICE.elf
[build] /Applications/gcc-arm/bin/arm-none-eabi-strip --strip-unneeded -R .comment -g c_template_DEVICE.elf -o /Users/psychicteeth/Documents/GitHub/Playdate-C-Hello-World/Source/pdex.elf
[build] cd /Users/psychicteeth/Documents/GitHub/Playdate-C-Hello-World && /Users/psychicteeth/Developer/PlaydateSDK/bin/pdc -sdkpath /Users/psychicteeth/Developer/PlaydateSDK Source c_template.pdx
[build] /bin/sh: line 1: 78696 Segmentation fault: 11 /Users/psychicteeth/Developer/PlaydateSDK/bin/pdc -sdkpath /Users/psychicteeth/Developer/PlaydateSDK Source c_template.pdx
[build] make[2]: *** [c_template_DEVICE.elf] Error 139
[build] make[2]: *** Deleting file `c_template_DEVICE.elf'
[build] make[1]: *** [CMakeFiles/c_template_DEVICE.dir/all] Error 2
[build] make: *** [all] Error 2
[proc] The command: /Applications/CMake.app/Contents/bin/cmake --build /Users/psychicteeth/Documents/GitHub/Playdate-C-Hello-World/build --config Debug --target all -j 10 -- exited with code: 2
[driver] Build completed: 00:00:00.460
[build] Build finished with exit code 2
I have uploaded the repository here GitHub - psychicteeth/Playdate-C-Hello-World: An empty playdate C/Lua project that can be built in VS Code on Winodws and Mac.
I'd be interested to hear if others get the same crash.
I've messed around with the c file but nothing I change about it seems to fix the crash.