Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

On Apple silicon machines, the brew installed llvm's wasm-ld linker does not seem to be detected by juvix doctor command. #3082

Open
denniswon opened this issue Oct 1, 2024 · 1 comment
Labels
Milestone

Comments

@denniswon
Copy link

Describe the bug

I am Apple M1 Pro (OS: macos sonoma) and I installed juvix. juvix itself installs fine but juvix doctor command is not being able to detect my wasm-ld installed locally. (I do want to compile to WebAssembly)

On Apple silicon macos machines, the brew installed llvm's wasm-ld linker does not seem to be detected by juvix doctor command. I also tried installing and building wasm-ld directly (https://lld.llvm.org/). But either way, wasm-ld is not detected by juvix doctor.

> juvix --version
Juvix version 0.6.6-e4559bb
Branch: HEAD
Commit: e4559bbc87eb946c1b5c4db76ec8983a94201418
Date: Tue Sep 3 18:10:01 2024 +0100
> juvix doctor
> Checking for clang...
> Checking clang version...
> Checking for wasm-ld...
  ! Could not find the wasm-ld command
  ! https://docs.juvix.org/0.6.6/reference/tooling/doctor/#could-not-find-the-wasm-ld-command
> Checking that clang supports wasm32...
> Checking that clang supports wasm32-wasi...
> Checking that WASI_SYSROOT_PATH is set...
> Checking for wasmer...
> Checking latest Juvix release on Github...
> which wasm-ld
/usr/local/bin/wasm-ld
> brew --prefix llvm
/opt/homebrew/opt/llvm

Can anyone help me here? Not sure if this is the issue with the llvm setup on my local mac or the juvix doctor.

Desktop (please complete the following information):

  • Machine: Apple M1 Pro
  • OS: MacOS 14.6.1 Sonoma
  • Juvix Version: 0.6.6-e4559bb

To Reproduce
Steps to reproduce the behavior: https://docs.juvix.org/0.6.3/howto/installing.html

Expected behavior

juvix doctor to detect locally installed wasm-ld

@paulcadman
Copy link
Collaborator

paulcadman commented Oct 3, 2024

Hi 👋 - thanks for the report.

To summarise:

  • wasm-ld and a WASM compatible clang are only required if you want to use Juvix's WASM target. This is not necessary if you want to compile Anoma applications.
  • You can ignore the juvix doctor warning if you have installed wasm-ld yourself. But note that the active version of clang should match the active version of wasm-ld.
  • You can install wasm-ld using brew by installing the lld package: brew install lld.

What follows is a more detailed description of what we need to fix.

1. wasm-ld is no longer present in the homebrew llvm package

wasm-ld was removed from the llvm package in the latest version (version 19).

$ brew ls -v llvm@18 | grep wasm-ld
/opt/homebrew/Cellar/llvm@18/18.1.8/bin/wasm-ld
$ brew ls -v llvm | grep wasm-ld

wasm-ld is installed by the lld homebrew package.

$ brew ls -v lld | grep wasm-ld
/opt/homebrew/Cellar/lld/19.1.0/bin/wasm-ld

Actions

  1. Update the install documentation for macOS with instructions for installing wasm-ld using the lld homebrew package.

2. The juvix doctor diagnosis is misleading

We require that the doctor checks that:

  1. wasm-ld is available on the user's PATH
  2. wasm-ld is compatible with the version of clang on the user's PATH

We currently do this by checking that wasm-ld exists in the llvm distribution.

-- | Check that wasm-ld exists in the same LLVM distribution as the clang command
checkWasmLd :: (Members DoctorEff r) => Path Abs File -> [Text] -> Sem r ()
checkWasmLd clangPath errMsg =
unlessM (isExecutable (parent clangPath <//> $(mkRelFile "wasm-ld"))) (mapM_ warning errMsg)

For macOS the implemented check does not cover the two requirements.

Actions

  1. Update the implemented check to meet the requirements.
  2. Update the warning message and documentation to more accurately describe what's being checked.

3. The juvix doctor links are broken

For example:

$ curl -s -o /dev/null -w "%{http_code}\n" https://docs.juvix.org/0.6.6/reference/tooling/doctor/#could-not-find-the-wasm-ld-command
404

Actions

Fix this as part of

4. The WASM dependencies are highlighted in the install docs but are not required for Anoma.

The Juvix WASM backend was developed at a time when Anoma applications were represented as WASM code. This is no longer the case and so it's not important for Juvix users of Anoma to setup WASM tooling. The Juvix documentation and doctor make it seem like WASM setup is important.

Actions

  1. Deemphasise WASM tooling in docs Update documentation #3078
  2. Make WASM support optional: Make WASM support optional #3077

paulcadman added a commit to anoma/homebrew-juvix that referenced this issue Nov 7, 2024
wasm-ld is not installed as part of the llvm package since version 19.

see: anoma/juvix#3082
@lukaszcz lukaszcz added this to the 0.6.9 milestone Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants