Skip to content

Instantly share code, notes, and snippets.

@jjwatt
Last active February 24, 2024 12:38
Show Gist options
  • Save jjwatt/c83c02e6903c8ffaf546fe5eb27e7d25 to your computer and use it in GitHub Desktop.
Save jjwatt/c83c02e6903c8ffaf546fe5eb27e7d25 to your computer and use it in GitHub Desktop.
tic-80 building on nix
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
# inputsFrom = with pkgs; [ pkgconfig autoconf automake gnumake ];
buildInputs = with pkgs; [
gcc
pkgconfig
autoconf
automake
libtool
pcre
gnumake
SDL2
SDL2_gfx
SDL_image
SDL2_ttf
SDL2_mixer
harfbuzz
curl
gtk3
gtk3-x11
cmake
cmakeCurses
elementary-cmake-modules
extra-cmake-modules
libglvnd
mesa_glu
mesa_glu
freeglut
alsaLib
];
}
@kirca
Copy link

kirca commented Feb 5, 2023

This doesn't seem to work for v1.0. While the build finishes when running it the UI window doesn't open and it instead shows up in the terminal but it is not responsive. Issue nesbox/TIC-80#1922

@Serif-7
Copy link

Serif-7 commented Jan 25, 2024

I'm trying to build a native TIC-80 package myself. @jjwatt I tried the original shell.nix and it failed for me during the make -j4 step. I'm getting an 'Error 2' which I'm still trying to diagnose, very cryptic. I also tried nix-build with @winny- 's default.nix but that errored out as well. I'm an extreme Nix noob so any help with this is appreciated. I'm on 23.11

@Serif-7
Copy link

Serif-7 commented Jan 25, 2024

The precise error I got was

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....

So I think it's linking to the wrong libc, going off the line /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'.

@winny-
Copy link

winny- commented Jan 26, 2024

Hi there, I just tested my linked TIC-80 derivation using nix-build -E 'with import <nixpkgs> {}; callPackage ./default.nix {}' and it completed successfully. Let's see if we can figure it out! I'm using 23.11 as well. Are you trying to build a local copy? Might be best to take one of the working derivations, then change the src to point to your path. This way it'll build the same way as if pulling from upstream.

@winny-
Copy link

winny- commented Jan 26, 2024

P.S. Feel free to take my work and contribute it to nixpkgs.

@blinry
Copy link

blinry commented Feb 24, 2024

Thanks for preparing the package, @winny-! I made a PR to nixpkgs here: NixOS/nixpkgs#291129

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment