Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Trouble running matchmaking #125

Open
toonn opened this issue Apr 16, 2023 · 12 comments
Open

Trouble running matchmaking #125

toonn opened this issue Apr 16, 2023 · 12 comments

Comments

@toonn
Copy link

toonn commented Apr 16, 2023

Hi, I'm having some trouble getting "matchmaking" to run.

$ ./play matchmaking

prelude/matchmaking/matchmaking.hs:1:2: error:
    parse error on input ‘#!/’
  |
1 | #!/usr/bin/env -S runghc -cpp -DD=a=replicate;b=putStrLn;c=length;p=map;u=max(2)
  |  ^^^

Same error if I run the file directly. (I thought maybe the shebang shenanigans were tripping up the play script.)

$ prelude/matchmaking/matchmaking.hs 

prelude/matchmaking/matchmaking.hs:1:2: error:
    parse error on input ‘#!/’
  |
1 | #!/usr/bin/env -S runghc -cpp -DD=a=replicate;b=putStrLn;c=length;p=map;u=max(2)
  |  ^^^

I'm running this in shell set up with the Nix flake.

@ulidtko
Copy link

ulidtko commented Apr 18, 2023

Works fine for me on Ubuntu...

~> chmod +x /tmp/matchmaking.hs 
~> /tmp/matchmaking.hs
      H K L M N P R S 
      a l u a o e o a 
      n a j j r t z r 
      n r z a a r a a 
      a a a     a     
Adam  . . . . . . O O   
Bela  O O O O . O O .   
Csaba . O . O . O O .   
David . . . . . O . O   
Erik  . O O O . . O .   
Feri  . . . . O O O .   
Geza  O . O . . O O .   
Imre  . . . O . . . .   
Jeno  O O . . . O . O   

As a workaround, you may succeed with invoking the shebang line directly, optionally bypassing the call to env:

runghc -cpp '-DD=a=replicate;b=putStrLn;c=length;p=map;u=max(2)' prelude/matchmaking/matchmaking.hs

@simonmichael
Copy link
Contributor

simonmichael commented Apr 18, 2023 via email

@toonn
Copy link
Author

toonn commented Apr 18, 2023

Still the same result when I run the shebang without env from the shell.

$ runghc -cpp '-DD=a=replicate;b=putStrLn;c=length;p=map;u=max(2)' prelude/matchmaking/matchmaking.hs

prelude/matchmaking/matchmaking.hs:1:2: error:
    parse error on input ‘#!/’
  |
1 | #!/usr/bin/env -S runghc -cpp -DD=a=replicate;b=putStrLn;c=length;p=map;u=max(2)
  |  ^^^

@migmit
Copy link
Contributor

migmit commented Apr 21, 2023

Hey, I don't really know what to say here, shebang combination '#!/...' is pretty normal and shouldn't cause errors. Do other entries run normally?

@toonn
Copy link
Author

toonn commented Apr 24, 2023

@migmit, yes, I've been able to successfully run all the other medalist entries.

@migmit
Copy link
Contributor

migmit commented Apr 25, 2023

What about brickbreaker?
The only thing I can think about is that your system doesn't like env -S, but brickbreaker also uses it.

@toonn
Copy link
Author

toonn commented Apr 26, 2023

I will try when I get access to the machine again but that will take a couple of weeks. I will get back to you : )

@noughtmare
Copy link

I will get back to you : )

Famous last words :)

@toonn
Copy link
Author

toonn commented Aug 30, 2023

Thanks for the ping. This fell off the radar.

I remember trying brickbreaker before. It works just fine. I get a white plane with a red circle and a breakout game inside of that. When I break all the bricks the circle turns green.

@ulidtko
Copy link

ulidtko commented Aug 30, 2023

@toonn the issue here is Nix-specific AFAICS.

Nix does a number of shebang shenanigans: https://nixos.wiki/wiki/Nix-shell_shebang

In particular, I think the Nix's requirement to use #!/usr/bin/env nix-shell simply conflicts with this specific matchmaking game which also uses shebang to pass CPP options.

I'm not a Nix user... but it seems that a sibling file shell.nix may help, via pkgs.mkShell doing the same customization runghc -cpp '-DD=a=replicate;b=putStrLn;c=length;p=map;u=max(2)'

@migmit
Copy link
Contributor

migmit commented Aug 30, 2023

Ahhh... If it's indeed Nix-specific, there is no wonder I couldn't replicate it.

@toonn
Copy link
Author

toonn commented Aug 31, 2023

matchmaking.hs doesn't have a nix-shell shebang so I don't see how that relates? I'm also not on NixOS but on macOS using Nix. Nix just provides GHC and cabal-install in this case, the environment is still fairly plain macOS.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants