gecko0307/dagon

Program exited with code -11 when using dagon:nuklear

KrsKonst opened this issue · 3 comments

Hello, I'm trying to run a tutorial project from here. And I'm keep getting the "Program exited with code -11" error.
What I have for now:

project structure

<project root>
  assets
    fonts
      DroidSans.ttf
  source
    scenes
      MainMenu
        MainMenu.d
    app.d
//app.d

module main;

import dagon;
import scene;
import scenes.MainMenu;

class MyGame: Game
{
    this(uint windowWidth, uint windowHeight, bool fullscreen, string title, string[] args)
    {
        super(windowWidth, windowHeight, fullscreen, title, args);
        currentScene = New!MainMenu(this);
    }
}

void main(string[] args)
{
    MyGame game = New!MyGame(1280, 720, false, "Dagon test", args);
    game.run();
    Delete(game);
}
//scenes/MainMenu/MainMenu.d

module scenes.MainMenu;

import dagon;
import dagon.ext.nuklear;
import dagon.ext.ftfont;

class MainMenu: Scene {
    Game game;
    FontAsset font;
    NuklearGUI ui;
    Entity uiEntity;

    this(Game game){
        super(game);
        this.game = game;
    }

    override void beforeLoad(){
        font = this.addFontAsset("assets/fonts/DroidSans.ttf", 18);
    }

    override void afterLoad(){
        ui = New!NuklearGUI(eventManager, assetManager);
        ui.addFont(font, 18, ui.localeGlyphRanges);

        uiEntity = addEntityHUD();
        uiEntity.drawable = ui;
        uiEntity.visible = true;

        eventManager.showCursor(true);
    }

    override void onUpdate(Time time){
        if(uiEntity.visible){
            ui.update(time);
            layout();
        }
    }

    void layout(){
        /** TODO: ui elements **/
    }
}

dub.json

{
	"authors": [
		""
	],
	"dependencies": {
		"dagon": "~>0.14.1",
		"dagon:ftfont": "~>0.14.1",
		"dagon:nuklear": "~>0.14.1"
	},
	"license": "proprietary",
	"name": "untitledspacegame",
	"targetName": "Untitled_space_game"
}

/usr/local/lib
(Nuklear libraries are installed as mentioned in readme)

libnuklear.so        libpng12.a   libpng12.so.0       libpng.la    libpng.so.3.54.0  python2.7
libnuklear.so.4.2.5  libpng12.la  libpng12.so.0.54.0  libpng.so    node_modules      python3.10
libnuklear_static.a  libpng12.so  libpng.a            libpng.so.3  pkgconfig         python3.8

unit tests for dagon:nuklear are fine

Building package dagon:nuklear in /home/sinister/.dub/packages/dagon-0.14.1/dagon/extensions/nuklear/
             Generating test runner configuration 'dagon-nuklear-test-library' for 'library' (library).
    Starting Performing "unittest" build using /usr/bin/dmd for x86_64.
    Building dlib 1.0.0: building configuration [library]
    Building dagon 0.14.1: building configuration [library]
    Building dagon:ftfont 0.14.1: building configuration [library]
    Building dagon:nuklear 0.14.1: building configuration [dagon-nuklear-test-library]
     Linking dagon-nuklear-test-library
             Copying files for dagon...
     Running ../../../../../.dub/packages/dagon-0.14.1/dagon/extensions/nuklear/dagon-nuklear-test-library 
All unit tests have been run successfully.

dub run --build-mode separate --force

Starting Performing "debug" build using /usr/bin/dmd for x86_64.
    Building dlib 1.0.0: building configuration [library]
    Building dagon 0.14.1: building configuration [library]
    Building dagon:ftfont 0.14.1: building configuration [library]
    Building dagon:nuklear 0.14.1: building configuration [library]
    Building untitledspacegame ~master: building configuration [application]
     Linking Untitled_space_game
             Copying files for dagon...
     Running Untitled_space_game 
Warning: no "settings.conf" found
Warning: no "input.conf" found
Error Program exited with code -11

I've also tried to change dub.json that way, so it would be more like that

{
	"authors": [
		""
	],
	"dependencies": {
		"dagon": "~master",
		"dagon:ftfont": "~master",
		"dagon:nuklear": "~master"
	},
	"license": "proprietary",
	"name": "untitledspacegame",
	"targetName": "Untitled_space_game"
}

but I'm getting the same error

Warning WARNING: A deprecated branch based version specification is used for the dependency dagon:nuklear. Please use numbered versions instead. Also note that you can still use the dub.selections.json file to override a certain dependency to use a branch instead.
     Warning WARNING: A deprecated branch based version specification is used for the dependency dagon. Please use numbered versions instead. Also note that you can still use the dub.selections.json file to override a certain dependency to use a branch instead.
     Warning WARNING: A deprecated branch based version specification is used for the dependency dagon:ftfont. Please use numbered versions instead. Also note that you can still use the dub.selections.json file to override a certain dependency to use a branch instead.
    Starting Performing "debug" build using /usr/bin/dmd for x86_64.
    Building dlib 1.1.0: building configuration [library]
    Building dagon ~master: building configuration [library]
    Building dagon:ftfont ~master: building configuration [library]
    Building dagon:nuklear ~master: building configuration [library]
    Building untitledspacegame ~master: building configuration [application]
     Linking Untitled_space_game
             Copying files for dagon...
     Running Untitled_space_game 
Warning: no "settings.conf" found
Warning: no "input.conf" found
Error Program exited with code -11

System: 5.15.0-56-generic #62-Ubuntu SMP Tue Nov 22 19:54:14 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
dmd --version: DMD64 D Compiler v2.101.1

Thanks in advance for reply.

Also both dub run --build-mode separate and dub run are creating Untitled_space_game file in project root. And when I'm trying to run it, I'm getting

Warning: no "settings.conf" found
Warning: no "input.conf" found
Segmentation fault (core dumped)

And running project binary with gdb tells that the problem is in nk_init for some reason

$ gdb ./Untitled_space_game

Reading symbols from ./Untitled_space_game...

(gdb) run ./Untitled_space_game

Starting program: /path/to/game/project/Untitled_space_game ./Untitled_space_game
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Warning: no "settings.conf" found
[New Thread 0x7ffff6b46640 (LWP 1620906)]
[New Thread 0x7fffec08a640 (LWP 1620908)]
[New Thread 0x7fffeb748640 (LWP 1620909)]
[New Thread 0x7fffeaf47640 (LWP 1620910)]
[New Thread 0x7fffea746640 (LWP 1620911)]
[New Thread 0x7fffe9f45640 (LWP 1620912)]
[New Thread 0x7fffe9744640 (LWP 1620913)]
[New Thread 0x7fffe8f43640 (LWP 1620914)]
[New Thread 0x7fffcbfff640 (LWP 1620915)]
[New Thread 0x7fffcb7fe640 (LWP 1620916)]
[New Thread 0x7fffcaffd640 (LWP 1620917)]
[New Thread 0x7fffca7fc640 (LWP 1620918)]
[New Thread 0x7fffc9ffb640 (LWP 1620919)]
[New Thread 0x7fffc97fa640 (LWP 1620920)]
[Thread 0x7fffc97fa640 (LWP 1620920) exited]
[New Thread 0x7fffc97fa640 (LWP 1620921)]
[Thread 0x7fffc97fa640 (LWP 1620921) exited]
[New Thread 0x7fffe8142640 (LWP 1620922)]
[New Thread 0x7fffc97fa640 (LWP 1620923)]
[Thread 0x7fffc97fa640 (LWP 1620923) exited]
[New Thread 0x7fffc97fa640 (LWP 1620924)]
Warning: no "input.conf" found
[New Thread 0x7fffc8ff9640 (LWP 1620925)]
[Thread 0x7fffc8ff9640 (LWP 1620925) exited]

Thread 1 "Untitled_space_" received signal SIGSEGV, Segmentation fault.
0x0000555555a9aa70 in nk_init ()

I've replicated this on Mint 21.2 (Ubuntu 22.04 LTS). Must be something broken in libnuklear