Windows arm debug build no longer working SDK 2.0

I am on Windows 10 and can still build for the simulator using Visual Studio.
My device build no longer works. The cmake arm command runs and populates my build folder but when running nmake I get the following errors:

c:/progra~2/armgnu~1/1213fb~1.2mp/bin/../lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/bin/ld.exe: c:/progra~2/armgnu~1/1213fb~1.2mp/bin/../lib/gcc/arm-none-eabi/12.2.0/thumb/v7e-m+fp/hard\libc.a(libc_a-closer.o): in function `_close_r':
/data/jenkins/workspace/GNU-toolchain/arm-12-mpacbti/src/newlib-cygwin/newlib/libc/reent/closer.c:47: warning: _close is not implemented and will always fail
c:/progra~2/armgnu~1/1213fb~1.2mp/bin/../lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/bin/ld.exe: c:/progra~2/armgnu~1/1213fb~1.2mp/bin/../lib/gcc/arm-none-eabi/12.2.0/thumb/v7e-m+fp/hard\libc.a(libc_a-lseekr.o): in function `_lseek_r':
/data/jenkins/workspace/GNU-toolchain/arm-12-mpacbti/src/newlib-cygwin/newlib/libc/reent/lseekr.c:49: warning: _lseek is not implemented and will always fail
c:/progra~2/armgnu~1/1213fb~1.2mp/bin/../lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/bin/ld.exe: c:/progra~2/armgnu~1/1213fb~1.2mp/bin/../lib/gcc/arm-none-eabi/12.2.0/thumb/v7e-m+fp/hard\libc.a(libc_a-readr.o): in function `_read_r':
/data/jenkins/workspace/GNU-toolchain/arm-12-mpacbti/src/newlib-cygwin/newlib/libc/reent/readr.c:49: warning: _read is not implemented and will always fail
c:/progra~2/armgnu~1/1213fb~1.2mp/bin/../lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/bin/ld.exe: c:/progra~2/armgnu~1/1213fb~1.2mp/bin/../lib/gcc/arm-none-eabi/12.2.0/thumb/v7e-m+fp/hard\libc.a(libc_a-writer.o): in function `_write_r':
/data/jenkins/workspace/GNU-toolchain/arm-12-mpacbti/src/newlib-cygwin/newlib/libc/reent/writer.c:49: warning: _write is not implemented and will always fail
c:/progra~2/armgnu~1/1213fb~1.2mp/bin/../lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/bin/ld.exe: warning: playdate-c-game-template_DEVICE.elf has a LOAD segment with RWX permissionsc:/progra~2/armgnu~1/1213fb~1.2mp/bin/../lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/bin/ld.exe: c:/progra~2/armgnu~1/1213fb~1.2mp/bin/../lib/gcc/arm-none-eabi/12.2.0/thumb/v7e-m+fp/hard\libc.a(libc_a-fini.o): in function `__libc_fini_array':
/data/jenkins/workspace/GNU-toolchain/arm-12-mpacbti/src/newlib-cygwin/newlib/libc/misc/fini.c:36: undefined reference to `_fini'
collect2.exe: error: ld returned 1 exit status
NMAKE : fatal error U1077: 'C:\PROGRA~2\ARMGNU~1\1213FB~1.2MP\bin\AR19DD~1.EXE' : return code '0x1'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.

I am using this line in my CMakeLists.txt for the "armgcc" build:

set(CMAKE_EXE_LINKER_FLAGS "--specs=nosys.specs" CACHE INTERNAL "")

Any ideas? I noticed that I still have a pdex.bin in my /Source folder rather than a pdex.elf as mentioned here https://help.play.date/developer/os-2.0/#appendix-compilation-requirements

I am not using any custom build steps other than adding the --specs=nosys.specs linker flag.

Sorry if I've missed something obvious.

EDIT: Things I've tried:

  • Updated to latest visual studio and rerun builds - same issue.
  • vcvarsall.bat has been run in project directory (otherwise cmake and nmake wouldn't be available).
  • each time I attempt to run arm builds and visual studio simulator builds I clean the relevent build directories so no old files are lingering.
  • tried running arm build without the --specs=nosys.specs flag and still get the same issue.

@willco noticed something odd about the SDK installer on Windows--looks like it merges the new files into an existing SDK instead of replacing them, which can leave gunk behind (namely, old pdex.bin files that shouldn't be in source folders any more). Can you try moving your current SDK folder aside by renaming it, then install a clean copy of the 2.0 SDK folder and see if that changes anything? I'm not sure what else would be causing those errors.. We didn't change the version of the ARM toolchain in 2.0. :thinking:

If that does work you'll likely then run into this issue: SDK 2.0 can't build C examples for the Windows Simulator with NMAKE unless, due to pdc not checking for a pdex.dll file. :man_facepalming: But adding an empty main.lua file in the source folder will work around that until we get the fix out.

I'll try wiping and reinstalling the SDK although I have been renaming old SDK folder versions before installing SDK updates for a while now so it should have been a clean install.

Also, delete the pdex.bin file in your Source folder and delete the contents of your build dir and let Cmake rebuild it all; see if that helps.

I tried deleting the pdex.bin in Source folder in my project as well as the build dir but still get the same problem.

At this point I think I had better try building one of the examples and see if that works.

Thanks for your help, I'll update a bit later once I've tried everything again (and got my daughter to sleep)

Hey, I'm having the same issue. I tried the following.

  • Uninstall Playdate SDK (which deletes the PlaydateSDK folder)
  • Delete cmake output folder
  • Delete pdex.bin (and pdex.dll)
  • Re-install SDK
  • Create CMAKE output folder, generate cmake, run nmake

And no dice. My project mixes lua and C, so I have a main.lua already, and I tried adding an empty pdex.bin with no luck. The full error:

[100%] Linking C executable fez_c_DEVICE.elf
        C:\PROGRA~2\ARMGNU~1\112202~1.02\bin\AR19DD~1.EXE -nostartfiles -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -D__FPU_USED=1 -TC:/Users/Tinde/Documents/PlaydateSDK/C_API/buildsupport/link_map.ld -Wl,-Map=game.map,--cref,--gc-sections,--no-warn-mismatch,--emit-relocs --entry eventHandlerShim "CMakeFiles\fez_c_DEVICE.dir\src\Camera.c.obj"  "CMakeFiles\fez_c_DEVICE.dir\src\Renderer.c.obj"  "CMakeFiles\fez_c_DEVICE.dir\src\Texture.c.obj"  "CMakeFiles\fez_c_DEVICE.dir\src\luaglue.c.obj"  "CMakeFiles\fez_c_DEVICE.dir\src\main.c.obj"  "CMakeFiles\fez_c_DEVICE.dir\C_\Users\Tinde\Documents\PlaydateSDK\C_API\buildsupport\setup.c.obj"  -o fez_c_DEVICE.elf
c:/progra~2/armgnu~1/112202~1.02/bin/../lib/gcc/arm-none-eabi/11.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/progra~2/armgnu~1/112202~1.02/bin/../lib/gcc/arm-none-eabi/11.2.1/thumb/v7e-m+fp/hard\libc.a(lib_a-abort.o): in function `abort':
/data/jenkins/workspace/GNU-toolchain/arm-11/src/newlib-cygwin/newlib/libc/stdlib/abort.c:59: undefined reference to `_exit'
c:/progra~2/armgnu~1/112202~1.02/bin/../lib/gcc/arm-none-eabi/11.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/progra~2/armgnu~1/112202~1.02/bin/../lib/gcc/arm-none-eabi/11.2.1/thumb/v7e-m+fp/hard\libc.a(lib_a-signalr.o): in function `_kill_r':
/data/jenkins/workspace/GNU-toolchain/arm-11/src/newlib-cygwin/newlib/libc/reent/signalr.c:53: undefined reference to `_kill'
c:/progra~2/armgnu~1/112202~1.02/bin/../lib/gcc/arm-none-eabi/11.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/progra~2/armgnu~1/112202~1.02/bin/../lib/gcc/arm-none-eabi/11.2.1/thumb/v7e-m+fp/hard\libc.a(lib_a-signalr.o): in function `_getpid_r':
/data/jenkins/workspace/GNU-toolchain/arm-11/src/newlib-cygwin/newlib/libc/reent/signalr.c:83: undefined reference to `_getpid'
c:/progra~2/armgnu~1/112202~1.02/bin/../lib/gcc/arm-none-eabi/11.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/progra~2/armgnu~1/112202~1.02/bin/../lib/gcc/arm-none-eabi/11.2.1/thumb/v7e-m+fp/hard\libc.a(lib_a-writer.o): in function `_write_r':
/data/jenkins/workspace/GNU-toolchain/arm-11/src/newlib-cygwin/newlib/libc/reent/writer.c:49: undefined reference to `_write'
c:/progra~2/armgnu~1/112202~1.02/bin/../lib/gcc/arm-none-eabi/11.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/progra~2/armgnu~1/112202~1.02/bin/../lib/gcc/arm-none-eabi/11.2.1/thumb/v7e-m+fp/hard\libc.a(lib_a-closer.o): in function `_close_r':
/data/jenkins/workspace/GNU-toolchain/arm-11/src/newlib-cygwin/newlib/libc/reent/closer.c:47: undefined reference to `_close'
c:/progra~2/armgnu~1/112202~1.02/bin/../lib/gcc/arm-none-eabi/11.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/progra~2/armgnu~1/112202~1.02/bin/../lib/gcc/arm-none-eabi/11.2.1/thumb/v7e-m+fp/hard\libc.a(lib_a-fstatr.o): in function `_fstat_r':
/data/jenkins/workspace/GNU-toolchain/arm-11/src/newlib-cygwin/newlib/libc/reent/fstatr.c:55: undefined reference to `_fstat'
c:/progra~2/armgnu~1/112202~1.02/bin/../lib/gcc/arm-none-eabi/11.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/progra~2/armgnu~1/112202~1.02/bin/../lib/gcc/arm-none-eabi/11.2.1/thumb/v7e-m+fp/hard\libc.a(lib_a-isattyr.o): in function `_isatty_r':
/data/jenkins/workspace/GNU-toolchain/arm-11/src/newlib-cygwin/newlib/libc/reent/isattyr.c:52: undefined reference to `_isatty'
c:/progra~2/armgnu~1/112202~1.02/bin/../lib/gcc/arm-none-eabi/11.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/progra~2/armgnu~1/112202~1.02/bin/../lib/gcc/arm-none-eabi/11.2.1/thumb/v7e-m+fp/hard\libc.a(lib_a-lseekr.o): in function `_lseek_r':
/data/jenkins/workspace/GNU-toolchain/arm-11/src/newlib-cygwin/newlib/libc/reent/lseekr.c:49: undefined reference to `_lseek'
c:/progra~2/armgnu~1/112202~1.02/bin/../lib/gcc/arm-none-eabi/11.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/progra~2/armgnu~1/112202~1.02/bin/../lib/gcc/arm-none-eabi/11.2.1/thumb/v7e-m+fp/hard\libc.a(lib_a-readr.o): in function `_read_r':
/data/jenkins/workspace/GNU-toolchain/arm-11/src/newlib-cygwin/newlib/libc/reent/readr.c:49: undefined reference to `_read'
collect2.exe: error: ld returned 1 exit status
NMAKE : fatal error U1077: 'C:\PROGRA~2\ARMGNU~1\112202~1.02\bin\AR19DD~1.EXE' : return code '0x1'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.

Let me know if there's anything I need to check/test!

Sorry for late response to this. I was in the middle of a big feature that I wanted to complete before trying to figure the build issues out. I was able to keep using the old pdex.bin which allowed me to keep running simulator builds.

I have just deleted the old pdex.dll and pdex.bin from my "/Source" folder and added an empty main.lua into my "/Source" folder. This allowed me to run simulator builds once again without relying on the old pdex.bin.

My device build still isn't working though and still gives the same output as shown in my OP.

What is funny is that my old pre 2.0 builds do work on my Playdate device that is updated to 2.0 firmware. I am using only C/CAPI with no lua so I was curious as to what parts of the CAPI no longer work on 2.0 since all the CAPI features I've used so far, do work.

With hindsight, I should have downloaded the 2.0 beta SDK's and sorted this out back then. I will definitely be doing that in future SDK beta releases.

I have just successfully made a device build for "Sprite Game" from the SDK 2.0 CAPI Examples.
So there must be something that I am doing in my code that is preventing device build from working for my game.

Still looking...

Ok, ok. I figured it out. I had some debug code which had a call to exit(). This obviously pulls in a bunch of C file system stuff that is not needed/supported on device. Commenting out these calls to exit() and rerunning the device build fixes my issue.

To @lurgypai , Just check for any C calls you may have in your code that may be specific to non arm systems. assert(), exit() and srand() are common ones to look out for.

Sorry for wasting anyones time with this, I'm all good now!

3 Likes

Sorry for the really late update to this, been busy with work.
It was indeed an C system call, I was using sprintf for generating filenames to read. This worked before the 2.0.0 SDK, and I would appreciate not having to roll my own C standard library functions if necessary. Are C standard library functions not supported moving forward? If this is a bug I'll add a new thread reporting it as such, otherwise I'll just write my own.

Edit:
Welp, I realized I definitely did not compile it before the 2.0 SDK lol, I added it after, the addition just happened to coincide with the SDK launch. I was able to make do with just strcat and atoi. Note to self, no standard lib headers!