nesbox / TIC-80

TIC-80 is a fantasy computer for making, playing and sharing tiny games.
https://tic80.com
MIT License
5.06k stars 491 forks source link

Trouble compiling on NixOS #2445

Open Serif-7 opened 10 months ago

Serif-7 commented 10 months ago

Here's the shell.nix I'm working with:

{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
    # inputsFrom = with pkgs; [ pkgconfig autoconf automake gnumake ];
    buildInputs = with pkgs; [
        gcc
        pkg-config
        autoconf
        automake
        libtool
        pcre
        gnumake
        SDL2
        SDL2_gfx
        SDL_image
        SDL2_ttf
        SDL2_mixer
        harfbuzz
        curl
        gtk3
        gtk3-x11
        cmake
        cmakeCurses
        extra-cmake-modules
        libglvnd
        mesa_glu
        mesa_glu
        freeglut
        alsaLib
    ];
}

and here's the error I get during compilation:

AR    build/host/lib/libmruby_core.a
ar: creating /home/daniel/src/misc/TIC-80/vendor/mruby/build/host/lib/libmruby_core.a
LD    build/host/bin/mrbc
/nix/store/1fn92b0783crypjcxvdv6ycmvi27by0j-binutils-2.40/bin/ld: /home/daniel/src/misc/TIC-80/vendor/mruby/build/host/lib/libmruby_core.a(codegen.o): undefined reference to symbol '__ctype_tolower_loc@@GLIBC_2.3'
/nix/store/1fn92b0783crypjcxvdv6ycmvi27by0j-binutils-2.40/bin/ld: /nix/store/qn3ggz5sf3hkjs2c797xf7nan3amdxmp-glibc-2.38-27/lib/libc.so.6: error adding symbols: DSO missing from command line
rake aborted!
Command failed with status (1): [ld  -o "/home/daniel/src/misc/TIC-80/vendo...]
/home/daniel/src/misc/TIC-80/vendor/mruby/lib/mruby/build/command.rb:37:in `_run'
/home/daniel/src/misc/TIC-80/vendor/mruby/lib/mruby/build/command.rb:217:in `run'
/home/daniel/src/misc/TIC-80/vendor/mruby/mrbgems/mruby-bin-mrbc/mrbgem.rake:11:in `block (2 levels) in <top (required)>'
Tasks: TOP => all => gensym => /home/daniel/src/misc/TIC-80/vendor/mruby/build/target/presym => /home/daniel/src/misc/TIC-80/vendor/mruby/build/target/mrblib/mrblib.pi => /home/daniel/src/misc/TIC-80/vendor/mruby/build/target/mrblib/mrblib.c => /home/daniel/src/misc/TIC-80/vendor/mruby/build/host/bin/mrbc
(See full trace by running task with --trace)
make[2]: *** [CMakeFiles/mruby_vendor.dir/build.make:86: mruby_vendor-prefix/src/mruby_vendor-stamp/mruby_vendor-build] Error 1
make[1]: *** [CMakeFiles/Makefile2:324: CMakeFiles/mruby_vendor.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

I don't have much experience with make or cmake, so I'm unsure if the problem is mruby or libc somehow, or what to do. Any advice would be appreciated.

nesbox commented 10 months ago

Try to disable all the other scripts except Lua by calling the command

cmake -DBUILD_WITH_LUA=ON -DBUILD_WITH_FENNEL=OFF -DBUILD_WITH_JANET=OFF -DBUILD_WITH_JS=OFF -DBUILD_WITH_MOON=OFF -DBUILD_WITH_MRUBY=OFF -DBUILD_WITH_PYTHON=OFF -DBUILD_WITH_SCHEME=OFF -DBUILD_WITH_SQUIRREL=OFF -DBUILD_WITH_WASM=OFF -DBUILD_WITH_WREN=OFF .. --fresh

and build again

Serif-7 commented 10 months ago

That worked and produced a binary:

image

But as you can see, running it doesn't open up a window with the normal UI. Just a console, that, as far as I can tell, is nonfunctional.

joshgoebel commented 10 months ago

Looks like a missing audio device? Maybe permissions to the audio device? Just guessing.