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
];
}
@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