a-b-street / abstreet

Transportation planning and traffic simulation software for creating cities friendlier to walking, biking, and public transit
https://a-b-street.github.io/docs/
Apache License 2.0
7.7k stars 342 forks source link

Mac builds broken #1122

Open GreenMatthew2019 opened 12 months ago

GreenMatthew2019 commented 12 months ago

I have down loaded the software (for Mac) and run the ltn.exe I now have a terminal window open. what do I do next to get started?

dabreegster commented 12 months ago

I don't have a Windows or Mac machine myself to test on, so starting the software there is unfortunately broken. Try opening the ltn executable inside the binaries folder -- does that do anything?

GreenMatthew2019 commented 12 months ago

Hi, Thanks for the quick reply. That’s what I did. Opened binaries folder, Ran ltn.exe

Terminal opened window as below

Last login: Mon Oct 9 12:32:41 on ttys000 /Users/matthewsnedker/Downloads/abstreet_mac_v0_3_48/binaries/ltn ; exit; @.*** ~ % /Users/matthewsnedker/Downloads/abstreet_mac_v0_3_48/binaries/ltn ; exit; thread 'main' panicked at 'Can't find the data/ directory', abstio/src/abst_paths.rs:54:13 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

Saving session... ...copying shared history... ...saving history...truncating history files... ...completed.

[Process completed]

Note: the data folder is in my downloads folder.

On 9 Oct 2023, at 12:45, Dustin Carlino @.***> wrote:

I don't have a Windows or Mac machine myself to test on, so starting the software there is unfortunately broken. Try opening the ltn executable inside the binaries folder -- does that do anything?

— Reply to this email directly, view it on GitHub https://github.com/a-b-street/abstreet/issues/1122#issuecomment-1752854092, or unsubscribe https://github.com/notifications/unsubscribe-auth/BDESGNDJZXBZL2RX2DT5EMDX6PPUBAVCNFSM6AAAAAA5YVGWN2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONJSHA2TIMBZGI. You are receiving this because you authored the thread.

dabreegster commented 12 months ago

Sorry, I'm not sure how to fix this without access to a Mac to try things out. This is an open source project; if anyone's reading this and can help get the Windows and Mac builds working better, help much appreciated.

In the meantime, stick with the web version: https://play.abstreet.org/0.3.48/ltn.html and let me know if you need a new area imported (not possible on the web version, unfortunately)

GreenMatthew2019 commented 12 months ago

OK, I’ll wait to see if the Mac download can be developed.

I am an elected borough councillor in Darlington and am working on filtering an area of Darlington called College.

I have attached a shot of the area hope that helps.

Matthew

On 9 Oct 2023, at 12:51, Dustin Carlino @.***> wrote:

Sorry, I'm not sure how to fix this without access to a Mac to try things out. This is an open source project; if anyone's reading this and can help get the Windows and Mac builds working better, help much appreciated.

In the meantime, stick with the web version: https://play.abstreet.org/0.3.48/ltn.html and let me know if you need a new area imported (not possible on the web version, unfortunately)

— Reply to this email directly, view it on GitHub https://github.com/a-b-street/abstreet/issues/1122#issuecomment-1752863605, or unsubscribe https://github.com/notifications/unsubscribe-auth/BDESGNAACIK3AVPWURAVZALX6PQN5AVCNFSM6AAAAAA5YVGWN2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONJSHA3DGNRQGU. You are receiving this because you authored the thread.

dabreegster commented 12 months ago

I can at least get that area added to the web version today. The image in your email didn't come through to Github; does this cover it? Screenshot from 2023-10-09 13-00-44

GreenMatthew2019 commented 12 months ago

Definitely covers the area I’m looking to improve. Thank you. Matthew Sent from my iPhoneOn 9 Oct 2023, at 13:01, Dustin Carlino @.***> wrote: I can at least get that area added to the web version today. The image in your email didn't come through to Github; does this cover it?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

dabreegster commented 12 months ago

Try this out and let me know if you hit problems: https://play.abstreet.org/0.3.48/ltn.html?system/gb/darlington/maps/center.bin

andrewphilipsmith commented 11 months ago

I think I can reproduce this. The behaviour I find is:

How to reproduce

  1. Download https://github.com/a-b-street/abstreet/releases/download/v0.3.48/abstreet_mac_v0_3_48.zip and save in to the default Downloads directory.
  2. Unzip by double clicking. This will expand the zipfile into a Downloads/abstreet_mac_v0_3_48 directory.
  3. Open a terminal. The default cwd is the user's home directory
  4. Attempt to launch one of the applications, either directly from the binary, or via the wrapper shell scripts
user@host ~$ Downloads/abstreet_mac_v0_3_48/binaries/ltn                                                                                        127 
thread 'main' panicked at 'Can't find the data/ directory', abstio/src/abst_paths.rs:54:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
user@host ~$ Downloads/abstreet_mac_v0_3_48/ltn.sh                                                                                              101 ↵  
See logs in output.txt

(Untested, but I suspect that the same baviour would occur on Windows and Linux)

Workaround

  1. Change directory in the terminal to the expanded zip directory:
user@host ~$ cd Downloads/abstreet_mac_v0_3_48

(Note that your prompt might look different to the above - ie everything before and including the $ sign)

  1. Launch the app:
user@host ~/Downloads/abstreet_mac_v0_3_48$ binaries/ltn      

@GreenMatthew2019 Please could you let us know if this workaround helps you? Feel free to ask if you've any other questions.

Possible fixes

@dabreegster Some ideas for longer-term fixes:

dabreegster commented 11 months ago

Fantastic debugging + write-up, thank you!

We could improve the search for the data directory

https://github.com/a-b-street/abstreet/blob/f8e5d5f0a5f087f5038c309319ce9a50ac895a26/abstio/src/abst_paths.rs#L22 Rather than use the current directory as the base, we could try https://doc.rust-lang.org/std/env/fn.current_exe.html after stripping off the executable?

The variations of ../, ../../, etc in there are so that you can launch tools from different cases in the release binaries, from git, etc. For example cd abstreet/apps/ltn/src; cargo run would require us to find ../../data. Maybe there's a much saner way to do this though?

We could make the wrapper scripts more robust, by detecting their own location

This sounds useful. If somebody directly opens the exe, it'd still break, but be an improvement.