odin-lang / Odin

Odin Programming Language
https://odin-lang.org
BSD 3-Clause "New" or "Revised" License
6.89k stars 606 forks source link

[docs] macOS build/install instructions should be updated #4006

Closed curldivergence closed 2 months ago

curldivergence commented 3 months ago

Hi, I've decided to try Odin on macOS (Sonoma 14.5, aarch64), and noticed several issues with the "Getting Started" section related to this platform:

  1. run echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> ~/.zshrc_profile works only for Intel-based Macs, on ARM-based ones Homebrew does not install packages into /usr/local but rather into /opt/homebrew/ (symlink to LLVM bin directory on my machine is located at /opt/homebrew/opt/llvm/bin/)
  2. I think there is an error in the name of the file to which the export command should be appended: I suppose that either ~/.zshrc or ~/.zsh_profile was meant (however even though I use zsh as my main interactive shell, the latter file is absent on my system)
  3. "Requirements" section tells to install LLVM 14, but since I already had LLVM 18 installed via brew, I decided to give it a shot and it seemingly worked (also, instruction for Linux mentions a range of versions from 11 to 18)
  4. The command mentioned in (1) assumes using zsh as a shell, but the very next instruction item also mentions bash, in which case (1) would not have effect
  5. The most important problem: the advice to permanently add the brew-installed LLVM's bin directory to $PATH can be dangerous (this is also mentioned in brew info llvm, btw), since
    • it contains binaries which already exist in user's $PATH, most importantly, clang
    • even if we assume no user actually needs Apple's clang in their $PATH and we can just tell them to overwrite it, this is not what actually happens since the build instructions tell to append LLVM's /bin/ to $PATH (i.e. not prepend), so after doing that which clang would still return /usr/bin/clang, resulting in a mixture of different toolchain versions on $PATH, which can lead to interesting problems :)
  6. I was building on the latest macOS version, but did not need to run this bit: On newer versions of macOS, some headers are not installed by default, so maybe it should be removed or the specific versions should be stated?

Please let me know if you need any more info from my system or if I can help in any way. Thanks!

gingerBill commented 2 months ago

Please make an issue here please: https://github.com/odin-lang/odin-lang.org

You can also make a PR if you want to improvement to the documentation directly.

laytan commented 2 months ago

We have rewritten the install documentation and I think all these points were addressed, thanks for bringing them up!