gameBase icon indicating copy to clipboard operation
gameBase copied to clipboard

FATAL ERROR : Failed to load function sdl@gl_polygon_offset

Open wihu opened this issue 1 year ago • 6 comments

Hi, I tried to run gameBase with: haxe: 4.3.4 hashlink: 1.14.0 heaps: 2.0.0 platform: macos sonoma 14.4.1

compiled successfully with: haxe build.opengl.hxml

_base.hxml
-D windowSize=1280x720
-hl bin/client.hl
-lib hlsdl

then running: hl bin/client.hl gives me this error:

src/module.c(567) : FATAL ERROR : Failed to load function sdl@gl_polygon_offset

it used to work some time ago, before I upgraded haxe/hashlink/heaps versions..

wihu avatar Apr 17 '24 09:04 wihu

It seems like the OpenGL target is currently broken. I'm not sure if it's related to latest Heaps, I'll investigate the issue asap.

deepnight avatar Apr 17 '24 14:04 deepnight

I am facing the same issue, I found that this functions is marked as unused on SDL since 9 years ago https://github.com/libsdl-org/SDL/blame/2cf32b0e0a55e3ca3cc52cd01901a06dca722d9b/src/render/opengl/SDL_glfuncs.h#L301. It seems unlikely that a new version of SDL is the issue, it also seems that the hxsdl is updated frequently so maybe the issue is there?

Nazariglez avatar May 17 '24 18:05 Nazariglez

iirc that's about hashlink (or, to be more precise, sdl.hdll) being too old You might want to try hashlink nightlies

kLabz avatar May 17 '24 18:05 kLabz

It makes sense, however the version on brew seems to be latest released version on the github repo, there is a nightly version using the latest commit but there is no binaries for an amd mac, so I built from source following the osx instructions, and while the installation went ok I got this error:

[1]    17768 segmentation fault  hl hello.hl

--

(lldb) target create /usr/local/bin/hl
Current executable set to '/usr/local/bin/hl' (arm64).
(lldb) settings set target.run-args "bin/client.hl"
(lldb) run
Process 15309 launched: '/usr/local/bin/hl' (arm64)
Process 15309 stopped
* thread #1, stop reason = EXC_BAD_ACCESS (code=1, address=0xffffffffffffffff)
    frame #0: 0x00000001995171ec
->  0x1995171ec: stnp   q2, q3, [x0]
    0x1995171f0: subs   x2, x2, #0x40
    0x1995171f4: b.ls   0x199517210
    0x1995171f8: stnp   q0, q1, [x3]
(lldb) bt
* thread #1, stop reason = EXC_BAD_ACCESS (code=1, address=0xffffffffffffffff)
  * frame #0: 0x00000001995171ec
    frame #1: 0x000000010001b510 hl`hl_module_init + 444
    frame #2: 0x000000010001a844 hl`main + 628
    frame #3: 0x000000019915e0e0
(lldb)

Am I missing some step or something?

Nazariglez avatar May 17 '24 20:05 Nazariglez

Never mind: https://github.com/HaxeFoundation/hashlink/issues/667 😞

Nazariglez avatar May 17 '24 20:05 Nazariglez

Well... After a lot of try and error I got it working. I am going to leave here the steps I did in case it helps anybody out there:

  • Install rosetta: softwareupdate --install-rosetta
  • Move to a x86_64 terminal arch -x86_64 /usr/bin/env zsh you can check with uname -m
  • Install x86_64 brew (this will NOT override your arm brew, don't worry): arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  • Clone hashlink: git clone [email protected]:HaxeFoundation/hashlink.git
  • Install deps: cd hashlink && arch -x86_64 brew bundle
  • Edit Makefile replacing the brew path to the x86_64 brew:
BPREFIX := $(shell /usr/local/bin/brew --prefix)

BREW_LIBJPEG := $(shell /usr/local/bin/brew --prefix libjpeg-turbo)
BREW_SDL2 := $(shell /usr/local/bin/brew --prefix sdl2)
BREW_JPEGTURBO := $(shell /usr/local/bin/brew --prefix jpeg-turbo)
BREW_VORBIS := $(shell /usr/local/bin/brew --prefix libvorbis)
BREW_OPENAL := $(shell /usr/local/bin/brew --prefix openal-soft)
BREW_MBEDTLS := $(shell /usr/local/bin/brew --prefix mbedtls)
BREW_LIBPNG := $(shell /usr/local/bin/brew --prefix libpng)
BREW_LIBOGG := $(shell /usr/local/bin/brew --prefix libogg)
BREW_LIBUV := $(shell /usr/local/bin/brew --prefix libuv)
  • Then build: arch -x86_64 make
  • And install: arch -86_64 make install

And that's it, doing hl bin/client.hl should works.

I think we can close this issue @deepnight because it seems that this cannot be addressed from this repo/project.

Thanks!

Nazariglez avatar May 17 '24 21:05 Nazariglez

Thank you for trying and posting the solution @Nazariglez ! I gave up trying at some point and working on something else in the end, but I will try again later with your solution!

wihu avatar Jun 07 '24 08:06 wihu

Closing this PR as this is an issue with the hashlink, not gameBase.

wihu avatar Jun 07 '24 08:06 wihu