GameZero.jl icon indicating copy to clipboard operation
GameZero.jl copied to clipboard

UndefVarError: libsdl2_{ttf,image} not defined (Apple Silicon / M1 Mac)

Open shg opened this issue 2 years ago • 4 comments

I tried to run the file in the example directory and got an error. I see the same error when I tried GZExamples. Any idea? I installed master of SimpleMediaLayer and GameZero. I'm on M1 Mac and sdl2 libraries are installed by homebrew.

julia> using GameZero
julia> rungame("~/.julia/packages/GameZero/e03cc/example/BasicGame/basic.jl")
ERROR: UndefVarError: libsdl2_ttf not defined
Stacktrace:
 [1] TTF_Init
   @ ~/.julia/packages/SimpleDirectMediaLayer/gJANO/src/LibSDL2.jl:5233 [inlined]
 [2] initSDL()
   @ GameZero ~/.julia/packages/GameZero/17XG0/src/GameZero.jl:284
 [3] initgame(jlf::String, external::Bool)
   @ GameZero ~/.julia/packages/GameZero/17XG0/src/GameZero.jl:208
 [4] rungame(jlf::String, external::Bool)
   @ GameZero ~/.julia/packages/GameZero/17XG0/src/GameZero.jl:186
 [5] rungame(jlf::String)
   @ GameZero ~/.julia/packages/GameZero/17XG0/src/GameZero.jl:185
 [6] top-level scope
   @ REPL[5]:1
julia> versioninfo()
Julia Version 1.7.2
Commit bf53498635 (2022-02-06 15:21 UTC)
Platform Info:
  OS: macOS (arm64-apple-darwin21.2.0)
  CPU: Apple M1 Max
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, cyclone)
Environment:
  JULIA_GR_PROVIDER = GR
(@v1.7) pkg> st GameZero SimpleDirectMediaLayer
      Status `~/.julia/environments/v1.7/Project.toml`
  [9da27670] GameZero v0.3.0 `https://github.com/aviks/GameZero.jl.git#master`
  [98e33af6] SimpleDirectMediaLayer v0.3.0 `https://github.com/JuliaMultimedia/SimpleDirectMediaLayer.jl.git#master`
$ brew list|grep sdl2
sdl2
sdl2_gfx
sdl2_image
sdl2_mixer
sdl2_net
sdl2_ttf

shg avatar Apr 16 '22 22:04 shg

Yeah, SDL2_ttf jll is not built for apple m1.

cf: https://github.com/JuliaBinaryWrappers/SDL2_ttf_jll.jl/tree/main/src/wrappers

Someone needs to rebuild this in Yggdrasil

aviks avatar Apr 18 '22 01:04 aviks

Thank you. I wish I could contribute but I have no experience with jll. I will wait for someone else to work on it.

shg avatar Apr 18 '22 13:04 shg

I haven't tried myself, but this should have been fixed by https://github.com/JuliaPackaging/Yggdrasil/pull/5483. Curiously, https://github.com/JuliaPackaging/Yggdrasil/pull/3367 was already meant to build the library for this platform, but failed to do so in practice.

giordano avatar Sep 13 '22 23:09 giordano

To make GameZero work on Apple Silicom Mac, it seems SDL2_image_jll needs to be built as well.

https://github.com/JuliaPackaging/Yggdrasil/issues/5484

I renamed the title and keep this issue open.

shg avatar Sep 16 '22 08:09 shg

SDL2_image_jll should now be available for M1

aviks avatar Sep 17 '22 22:09 aviks

I confirmed SDL2 related issues are fixed on my M1 Mac. Thank you very much!

I can run examples although there are some issues related to screen resolution. I will register another issue if necessary after a little more digging.

shg avatar Sep 18 '22 00:09 shg