Solved: Black screen in macOS build, January 2019

Started by Forestidia86, April 07, 2019, 03:18:30 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Forestidia86

There seems to be an issue with a macOS build. From the descriptions of macOS users:

It starts and opens a window, but which has only a black screen. The music plays and at least with ldc it segfaults.

Issue 381 on github

From the #lix log of 4th of Jan, 2019 (concerning Lix 0.9.24):

[11:24:47]    <tarzeau> i've got an up to date 10.14 mojave mac now... i shall retry?
[11:24:55]    <tarzeau> remember what i need to install with brew?
[11:25:55]    <SimonN> brew install ldc dub allegro enet
[...]
[11:30:09]    <tarzeau> uncaught exception when i run ./bin/lix but that's surely the releaseXDG
[11:30:27]    <tarzeau> rebuilding...
[11:31:19]    <tarzeau> now i get a window called Lix, which shows black, nothing else
[11:31:59]    <tarzeau> adding --build=release as in windows
[11:32:04]    <SimonN> what is your exact build command?
[11:32:20]    <tarzeau> now it's: HOME=. dub build --build=release -f --compiler=ldc2
[11:33:07]    <tarzeau> oh wow now ./bin/lix goes fullscreen
[11:33:10]    <tarzeau> staying black
[11:33:21]    <tarzeau> pressing esc: segmentation fault
[11:33:23]    <SimonN> yeah, release defaults to fullscreen
[11:34:03]    <SimonN> go into the segfault with a debugger
[...]
[11:52:11]    <SimonN> tarzeau: When you build Lix, dub outputs versions of other dub packages. What version is "allegro" in that output?
[11:54:08]    <tarzeau> allegro 4.0.4+5.2.0: building config "no-libs"
[11:54:15]    <tarzeau> maybe i should not have copied that dub packages from linux?
[11:54:47]    <SimonN> hmm, 4.0.4+5.2.0 is correct version.
[11:55:34]    * tarzeau drops HOME=. and rebuilds, removed all the *-n/ dirs too
[11:55:40]    <SimonN> Copying stuff from Linux: dub stores built binaries in .dub dir, thus the copying could cause problems. Delete ~/.dub/ and (lix)/.dub and then build.
[11:56:14]    <tarzeau> i've not taken any binaries, just the sources
[11:56:21]    <tarzeau> but will try as well...
[11:56:28]    <SimonN> ah, hm, then should work. But try anyway.
[11:57:17]    <tarzeau> all black... maybe it doesn't find data files?
[11:58:02]    <tarzeau> oh user/log.txt says
[11:58:06]    <SimonN> in dub.json, in "libs": [ ... ], between these square brackets, add this line including quotes and comma: "allegro_color",
[...]
[11:59:17]    <tarzeau> added and rebuilding...
[12:12:51]    <tarzeau> i can't find ~/.dub on macOS but i removed .dub
[12:13:06]    <SimonN> okay, hmm, I'm sure it'll be fine
[12:13:15]    <SimonN> did the rebuild do any good?
[12:15:33]    <tarzeau> but the icon appears when starting it
[12:15:36]    <tarzeau> in the dock
[12:15:43]    <tarzeau> black screen as always
[12:16:35]    <SimonN> okay. Remove `"allegro_color",` again, then `brew install dmd`, then build Lix with `--compiler=dmd`
[12:21:45]    <tarzeau> building...
[12:22:42]    <tarzeau> it also builds fine, however same black window
[12:22:54]    <tarzeau> i run ./bin/lix from the source unpacked tree
[12:23:13]    <tarzeau> however esc just exits, no segfaults
[...]
[12:56:37]    <SimonN> tarzeau: download the music: http://www.lixgame.com/dow/lix-music.zip -- extract in Lix's directory, then run the game again. Does music play during the black screen?
[13:02:25]    <tarzeau> back, i already have the music there
[13:02:31]    <tarzeau> let me make louder
[13:02:49]    <tarzeau> yep music plays
[13:06:41]    <SimonN> okay, hmmm, this is tricky then. Lix runs but doesn't display anything.
[13:08:02]    <tarzeau> ack
[13:08:06]    <tarzeau> do you use opengl?
[13:08:45]    <SimonN> Not directly. Via Allegro 5.
[13:09:43]    <SimonN> Okay, I have one abstruse idea.
[13:10:12]    <SimonN> Downgrade DAllegro5 bindings and add allegro_color back. I will instruct you how to do this.
[13:10:35]    <tarzeau> k
[13:11:51]    <SimonN> dub.json, line 13: Replace with: "allegro": "==4.0.3",
[13:12:28]    <SimonN> in line 21 or so, add new line: "allegro_color",
[13:12:40]    <SimonN> (all these times, the trailing commas are important)
[13:13:03]    <tarzeau> done
[13:13:14]    <SimonN> in dub.selection.json, replace line 4 with: "allegro": "4.0.3+5.2.0",
[13:13:34]    <tarzeau> done
[13:13:34]    <SimonN> then run: dub build --force --compiler=dmd
[13:13:47]    <tarzeau> running
[13:14:20]    <tarzeau> built, runs the same
[13:14:33]    <tarzeau> and it's the same windowed or fullscreen
[13:14:37]    <SimonN> i.e., black screen, music plays, and no image? hmm.
[13:14:42]    <tarzeau> yes
[13:14:46]    <SimonN> Okay, then I'm out of ideas :)
[13:15:22]    <tarzeau> https://www.google.ch/search?q=allegro5+macos+black+screen&oq=allegro5+macos+black+screen&aqs=chrome..69i57.5323j0j7&client=ubuntu&sourceid=chrome&ie=UTF-8
[13:15:23]    <SimonN> I didn't believe this would have helped anyway, but I would have slapped myself had it been the solution and had I not tried it.
[...]
[13:16:34]    <tarzeau> https://wiki.allegro.cc/index.php?title=Allegro_5_Tutorial/Displays ?
[13:16:49]    <tarzeau> al_flip_display(); needed?
[13:17:06]    <SimonN> yes, should be needed.
[13:17:07]    <tarzeau> i remember macOS (well cocoa) has different coordinate system
[13:17:25]    <SimonN> Allegro is an abstaction over any OS-specific stuff.
[13:17:48]    <SimonN> maybe run that example code and see if you get window
[13:17:51]    <tarzeau> https://github.com/liballeg/allegro5/issues/546
[13:18:00]    <tarzeau> single buffer?
[13:18:11]    <tarzeau> i don't know either. if you want me to retry, tell me
[13:18:47]    <tarzeau> this gh issue produces black display, works windows + linux
[13:20:10]    <SimonN> okay, no time. I think I double-buffer. My code is in src/hardware/display.d, public interface to that module is ALLEGRO_DISPLAY* display to get backbuffer to draw there, then void flip_display()

Simon

#1
Thanks for the good summary!

We had 2 people (tarzeau and MartinDelille) failing on Mac via homebrew, both in 2019, both in the same way: Build succeeds, Lix window opens, music plays (if it's downloaded), no graphics are shown.

Pressing Esc (for tarzeau) terminates the program properly. For Martin, Lix gobbles resources, then segfaults. For Martin, I merely assume that it's on a Mac; Martin didn't write about system in github issue 381.

We had spacetag succeeding in early 2018 via homebrew. But definitely spacetag built an older Lix with an older D toolchain.

Debugging ideas: I want to make a minimal D/Allegro example for Martin that shows some colored screens, then terminates. If that fails, then C/Allegro.

-- Simon

Forestidia86

This problem transformed to a crash (stop reason = EXC_BAD_ACCESS (code=1, address=0x1e000000000)) after validating the user name on macOS 10.14.4.
The program crashes in src/file/option/screen.d in the function displayTryMode.
The reason for this is not found, yet and quite puzzling.

Forestidia86

Unfortunately this problem is still not solved. If somebody owns a mac and is in the mood to help debug: here are some suggestions for testing things out.

namida

I have a 2012 Mac Mini (3rd-gen i5, dual-core, aftermarket upgrade to 16GB RAM; so should be plenty for Lix), though I'd need to get out my spare monitor (and that's if it still works) in order to use it.
My projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)
Non-Lemmings: Commander Keen: Galaxy Reimagined (a Commander Keen fangame)

Forestidia86

There seems to have been an OpenGL upgrade in macOS, which could have solved the problem. But this is still unclear, so if any mac user, that has the newest macOS version, wants to be the testing guinea pig it would still help clear things up.

Simon

Right, I haven't closed this #381 on github because we haven't gotten a positive response yet.

Thus, dear Mac enthusiasts: Can you compile Lix according to the Mac build notes, run Lix, and successfully click some buttons in the main menu? That would be enough to close this issue.

-- Simon

namida

Simon - if you'd like to look into this, I should have some time tonight or tomorrow where I can get out my Mac and we can give this a go. I might have to run some system updates first, I think it's still on High Sierra.

If you'd like to, ask me sometime when I'm online, after about 4AM on the 18th (UTC).

Probably not suitable for testing multiplayer - I'm on a 4G internet connection with a slightly-unreliable signal, and real-time multiplayer is usually not reliable (often, not even possible) on it. So I probably can only assist with testing singleplayer. Happy to try anyway, but if it doesn't work, it should not be taken as indicative of "multiplayer doesn't work properly on Mac". If LAN multiplayer is fairly easy to set up, I could try running a LAN multiplayer game between it and my Windows PC; that should be reliable.
My projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)
Non-Lemmings: Commander Keen: Galaxy Reimagined (a Commander Keen fangame)

Simon

Hmm, I won't be available for live chat the entire weekend. >_>;;

But I'll be super happy to read about your progress here, and reply/troubleshoot as soon as I get the chance. Looking forward to it!

-- Simon

namida

Let's assume I don't remember anything from previous attempts to build Lix (I'm not sure if I even ever tried on Mac - I recall for sure trying on an ARM-Linux device, not sure if we ever tried Mac).

What are the critical things I should know?
My projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)
Non-Lemmings: Commander Keen: Galaxy Reimagined (a Commander Keen fangame)

Simon

To get all build tools and libraries:
Install Homebrew. Then run:
$ brew install ldc dub allegro enet

To build Lix:
$ git clone https://github.com/SimonN/LixD
$ cd LixD
$ dub build -b release

To run Lix:
$ bin/lix

You should now be able to mouse around the main menu and click some buttons.

This post has already most of the info from the full build instructions.

-- Simon

namida

Wow, between system updates and "meta-dependencies" that was a LOT of downloads and installs...

This bug prevented building: https://issues.dlang.org/show_bug.cgi?id=20019

I tried with both LDC and DMD; same results either way. I then tried removing BOTH compilers just in case - and sure enough, I still get the error, so it appears to be with Dub, not with the compilers. Quick Googling suggests this is a general issue with D compilers on Mac OS X Catalina, and not specific to Lix in any way. We'll need to try this again when a update exists (or when the update is integrated into Brew, or when I can be bothered doing this outside of Brew, etc).
My projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)
Non-Lemmings: Commander Keen: Galaxy Reimagined (a Commander Keen fangame)

Simon

#12
Thanks for the exhaustive testing!

Interesting that the bugfix merge in July 2019 hasn't made it into Brew yet. Let's see what happens.

I'll post the results to #381. It's perfectly fine to wait now, you can try again in a couple months. The 3 most common D compilers (dmd, ldc, gdc) all have the same frontend for parsing D, and then different backends for code generation. DMD gets updates the quickest.

At least Brew is cutting edge. Brew's dub 1.17.0 has completely different version numbering than upstream dub at 1.11.0. seems current, github dub is 1.17.0. Dub homepage is 1.11.0, outdated :-P Brew's DMD at 2.088.1 is also cutting edge, very nice.

-- Simon

Simon

Thread this week on the D forums -- we'll see how soon Homebrew's DMD is up to speed.

-- Simon

Simon

I haven't heard about this in half a year now. I assume that Mac binaries run fine.

Should Lix on Mac still give only a black screen or a crash, I'll be glad to continue the troubleshooting.

-- Simon