finnvoor / PlaydateKit

Create games for Playdate using Swift.
https://finnvoor.github.io/PlaydateKit/documentation/playdatekit
Creative Commons Zero v1.0 Universal
199 stars 21 forks source link

I can't build PlaydateKitTemplate #44

Closed kkebo closed 7 months ago

kkebo commented 7 months ago

Summary

I can't build PlaydateKitTemplate.

How to reproduce

  1. Install Xcode 15.3
  2. Install Swift 6.0 Development toolchain
  3. Add /Library/Developer/Toolchains/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-04-05-a.xctoolchain/usr/bin to $PATH
  4. Clone https://github.com/finnvoor/PlaydateKitTemplate
  5. Build with swift package pdc

Logs

$ swift package pdc
Fetching https://github.com/finnvoor/PlaydateKit.git from cache
Fetched https://github.com/finnvoor/PlaydateKit.git from cache (0.68s)
Creating working copy for https://github.com/finnvoor/PlaydateKit.git
Working copy of https://github.com/finnvoor/PlaydateKit.git resolved at main (b9a69fb)
found Swift toolchain: org.swift.600202404051a
found Playdate SDK
copying resources
building pladatekit_simulator.swiftmodule
building playdatekit_device.swiftmodule
/Users/kebo/PlaydateKitTemplate/.build/checkouts/PlaydateKit/Sources/PlaydateKit/Core/Display.swift:1:8: warning: public import of 'CPlaydate' was not used in public declarations or inlinable code
 1 | public import CPlaydate
   |        `- warning: public import of 'CPlaydate' was not used in public declarations or inlinable code
 2 | 
 3 | /// Functions pertaining to Playdate’s screen.

/Users/kebo/PlaydateKitTemplate/.build/checkouts/PlaydateKit/Sources/PlaydateKit/Core/Display.swift:1:8: warning: public import of 'CPlaydate' was not used in public declarations or inlinable code
 1 | public import CPlaydate
   |        `- warning: public import of 'CPlaydate' was not used in public declarations or inlinable code
 2 | 
 3 | /// Functions pertaining to Playdate’s screen.

/Users/kebo/PlaydateKitTemplate/.build/checkouts/PlaydateKit/Sources/PlaydateKit/Core/Sound.swift:1:8: warning: public import of 'CPlaydate' was not used in public declarations or inlinable code
  1 | public import CPlaydate
    |        `- warning: public import of 'CPlaydate' was not used in public declarations or inlinable code
  2 | 
  3 | /// Functions related to audio playback.

/Users/kebo/PlaydateKitTemplate/.build/checkouts/PlaydateKit/Sources/PlaydateKit/Core/Sound.swift:1:8: warning: public import of 'CPlaydate' was not used in public declarations or inlinable code
  1 | public import CPlaydate
    |        `- warning: public import of 'CPlaydate' was not used in public declarations or inlinable code
  2 | 
  3 | /// Functions related to audio playback.

/Users/kebo/PlaydateKitTemplate/.build/checkouts/PlaydateKit/Sources/PlaydateKit/Geometry/Rect.swift:1:8: warning: public import of 'CPlaydate' was not used in public declarations or inlinable code
 1 | public import CPlaydate
   |        `- warning: public import of 'CPlaydate' was not used in public declarations or inlinable code
 2 | 
 3 | // MARK: - Rect
building playdatekittemplate_simulator.o
/Users/kebo/PlaydateKitTemplate/.build/checkouts/PlaydateKit/Sources/PlaydateKit/Geometry/Rect.swift:1:8: warning: public import of 'CPlaydate' was not used in public declarations or inlinable code
 1 | public import CPlaydate
   |        `- warning: public import of 'CPlaydate' was not used in public declarations or inlinable code
 2 | 
 3 | // MARK: - Rect
building playdatekittemplate_device.o
building pdex.dylib
building pdex.elf
In file included from /Users/kebo/Developer/PlaydateSDK//C_API/buildsupport/setup.c:2:
/Users/kebo/Developer/PlaydateSDK//C_API/pd_api.h:13:10: fatal error: 'stdlib.h' file not found
   13 | #include <stdlib.h>
      |          ^~~~~~~~~~
1 error generated.
error: clangFailed(exitCode: 1)

Environment

$ sw_vers
ProductName:            macOS
ProductVersion:         14.4.1
BuildVersion:           23E224
$ which swift
/Library/Developer/Toolchains/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-04-05-a.xctoolchain/usr/bin/swift
$ swift --version
Apple Swift version 6.0-dev (LLVM 3b959ba388a8ad9, Swift bb339b8f50f01fb)
Target: arm64-apple-macosx14.0
$ echo $TOOLCHAINS
org.swift.600202404051a
glhaynes commented 7 months ago

I had a similar issue and got past it by adding PLAYDATE_SDK_PATH to my shell. For instance: export PLAYDATE_SDK_PATH=~/Developer/PlaydateSDK added to my ~/.zprofile.

kkebo commented 7 months ago

I found that the step 3 is the cause.

  1. Add /Library/Developer/Toolchains/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-04-05-a.xctoolchain/usr/bin to $PATH
$ which swift
/usr/bin/swift
$ swift package pdc
found Swift toolchain: org.swift.600202404051a
found Playdate SDK
copying resources
building pladatekit_simulator.swiftmodule
building playdatekit_device.swiftmodule
/Users/kebo/PlaydateKitTemplate/.build/checkouts/PlaydateKit/Sources/PlaydateKit/Core/Display.swift:1:8: warning: public import of 'CPlaydate' was not used in public declarations or inlinable code
 1 | public import CPlaydate
   |        `- warning: public import of 'CPlaydate' was not used in public declarations or inlinable code
 2 | 
 3 | /// Functions pertaining to Playdate’s screen.

/Users/kebo/PlaydateKitTemplate/.build/checkouts/PlaydateKit/Sources/PlaydateKit/Core/Display.swift:1:8: warning: public import of 'CPlaydate' was not used in public declarations or inlinable code
 1 | public import CPlaydate
   |        `- warning: public import of 'CPlaydate' was not used in public declarations or inlinable code
 2 | 
 3 | /// Functions pertaining to Playdate’s screen.

/Users/kebo/PlaydateKitTemplate/.build/checkouts/PlaydateKit/Sources/PlaydateKit/Core/Sound.swift:1:8: warning: public import of 'CPlaydate' was not used in public declarations or inlinable code
  1 | public import CPlaydate
    |        `- warning: public import of 'CPlaydate' was not used in public declarations or inlinable code
  2 | 
  3 | /// Functions related to audio playback.

/Users/kebo/PlaydateKitTemplate/.build/checkouts/PlaydateKit/Sources/PlaydateKit/Core/Sound.swift:1:8: warning: public import of 'CPlaydate' was not used in public declarations or inlinable code
  1 | public import CPlaydate
    |        `- warning: public import of 'CPlaydate' was not used in public declarations or inlinable code
  2 | 
  3 | /// Functions related to audio playback.

/Users/kebo/PlaydateKitTemplate/.build/checkouts/PlaydateKit/Sources/PlaydateKit/Geometry/Rect.swift:1:8: warning: public import of 'CPlaydate' was not used in public declarations or inlinable code
 1 | public import CPlaydate
   |        `- warning: public import of 'CPlaydate' was not used in public declarations or inlinable code
 2 | 
 3 | // MARK: - Rect
/Users/kebo/PlaydateKitTemplate/.build/checkouts/PlaydateKit/Sources/PlaydateKit/Geometry/Rect.swift:1:8: warning: public import of 'CPlaydate' was not used in public declarations or inlinable code
 1 | public import CPlaydate
   |        `- warning: public import of 'CPlaydate' was not used in public declarations or inlinable code
 2 | 
 3 | // MARK: - Rect
building playdatekittemplate_simulator.o
building playdatekittemplate_device.o
building pdex.dylib
building pdex.elf
running pdc
Skipping pdex.dylib.dSYM/Contents/Info.plist
Skipping pdex.dylib.dSYM/Contents/Resources/DWARF/pdex.dylib
Skipping pdex.dylib.dSYM/Contents/Resources/Relocations/aarch64/pdex.dylib.yml