laamaa / m8c

Cross-platform M8 tracker headless client
Other
419 stars 87 forks source link

Weird 0s #124

Closed Lownin closed 1 year ago

Lownin commented 1 year ago

I installed m8c on nixOS with nix-env -iA m8c-stable -f https://github.com/laamaa/m8c/archive/refs/heads/main.tar.gz

It works okay, except for some reason, the character "0" shows up weirdly.

m8-weird-0s

laamaa commented 1 year ago

Looks like you have the "alt zero" font selected and an old version of the software that does not include that support yet. The nix thing (https://github.com/laamaa/m8c/blob/main/default.nix) seems to refer to a really old version, if you know how to update it and can test it I'll gladly accept a PR! :)

Lownin commented 1 year ago

I think I can take that on. Will submit a PR when I can.

Lownin commented 1 year ago

@laamaa I've been doing some work to update the default.nix, however I have encountered a problem. I'm not much of a programmer, so sorry if this is obvious.

For troubleshooting, I've tried pulling down both the 1.0.3 version and the 1.5.2 version of the source archive.

For the 1.0.3 version, I downloaded and extracted https://github.com/laamaa/m8c/archive/v1.0.3.tar.gz

For the 1.5.2 version, I downloaded and extracted https://github.com/laamaa/m8c/archive/v1.5.2.tar.gz and I modified default.nix to contain version = "1.5.2" and a hash of sha256:0qrwgqfk38imq99w3hwrikfp5sirj2iiffjp3yc3dc40mnhjibxz calculated by running nix-prefetch-url --unpack https://github.com/laamaa/m8c/archive/v1.5.2.tar.gz

I then tried installing from the local paths. nix-env -iA m8c-stable -f 1.0.3/m8c-main works as expected:

❯ nix-env -iA m8c-stable -f 1.0.3/m8c-main
installing 'm8c-1.0.3'

nix-env -iA m8c-stable -f 1.5.2/m8c-main fails, unable to find SDL.h

❯ nix-env -iA m8c-stable -f 1.5.2/m8c-main
installing 'm8c-1.5.2'
this derivation will be built:
  /nix/store/4cmwkklpy5pljcy45x3a4inkvy55mgbz-m8c-1.5.2.drv
building '/nix/store/4cmwkklpy5pljcy45x3a4inkvy55mgbz-m8c-1.5.2.drv'...
unpacking sources
unpacking source archive /nix/store/zi6n024avcsvlh77rhd2pmhhdw36icc2-source
source root is source
patching sources
configuring
no configure script, doing nothing
building
build flags: SHELL=/nix/store/8fv91097mbh5049i9rglc73dx6kjg3qk-bash-5.2-p15/bin/bash
/nix/store/8fv91097mbh5049i9rglc73dx6kjg3qk-bash-5.2-p15/bin/bash: line 1: pkg-config: command not found
gcc -c -o main.o main.c   -Wall -O2 -pipe -I.
main.c:8:10: fatal error: SDL.h: No such file or directory
    8 | #include <SDL.h>
      |          ^~~~~~~
compilation terminated.
make: *** [Makefile:21: main.o] Error 1
error: builder for '/nix/store/4cmwkklpy5pljcy45x3a4inkvy55mgbz-m8c-1.5.2.drv' failed with exit code 2;
       last 10 log lines:
       > no configure script, doing nothing
       > building
       > build flags: SHELL=/nix/store/8fv91097mbh5049i9rglc73dx6kjg3qk-bash-5.2-p15/bin/bash
       > /nix/store/8fv91097mbh5049i9rglc73dx6kjg3qk-bash-5.2-p15/bin/bash: line 1: pkg-config: command not found
       > gcc -c -o main.o main.c   -Wall -O2 -pipe -I.
       > main.c:8:10: fatal error: SDL.h: No such file or directory
       >     8 | #include <SDL.h>
       >       |          ^~~~~~~
       > compilation terminated.
       > make: *** [Makefile:21: main.o] Error 1
       For full logs, run 'nix log /nix/store/4cmwkklpy5pljcy45x3a4inkvy55mgbz-m8c-1.5.2.drv'.

~Both version of the project seem to have #include <SDL.h> but only the newer one fails.~ The old version's #include <SDL2/SDL.h> succeeds but the newer one's #include <SDL.h> seems to be failing for me.

Any insights on this I can follow to try and fix? Thanks!

Lownin commented 1 year ago

I found I was mistaken about the includes in 1.0.3 The SDL include for 1.0.3 reads as:

#include <SDL2/SDL.h>

... so they are different but I'm still just as stuck.

laamaa commented 1 year ago

Looks like there is no "pkg-config" command available for some reason and the libraries fail to get included because of that... I could try installing NixOS in a VM and taking a look at it, I've been meaning to try it out anyway :)

laamaa commented 1 year ago

Ok, I think I fixed it... could you please try again now with nix-env -iA m8c-stable -f https://github.com/laamaa/m8c/archive/refs/heads/main.tar.gz ?

Lownin commented 1 year ago

@laamaa looks good. Thank you!

I wrote a GitHub Actions workflow that automatically updates the version and hash in default.nix in case you're interested. You can see it at https://github.com/Lownin/m8c/blob/main/.github/workflows/nix-package.yml

Want a pull request?

laamaa commented 1 year ago

Oh that looks useful, yes please :)

Lownin commented 1 year ago

PR sent. Thanks for the help!