gbdev / rgbds-live

A live Gameboy programming environment in the browser, allowing for realtime assembly programming for the gameboy.
https://gbdev.io/rgbds-live/
MIT License
36 stars 8 forks source link

Unsure how to run local build #20

Closed jamesellinger closed 11 months ago

jamesellinger commented 11 months ago

I really appreciate the work that has gone into helping create local builds. Sorry to be a bit of a noob, but I have followed the steps provided and after I type

npm run dev

I am not sure what to do. I have tried using a web browser to open index.html that is found in the rgbds-live folder. The editor and interface appears but I cannot create or import a project.

I am running on Mac OS Ventura and use Chrome/Safari. It if helps, I have attached files that show output from ./build.sh and 'npm run dev' build output.txt npm output.txt

surma commented 11 months ago

(Sorry, I just saw you attached logs. Thank you!)

Yeah, the build script is failing, which means that npm run dev won’t be working. It looks like you may have an outdated or incompatible version of bison installed. If you have homebrew installed, can you do brew install bison and try running ./build.sh again?

jamesellinger commented 11 months ago

Thank you for getting back. I installed bison via homebrew and it appears to be in the expected location (attached image).

I was unsure if the issue was related to using an M1 apple, but I hit the same problem on an Intel-based Mac.

If you have any other suggestions that I could follow to diagnose the problem, I will happily test them out.

Screen Shot 2023-09-25 at 7 25 21
jamesellinger commented 11 months ago

On closer inspection it looks maybe ./build.sh is trying to use an older version of bison that might come as part of Ventura or maybe my install of Xcode?

"bison --version" from a terminal shows version 2.3, but homebrew installed 3.8.

"which bison" returns "/usr/bin/bison", I guess I need to change a path variable? I always forget how to do that... but I will look it up and get back to this after work today.

surma commented 11 months ago

On closer inspection it looks maybe ./build.sh is trying to use an older version of bison that might come as part of Ventura or maybe my install of Xcode?

No, it’s the other way around. It expects a newer version, and MacOS comes with an old one by default.

So you do have the right version installed, but it’s not in your $PATH. While this is only a temporary fix (the right thing to do is to fix your .bashrc), if you paste the following command into your terminal before calling ./build.sh, it fix that part:

export PATH=$(brew --prefix)/bin:$PATH
jamesellinger commented 11 months ago

Thanks for the explanation, that makes more sense!

export PATH=$(brew --prefix)/bin:$PATH

Did not force homebrew's bison to be used. It seems to be a problem that goes back at least 10 years. Anyway, the following command fixed $PATH so that the proper version of bison is called:

On my Intel-based Mac

export PATH="/usr/local/opt/bison/bin:$PATH"

and on my M1 Mac

export PATH="/opt/homebrew/opt/bison/bin:$PATH