Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix finishCallback not compiling and pass the player to the callback #69

Merged
merged 1 commit into from
Apr 13, 2024

Conversation

samdze
Copy link
Owner

@samdze samdze commented Apr 7, 2024

Add a finishCallback usage to the example project

Copy link
Collaborator

@ninovanhooff ninovanhooff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, works well with Wheelsprung, no related warnings.

The only one left for me is /Users/ninovanhooff/.choosenim/toolchains/nim-1.6.16/lib/system/repr_v2.nim(102, 7) Hint: 'firstElement' is declared but not used [XDeclaredButNotUsed]

Hopefully fixed in Nim v2, and not something under our control, I think. In any case unrelated to this PR

@ninovanhooff
Copy link
Collaborator

Still this compile error on windows:

ninoLocal@NINO-WIN10 MINGW64 ~/codeProjects/wheelsprung (main)
$ nimble clean
  Executing task clean in C:\Users\ninov\codeProjects\wheelsprung\wheelsprung.nimble

ninoLocal@NINO-WIN10 MINGW64 ~/codeProjects/wheelsprung (main)
$ nimble install
  Verifying dependencies for [email protected]
      Info: Dependency on https://github.com/samdze/playdate-nim@#finish-callback-fix already satisfied
  Verifying dependencies for playdate@#finish-callback-fix
      Info: Dependency on https://github.com/ninovanhooff/nim-chipmunk-playdate@any version already satisfied
  Verifying dependencies for [email protected]
 Installing [email protected]
   Building wheelsprung/wheelsprung.exe using c backend
C:\Users\ninov\nimcache\wheelsprung_r\@m..@s..@[email protected]@spkgs@splaydate-@hfinish-callback-fix@[email protected]: In function 'setFinishCallback__OOZOOZOOZOnimbleZpkgsZplaydate4535finish45callback45fixZplaydateZsound_569':
C:\Users\ninov\nimcache\wheelsprung_r\@m..@s..@[email protected]@spkgs@splaydate-@hfinish-callback-fix@[email protected]:759:18: error: too many arguments to function '((const struct playdate_sound_sampleplayer *)playdate__OOZOOZOOZOnimbleZpkgsZplaydate4535finish45callback45fixZplaydateZbindingsZapi_30->sound->sampleplayer)->setFinishCallback'
  759 |                 (*(*(*playdate__OOZOOZOOZOnimbleZpkgsZplaydate4535finish45callback45fixZplaydateZbindingsZapi_30).sound).sampleplayer).setFinishCallback((*this_0).Sup.resource, NIM_NIL, NIM_NIL);
      |                 ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\ninov\nimcache\wheelsprung_r\@m..@s..@[email protected]@spkgs@splaydate-@hfinish-callback-fix@[email protected]:765:18: error: too many arguments to function '((const struct playdate_sound_sampleplayer *)playdate__OOZOOZOOZOnimbleZpkgsZplaydate4535finish45callback45fixZplaydateZbindingsZapi_30->sound->sampleplayer)->setFinishCallback'
  765 |                 (*(*(*playdate__OOZOOZOOZOnimbleZpkgsZplaydate4535finish45callback45fixZplaydateZbindingsZapi_30).sound).sampleplayer).setFinishCallback((*this_0).Sup.resource, privateSamplePlayerFinishCallback__OOZOOZOOZOnimbleZpkgsZplaydate4535finish45callback45fixZplaydateZsound_559, ((void*) (this_0)));
      |                 ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: execution of an external compiler program 'C:\nim-1.6.16\dist\mingw64\bin\gcc.exe -c  -w -fmax-errors=3 -mno-ms-bitfields -DTARGET_EXTENSION=1 -Wall -Wno-unknown-pragmas -Wdouble-promotion -IC:\Users\ninov\Documents\PlaydateSDK\C_API -O3 -fno-strict-aliasing -fno-ident   -IC:\nim-1.6.16\lib -IC:\Users\ninov\codeProjects\wheelsprung\src -o C:\Users\ninov\nimcache\wheelsprung_r\@m..@s..@[email protected]@spkgs@splaydate-@hfinish-callback-fix@[email protected] C:\Users\ninov\nimcache\wheelsprung_r\@m..@s..@[email protected]@spkgs@splaydate-@hfinish-callback-fix@[email protected]' failed with exit code: 1


       Tip: 5 messages have been suppressed, use --verbose to show them.
     Error: Build failed for package: wheelsprung
        ... Execution failed with exit code 1
        ... Command: C:\nim-1.6.16\bin\nim.exe c --colors:on --noNimblePath -d:release -d:NimblePkgVersion=0.2.0 --path:C:\Users\ninov\.nimble\pkgs\playdate-#finish-callback-fix --path:C:\Users\ninov\.nimble\pkgs\chipmunk7-7.0.3 --hints:off -o:C:\Users\ninov\codeProjects\wheelsprung\wheelsprung.exe C:\Users\ninov\codeProjects\wheelsprung\src\wheelsprung.nim

ninoLocal@NINO-WIN10 MINGW64 ~/codeProjects/wheelsprung (main)
$

@samdze
Copy link
Owner Author

samdze commented Apr 9, 2024

Mhh I just tested the example project on Windows and it compiled fine, what's the Nim code that spawns that error on your machine?
Also, is Nim using the right version of the bindings (seems like it is, judging from your use of a specific package url, even though I never tested obtaining the package via URL)? Sometimes in the past I had a few headaches due to various versions of the package being installed at once

@ninovanhooff
Copy link
Collaborator

I did a bunch of verification on my environment but still get the same result. @Nycto would you be able to verify whether this branch builds on Windows?

  • deleted all playdate directories from C:\Users\ninov\.nimble\pkgs
  • checkout out this branch to ~/codeProjects/playdate-nim/ (unix style paths due to git-bash shell)
 $ git log
commit 8b2269de73707d559db0303a8e4ff2b0174419ce
$ git status
On branch finish-callback-fix
Your branch is up-to-date with 'upstream/finish-callback-fix'.
nothing to commit, working directory clean
  • execute nimble develop there
  • My .nimble/pkgs now contains a folder playdate/#head with a playdate.nimble-link file and nimblemeta.json
ninoLocal@NINO-WIN10 MINGW64 ~/.nimble/pkgs/playdate-#head
$ cat nimblemeta.json 
{"url":"file://C:\\Users\\ninov\\codeProjects\\playdate-nim","vcsRevision":"8b2269de73707d559db0303a8e4ff2b0174419ce","files":["\\playdate.nimble-link"],"binaries":[],"isLink":true}
ninoLocal@NINO-WIN10 MINGW64 ~/.nimble/pkgs/playdate-#head
$ cat playdate.nimble-link 
C:\Users\ninov\codeProjects\playdate-nim\playdate.nimble
C:\Users\ninov\codeProjects\playdate-nim\src
  • opened the example project in that folder in vscode
  • Run debug config 'Build & Debug pdx`
 Executing task: nimble all 

  Executing task all in C:\Users\ninov\codeProjects\playdate-nim\playdate_example\playdate_example.nimble
  Verifying dependencies for [email protected]
    Reading official package list
   Checking for playdate@any version
      Info: Dependency on playdate@any version already satisfied
  Verifying dependencies for [email protected]
   Building playdate_example/playdate_example.exe using c backend
  Executing C:\nim-1.6.16\bin\nim.exe c --colors:on --noNimblePath -d:simulator -d:debug -d:NimblePkgVersion=0.8.0 --path:C:\Users\ninov\codeProjects\playdate-nim\src 
-o:C:\Users\ninov\codeProjects\playdate-nim\playdate_example\playdate_example.exe C:\Users\ninov\codeProjects\playdate-nim\playdate_example\src\playdate_example.nim   
Hint: used config file 'C:\nim-1.6.16\config\nim.cfg' [Conf]
Hint: used config file 'C:\nim-1.6.16\config\config.nims' [Conf]
Hint: used config file 'C:\Users\ninov\codeProjects\playdate-nim\playdate_example\config.nims' [Conf]
............................................................................................................
CC: ../../src/playdate/sound.nim
C:\Users\ninov\codeProjects\playdate-nim\src\playdate\sound.nim: In function 'setFinishCallback__OOZOOZsrcZplaydateZsound_569':
C:\Users\ninov\codeProjects\playdate-nim\src\playdate\sound.nim:265:4: error: too many arguments to function '((const struct playdate_sound_sampleplayer *)playdate__OOZOOZsrcZplaydateZbindingsZapi_30->sound->sampleplayer)->setFinishCallback'
  265 |         playdate.sound.sampleplayer.setFinishCallback(this.resource, nil, nil)
      |    ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\ninov\codeProjects\playdate-nim\src\playdate\sound.nim:267:4: error: too many arguments to function '((const struct playdate_sound_sampleplayer *)playdate__OOZOOZsrcZplaydateZbindingsZapi_30->sound->sampleplayer)->setFinishCallback'
  267 |         playdate.sound.sampleplayer.setFinishCallback(this.resource, privateSamplePlayerFinishCallback, cast[pointer](this))
      |    ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: execution of an external compiler program 'C:\nim-1.6.16\dist\mingw64\bin\gcc.exe -c -w -fmax-errors=3 -mno-ms-bitfields -DTARGET_EXTENSION=1 -Wall -Wno-unknown-pragmas -Wdouble-promotion -IC:\Users\ninov\Documents\PlaydateSDK\C_API -D_WINDLL=1 -DTARGET_SIMULATOR=1 -Wstrict-prototypes -g3 -O0 -gdwarf-3   -IC:\nim-1.6.16\lib -IC:\Users\ninov\codeProjects\playdate-nim\playdate_example\src -o C:\Users\ninov\nimcache\playdate_example_d\simulator\@m..@s..@ssrc@[email protected] C:\Users\ninov\nimcache\playdate_example_d\simulator\@m..@s..@ssrc@[email protected]' failed with exit code: 1


     Error: Build failed for package: playdate_example
        ... Execution failed with exit code 1
        ... Command: C:\nim-1.6.16\bin\nim.exe c --colors:on --noNimblePath -d:simulator -d:debug -d:NimblePkgVersion=0.8.0 --path:C:\Users\ninov\codeProjects\playdate-nim\src -o:C:\Users\ninov\codeProjects\playdate-nim\playdate_example\playdate_example.exe C:\Users\ninov\codeProjects\playdate-nim\playdate_example\src\playdate_example.nim
stack trace: (most recent call last)
C:\Users\ninov\AppData\Local\Temp\nimblecache-0\nimscriptapi_82906963.nim(187, 16)
C:\Users\ninov\codeProjects\playdate-nim\src\playdate\build\nimble.nim(100, 12) allTask
C:\Users\ninov\codeProjects\playdate-nim\src\playdate\build\utils.nim(22, 10) nimble
C:\nim-1.6.16\lib\system\nimscript.nim(273, 7) exec
C:\nim-1.6.16\lib\system\nimscript.nim(273, 7) Error: unhandled exception: FAILED: nimble -d:simulator -d:debug build --verbose [OSError]
     Error: Exception raised during nimble script execution

 *  The terminal process "C:\Program Files\Git\bin\bash.exe '--login', '-i', '-c', 'nimble all'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

@ninovanhooff
Copy link
Collaborator

Here are the contents of my nimcache, if it helps

nimcache.zip

@samdze
Copy link
Owner Author

samdze commented Apr 9, 2024

I tried using Nim 2.0.2 before (with the package installed using nimble install).
Tried again using Nim 1.6.16 using your exact procedure, but still got no errors:

 *  Executing task: nimble all 

  Executing task all in C:\Users\Sam\Desktop\finish-callback-fix\playdate_example\playdate_example.nimble
  Verifying dependencies for [email protected]
    Reading official package list
   Checking for playdate@any version
      Info: Dependency on playdate@any version already satisfied
  Verifying dependencies for [email protected]
   Building playdate_example/playdate_example.exe using c backend
  Executing C:\Users\Sam\.nimble\bin\nim.exe c --colors:on --noNimblePath -d:simulator -d:debug -d:NimblePkgVersion=0.8.0 --path:C:\Users\Sam\Desktop\finish-callback-fix\src -o:C:\Users\Sam\Desktop\finish-callback-fix\playdate_example\playdate_example.exe C:\Users\Sam\Desktop\finish-callback-fix\playdate_example\src\playdate_example.nim
Hint: used config file 'C:\Users\Sam\.choosenim\toolchains\nim-1.6.16\config\nim.cfg' [Conf]
Hint: used config file 'C:\Users\Sam\.choosenim\toolchains\nim-1.6.16\config\config.nims' [Conf]     
Hint: used config file 'C:\Users\Sam\Desktop\finish-callback-fix\playdate_example\config.nims' [Conf]
............................................................................................................
CC: ../../../../.choosenim/toolchains/nim-1.6.16/lib/system.nim
CC: ../../src/playdate/bindings/graphics.nim
CC: ../../src/playdate/bindings/system.nim  
CC: ../../src/playdate/bindings/file.nim    
CC: ../../src/playdate/bindings/display.nim
CC: ../../src/playdate/bindings/api.nim
CC: ../../src/playdate/system.nim  
CC: ../../src/playdate/graphics.nim
CC: ../../src/playdate/file.nim
CC: ../../../../.choosenim/toolchains/nim-1.6.16/lib/pure/collections/lists.nim
CC: ../../src/playdate/types.nim
CC: ../../src/playdate/sprite.nim
CC: ../../src/playdate/sound.nim
CC: playdate_example.nim
Hint:  [Link]
Hint: gc: arc; opt: none (DEBUG BUILD, `-d:release` generates faster code)
90813 lines; 3.245s; 145.895MiB peakmem; proj: C:\Users\Sam\Desktop\finish-callback-fix\playdate_example\src\playdate_example.nim; out: C:\Users\Sam\Desktop\finish-callback-fix\playdate_example\playdate_example.exe [SuccessX]
  Verifying dependencies for [email protected]
    Reading official package list
   Checking for playdate@any version
      Info: Dependency on playdate@any version already satisfied
  Verifying dependencies for [email protected]
   Building playdate_example/playdate_example.exe using c backend
  Executing C:\Users\Sam\.nimble\bin\nim.exe c --colors:on --noNimblePath -d:device -d:release -d:NimblePkgVersion=0.8.0 --path:C:\Users\Sam\Desktop\finish-callback-fix\src -o:C:\Users\Sam\Desktop\finish-callback-fix\playdate_example\playdate_example.exe C:\Users\Sam\Desktop\finish-callback-fix\playdate_example\src\playdate_example.nim
Hint: used config file 'C:\Users\Sam\.choosenim\toolchains\nim-1.6.16\config\nim.cfg' [Conf]
Hint: used config file 'C:\Users\Sam\.choosenim\toolchains\nim-1.6.16\config\config.nims' [Conf]     
Hint: used config file 'C:\Users\Sam\Desktop\finish-callback-fix\playdate_example\config.nims' [Conf]
............................................................................................................
CC: setup
CC: ../../../../.choosenim/toolchains/nim-1.6.16/lib/system.nim
CC: ../../src/playdate/bindings/graphics.nim
CC: ../../src/playdate/bindings/system.nim  
CC: ../../src/playdate/bindings/file.nim   
CC: ../../src/playdate/bindings/display.nim
CC: ../../src/playdate/bindings/api.nim
CC: ../../src/playdate/system.nim
CC: ../../src/playdate/graphics.nim
CC: ../../src/playdate/file.nim    
CC: ../../../../.choosenim/toolchains/nim-1.6.16/lib/pure/collections/lists.nim
CC: ../../src/playdate/types.nim
CC: ../../src/playdate/sprite.nim
CC: ../../src/playdate/sound.nim
CC: ../../src/playdate/api.nim
CC: playdate_example.nim
Hint:  [Link]
c:/program files (x86)/arm gnu toolchain arm-none-eabi/12.2 mpacbti-rel1/bin/../lib/gcc/arm-none-eabi/12.2.1/../../../../arm-none-eabi/bin/ld.exe: warning: C:\Users\Sam\Desktop\finish-callback-fix\playdate_example\playdate_example.exe has a LOAD segment with RWX permissions
Hint: gc: arc; opt: speed; options: -d:release
92634 lines; 2.603s; 117.461MiB peakmem; proj: C:\Users\Sam\Desktop\finish-callback-fix\playdate_example\src\playdate_example.nim; out: C:\Users\Sam\Desktop\finish-callback-fix\playdate_example\playdate_example.exe [SuccessX]
pdc version:
2.4.2
Unrecognized file types are copied by default. Use the -k or --skip-unknown flag to skip these files instead.
Copying json/data.json
Copying json/error.json

@samdze
Copy link
Owner Author

samdze commented Apr 9, 2024

Maybe try reinstalling the MSYS2 mingw-w64 toolchain?

@ninovanhooff
Copy link
Collaborator

I foresee that needs to be done soon again for NimV2, so I rather won't do that twice.

If you are confident enough that the problem is with my env, go ahead and merge this.

Working:
✅ Nino Nim 1.6.16 M1 sim + device
✅ Sam Nim 1.6.18? Mac
✅ Sam Nim 16.16 (+.18) on Windows
✅ CI Nim 1.16.18 Ubuntu

Not working
❌ Nino Nim 1.6.16 Win10 MinGw64

You might say that this gives us enough confidence that problem is with my setup.

I'll try again when Nim 2 is merged and debug from there. I don't need windows to be working in the meantime; I only use it for future playtests

@samdze
Copy link
Owner Author

samdze commented Apr 10, 2024

Saw this line in your build output:

Error: execution of an external compiler program 'C:\nim-1.6.16\dist\mingw64\bin\gcc.exe -c -w -fmax-errors=3 -mno-ms-bitfields -DTARGET_EXTENSION=1 -Wall -Wno-unknown-pragmas -Wdouble-promotion -IC:\Users\ninov\Documents\PlaydateSDK\C_API -D_WINDLL=1 -DTARGET_SIMULATOR=1 -Wstrict-prototypes -g3 -O0 -gdwarf-3   -IC:\nim-1.6.16\lib -IC:\Users\ninov\codeProjects\playdate-nim\playdate_example\src -o C:\Users\ninov\nimcache\playdate_example_d\simulator\@m..@s..@ssrc@[email protected] C:\Users\ninov\nimcache\playdate_example_d\simulator\@m..@s..@ssrc@[email protected]' failed with exit code: 1

Where does that C:\nim-1.6.16\dist\mingw64\bin\gcc.exe come from? Is that the MSYS2 gcc?
On my Windows machine a gcc --version gives this output:

PS C:\Users\Sam> gcc --version
gcc.exe (Rev7, Built by MSYS2 project) 13.1.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Does yours output the same info?

Also, a Get-Command gcc gives me: (I installed MSYS2 in C:\Development\msys64)

CommandType     Name                       Version    Source
-----------     ----                       -------    ------
Application     gcc.exe                    0.0.0.0    C:\Development\msys64\mingw64\bin\gcc.exe

@ninovanhooff
Copy link
Collaborator

Using pacman -QS gcc to search for installed packages matching gcc, I found a mix of mingw-w64 and mingw-w64-ucrt packages installed. I removed all ucrt entries and installed

pacman -S mingw-w64-x86_64-gcc

This does bring in ucrt though:

ninoLocal@NINO-WIN10 MINGW64 ~
$ pacman -Qs gcc
local/gcc-libs 13.2.0-2
    Runtime libraries shipped by GCC
local/mingw-w64-ucrt-x86_64-gcc-libgfortran 13.2.0-2 (mingw-w64-ucrt-x86_64-toolchain)
    GNU Compiler Collection (libgfortran) for MinGW-w64
local/mingw-w64-ucrt-x86_64-gcc-libs 13.2.0-2 (mingw-w64-ucrt-x86_64-toolchain)
    GNU Compiler Collection (libraries) for MinGW-w64
local/mingw-w64-x86_64-gcc 13.2.0-2 (mingw-w64-x86_64-toolchain)
    GNU Compiler Collection (C,C++,OpenMP) for MinGW-w64
local/mingw-w64-x86_64-gcc-libs 13.2.0-2 (mingw-w64-x86_64-toolchain)
    GNU Compiler Collection (libraries) for MinGW-w64

After this, gcc was not recognised as a program anymore, and updated my ENV variable from ucrt to C:\msys64\mingw64\bin

After restarting everything, the output to the commands you mentioned is comparable to yours, but not equal. Nim fails with the same too many arguments error.

My output:

PS C:\Users\ninov> gcc --version
gcc.exe (Rev2, Built by MSYS2 project) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

PS C:\Users\ninov> Get-Command gcc

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Application     gcc.exe                                            0.0.0.0    C:\msys64\mingw64\bin\gcc.exe


PS C:\Users\ninov>

@samdze
Copy link
Owner Author

samdze commented Apr 12, 2024

Odd, does nimble device work?

@ninovanhooff
Copy link
Collaborator

ninovanhooff commented Apr 12, 2024

There might be a hint here

After installing with pacman -S mingw-w64-x86_64-arm-none-eabi-gcc

And restarting stuff,

nimble device complains with:

ninoLocal@NINO-WIN10 MINGW64 ~/codeProjects/playdate-nim/playdate_example (finish-callback-fix)
$ arm-none-eabi-gcc.exe
arm-none-eabi-gcc.exe: fatal error: no input files
compilation terminated.

ninoLocal@NINO-WIN10 MINGW64 ~/codeProjects/playdate-nim/playdate_example (finish-callback-fix)
$ nimble device
  Executing task device in C:\Users\ninov\codeProjects\playdate-nim\playdate_example\playdate_example.nimble
  Verifying dependencies for [email protected]
    Reading official package list
   Checking for playdate@any version
      Info: Dependency on playdate@any version already satisfied
  Verifying dependencies for [email protected]
   Building playdate_example/playdate_example.exe using c backend
  Executing C:\nim-1.6.16\bin\nim.exe c --colors:on --noNimblePath -d:device -d:release -d:NimblePkgVersion=0.8.0 --path:C:\Users\ninov\codeProjects\playdate-nim\src -o:C:\Users\ninov\codeProjects\playdate-nim\playdate_example\playdate_example.exe C:\Users\ninov\codeProjects\playdate-nim\playdate_example\src\playdate_example.nim
Hint: used config file 'C:\nim-1.6.16\config\nim.cfg' [Conf]    
Hint: used config file 'C:\nim-1.6.16\config\config.nims' [Conf]
Hint: used config file 'C:\Users\ninov\codeProjects\playdate-nim\playdate_example\config.nims' [Conf]
............................................................................................................
CC: setup
Error: invocation of external compiler program failed. The system cannot find the file specified.
Additional info: Requested command not found: 'C:\nim-1.6.16\dist\mingw64\bin\arm-none-eabi-gcc.exe -c  -DTARGET_EXTENSION=1 -Wall -Wno-unknown-pragmas -Wdouble-promotion -IC:\Users\ninov\Documents\PlaydateSDK\C_API -D__HEAP_SIZE=8388208 -D__STACK_SIZE=61800 -DTARGET_PLAYDATE=1 -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 -Wno-unused-but-set-variable -Wno-unused-label -Wno-parentheses -Wno-discarded-qualifiers -Wno-array-bounds --specs=nosys.specs -O3 -fno-strict-aliasing -fno-ident   -IC:\nim-1.6.16\lib -IC:\Users\ninov\codeProjects\playdate-nim\playdate_example\src -o C:\Users\ninov\nimcache\playdate_example_r\device\setup.c.o C:\Users\ninov\Documents\PlaydateSDK\C_API\buildsupport\setup.c'. OS error: 2
     Error: Build failed for package: playdate_example
        ... Execution failed with exit code 1
        ... Command: C:\nim-1.6.16\bin\nim.exe c --colors:on --noNimblePath -d:device -d:release -d:NimblePkgVersion=0.8.0 --path:C:\Users\ninov\codeProjects\playdate-nim\src -o:C:\Users\ninov\codeProjects\playdate-nim\playdate_example\playdate_example.exe C:\Users\ninov\codeProjects\playdate-nim\playdate_example\src\playdate_example.nim
stack trace: (most recent call last)
C:\Users\ninov\AppData\Local\Temp\nimblecache-0\nimscriptapi_82906963.nim(187, 16)
C:\Users\ninov\codeProjects\playdate-nim\src\playdate\build\nimble.nim(87, 16) deviceTask
C:\Users\ninov\codeProjects\playdate-nim\src\playdate\build\utils.nim(22, 10) nimble
C:\nim-1.6.16\lib\system\nimscript.nim(273, 7) exec
C:\nim-1.6.16\lib\system\nimscript.nim(273, 7) Error: unhandled exception: FAILED: nimble -d:device -d:release build --verbose [OSError]
     Error: Exception raised during nimble script execution

So, at least in the device case, it tries to find the arm-none-eabi-gcc.exe in the mingw folder that is bundled with the Windows Nim installer.
Temporarily renaming that folder (C:\nim-1.6.16\dist\mingw64) in the hopes that it would search the PATH did not work, it still complains about expecting the compiler to be in that location.

What is the recommended way to re-install nim in such a way that it will simply use the compilers on the PATH?

@ninovanhooff
Copy link
Collaborator

ninovanhooff commented Apr 12, 2024

OK, I removed Nim and re-installed it with choosenim.

This fixed the issue with the compiler not being found, but we are back to square 1 :-(

with both device and simulator, the error posted above about too many arguments for the setFinishCallback shows up. Same for 1.6.16 and 1.6.18, and the same happening with 2.02 when cloneing Nycto's nim2 branch and merging this branch into that

Copy link
Collaborator

@ninovanhooff ninovanhooff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found a copy-paste mistake with Fileplayer.setfinishCallback. probably

@ninovanhooff
Copy link
Collaborator

ninovanhooff commented Apr 12, 2024

So I finally fixed my windows compile issue. The solution being to update the Playdate SDK from the very old 1.13.0 to the latest 2.4.2. No clue how that fixed it, but let's just get this merged and be done with it.

You might want to have a look at the comment on the fileplayer code I just posted though

@samdze
Copy link
Owner Author

samdze commented Apr 13, 2024

The solution being to update the Playdate SDK from the very old 1.13.0 to the latest 2.4.2.

Ahh, makes sense! In 1.13.0 there was no void* userdata argument in playdate->sound->sampleplayer->setFinishCallback!
Alright, final touches and I'll get this merged.

Add a finishCallback usage to the example project
@samdze samdze force-pushed the finish-callback-fix branch from 8b2269d to d0c5c74 Compare April 13, 2024 17:41
@samdze samdze merged commit 7d7eabf into main Apr 13, 2024
4 checks passed
@samdze samdze deleted the finish-callback-fix branch April 13, 2024 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants