vkoskiv / cosmo-sdl-template

A build-once run-anywhere SDL2 program.
MIT License
21 stars 0 forks source link

Issue with running cosmo-sdl.com on MacOS #1

Open tkotha opened 1 month ago

tkotha commented 1 month ago

Hey there, First want to say nice work with this project! I was able to test the cosmo-sdl.com executable that I downloaded from the repo on my windows and linux machine and it worked just fine. But MacOS has a curious error attached to it:

Couldn't find SDL library (dlopen() isn't supported on x86-64 MacOS), tried the following names: "libSDL2-2.0.so" "libSDL2-2.0.0.dylib" "SDL2.dll" 
Failed to get symbols, bailing out.

Here's a fuller stack trace

bash-3.2$ ./cosmo-sdl.com --strace
SYS      0      0             22'964 bell system five system call support 271 magnums loaded on xnu's not unix!
SYS   2266   2311            196'488 getenv("COSMOPOLITAN_DISABLE_ZIPOS") → NULL
SYS   2266   2311            202'221 getenv("COSMOPOLITAN_INIT_ZIPOS") → NULL
SYS   2266   2311            207'750 getcwd([u"n/a"], 1'019) → -1 ENOSYS
SYS   2266   2311            212'608 openat(AT_FDCWD, "", O_RDONLY) → -1 ENOSYS
SYS   2266   2311            215'320 __zipos_get("") → -14 ENOSYS
SYS   2266   2311            217'270 getenv("COMDBG") → NULL
SYS   2266   2311            221'432 openat(AT_FDCWD, ".dbg", O_RDONLY|O_CLOEXEC) → -1 ENOSYS
SYS   2266   2311            224'509 openat(AT_FDCWD, ".com.dbg", O_RDONLY|O_CLOEXEC) → -1 ENOSYS
SYS   2266   2311            227'368 openat(AT_FDCWD, "", O_RDONLY|O_CLOEXEC) → -1 ENOSYS
SYS   2266   2311            230'179 getenv("HOME") → "/Users/gamenovice"
SYS   2266   2311            232'140 getenv("TMPDIR") → "/var/folders/hc/8fhq7rhd5hx_lg3png94q0kr0000gn/T/"
SYS   2266   2311            236'087 getenv("TERM") → "xterm-256color"
SYS   2266   2311            241'611 dlopen("libSDL2-2.0.so", 1) → 0 ENOSYS
SYS   2266   2311            244'808 dlopen("libSDL2-2.0.0.dylib", 1) → 0 ENOSYS
SYS   2266   2311            247'790 dlopen("SDL2.dll", 1) → 0 ENOSYS
SYS   2266   2311            249'490 dlerror() → "dlopen() isn't supported on x86-64 MacOS"
Couldn't find SDL library (dlopen() isn't supported on x86-64 MacOS), tried the following names: "libSDL2-2.0.so" "libSDL2-2.0.0.dylib" "SDL2.dll" 
SYS   2266   2311            254'642 write(1, u"Couldn‘t find SDL library (dlopen() isn‘"..., 148) → 148 ENOSYS
Failed to get symbols, bailing out.
SYS   2266   2311            258'593 write(1, u"Failed to get symbols, bailing out.◙", 36) → 36 ENOSYS
SYS   2266   2311            261'156 exit(-1)
SYS   2266   2311            262'749 __cxa_finalize(&41f5e0, 0)
SYS   2266   2311            264'639 __cxa_finalize(&426ab0, 0)
SYS   2266   2311            266'483 _Exit(-1)

Full disclosure, I ran this on mac osx 10.8.5, which is very old, but I think it's worth checking to see if this issue crops up in other recent mac os versions as well.

ppebb commented 2 weeks ago

Seems cosmopolitan just doesn't support dlopen on certain platforms, unfortunately. https://github.com/jart/cosmopolitan/blob/9a5a13854dba8a8169fd0cd59e76a014e3822f75/libc/dlopen/dlopen.c#L827