SimonN / LixD

Lix: Lemmings-like game with puzzles, editor, multiplayer
https://www.lixgame.com
132 stars 16 forks source link

Compile error (Ubuntu 18.04, version 0.9.33) #403

Closed Rmano closed 4 years ago

Rmano commented 4 years ago

Hi, sorry if this is a duplicate (can't find it). I am trying to compile on my Ubuntu 18.04 (i know, I should upgrade)... I have the following error:

[romano:~/software/games/LixD] master ± dub build        
Package taggedalgebraic can be upgraded from 0.11.12 to 0.11.17.
Use "dub upgrade" to perform those changes.
Performing "debug" build using /usr/bin/ldc2 for x86_64.
allegro 4.0.4+5.2.0: target for configuration "no-libs" is up to date.
derelict-util 3.0.0-beta.2: target for configuration "library" is up to date.
derelict-enet 4.1.0: target for configuration "library" is up to date.
enumap 0.4.2: target for configuration "library" is up to date.
bolts 0.7.1: target for configuration "library" is up to date.
optional 0.6.3: target for configuration "unittest" is up to date.
taggedalgebraic 0.11.12: target for configuration "library" is up to date.
sdlang-d 0.10.6: target for configuration "library" is up to date.
lix 0.9.33: building configuration "application"...
Compiling Lix 0.9.33...
../../../.dub/packages/optional-0.6.3/optional/source/optional/optional.d(340,12): Error: parameter opt is 'return' but function does not return any indirections
src/file/replay/io.d(186,53): Error: template instance optional.optional.orElse!(bool, bool) error instantiating
../../../.dub/packages/optional-0.6.3/optional/source/optional/optional.d(378,11): Error: parameter opt is 'return' but function does not return any indirections
src/file/replay/replay.d(83,26): Error: template instance file.replay.replay.Replay.this.match!((fn)
{
levelFilename = fn;
}
, delegate ()
{
this._levelFnCanBeNullInNetgames.opAssign(Rebindable(null, ).this(null));
}
).match!(immutable(IFilename)) error instantiating
../../../.dub/packages/optional-0.6.3/optional/source/optional/optional.d(378,11): Error: parameter opt is 'return' but function does not return any indirections
src/menu/browser/single.d(107,23): Error: template instance menu.browser.single.BrowserSingle.onHighlightWithoutLastGame.match!(delegate (Trophy tro)
{
this._trophySaved.shown(true);
this._trophySkills.shown(true);
this._trophySaved.value(tro.lixSaved);
this._trophySkills.value(tro.skillsUsed);
}
, delegate ()
{
this._trophySaved.shown(false);
this._trophySkills.shown(false);
}
).match!(Trophy) error instantiating
/usr/bin/ldc2 failed with exit code 1.

Any hints on what I am doing wrong?

Thanks!

(BTW, I used dub upgrade, but didn't solve the problem...)

SimonN commented 4 years ago

Hi,

thanks for giving Lix a shot! Ideas first, reasoning only below, because the reasoning got too convoluted.

Idea 1. Install cutting edge DMD, you can do this even without updating your system. The DMD download page has the Ubuntu/Debian package for download, you then can install it with dpkg -i. To build Lix: when you call dub, replace --compiler=ldc2 with --compiler=dmd.

DMD produces slower-running binaries than LDC, that's why I suggest LDC in the instructions. Other than that, it's fine; it's even faster during compilation.

Instead of downloading the DMD package directly, you could also follow these instructions to add a repository with cutting-edge DMD to your package manager.

Idea 2. Try to find an up-to-date LDC from more modern Ubuntu repositories and install that. Or update the entire distribution, then you should get a reasonably new LDC.

Idea 3. I'll rewrite those failing sections so they don't use the match template of library optional. But since your compiler is old, you might eventually run into more problems that we don't see yet.

Reasoning. In the past year, the D compiler has worked a lot on return function annotations, and I've tried to keep Lix compiling on cutting-edge D compilers. It's likely that correct code fails on older D compilers. On my Arch machine, Lix builds well with LDC 1.22.0 (based on DMD 2.092.1) and DMD 2.093.0.

Nonetheless, I'm confused by the errors. Version 0.6.3 of library optional came out in 2018, and your system is from around that age, whereas the modern work on return-annotated functions is newer. Also, the template match in optional isn't even annotated with return. Neither is my code in replay/replay.d that uses match annotated with return anywhere. So I don't see how that error can even arise here...

My best guess is that a compiler upgrade will fix it.

Rmano commented 4 years ago

I followed the instruction on https://d-apt.sourceforge.io/ and everything seems to work. Thanks; I think this issue can be closed now unless you want to go on checking your Idea3 (tell me and I'll test it).

BTW, I found the option "fast mouse movement to untrap" and it's ok --- but is there a key to untrap the mouse?

SimonN commented 4 years ago

Great to hear that Lix builds for you now! I should write this fallback DMD installation method into the build notes.

I won't start with idea 3 then, the match template is already the idiomatic implementation here.

There is no Lix-specific hotkey yet that untraps the mouse. Does Alt+Tab work to switch windows and thereby untrap the mouse? Or do you need a separate hotkey?

Rmano commented 4 years ago

There is no Lix-specific hotkey yet that untraps the mouse. Does Alt+Tab work to switch windows and thereby untrap the mouse? Or do you need a separate hotkey?

Ah, yes, that works. I was fooled by the fact that given that I have focus-follow-mouse and it captured again.

SimonN commented 4 years ago

All right, great! Enjoy Lix.

I haven't used focus-follows-mouse. If you run into problems with it in combination with Lix's mouse capturing, feel free to file a new issue against Lix.