Homebrew-core: Emscripten needs Binaryen while compiling to wasm

Created on 14 Dec 2019  路  4Comments  路  Source: Homebrew/homebrew-core

  • [x] ran brew update and can still reproduce the problem?
  • [x] ran brew doctor, fixed all issues and can still reproduce the problem?
  • [x] ran brew gist-logs <formula> (where <formula> is the name of the formula that failed) and included the output link?
  • [x] if brew gist-logs didn't work: ran brew config and brew doctor and included their output with your issue?

    brew config, brew doctor output

    $ brew config
    HOMEBREW_VERSION: 2.2.1-21-gaeefacc
    ORIGIN: https://github.com/Homebrew/brew
    HEAD: aeefacc816a345bbf43259b6aff40c035868e8fd
    Last commit: 15 hours ago
    Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
    Core tap HEAD: 680e941d54f3212161e1d5544fb17938bce9690a
    Core tap last commit: 8 hours ago
    HOMEBREW_PREFIX: /usr/local
    HOMEBREW_CASK_OPTS: --appdir=/Applications --fontdir=/Library/Fonts
    HOMEBREW_DEV_CMD_RUN: 1
    HOMEBREW_GITHUB_API_TOKEN: set
    CPU: quad-core 64-bit haswell
    Homebrew Ruby: 2.6.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
    Clang: 11.0 build 1100
    Git: 2.24.1 => /usr/local/bin/git
    Curl: 7.64.1 => /usr/bin/curl
    macOS: 10.15.2-x86_64
    CLT: 11.0.33.8
    Xcode: N/A

$ brew doctor
Your system is ready to brew.


What you were trying to do (and why)

Compile simple Hello World program(C++)

#include <iostream>
int main()
{
    std::cout << "Hello Homebrew!\n";
}

What happened (include command output)

after tons of cache:INFO: generating system library: XXX.bc,

$ em++ src.cpp 
shared:ERROR: BINARYEN_ROOT must be set up in .emscripten

What you expected to happen

Compiles without Error

Step-by-step reproduction instructions (by running brew install commands)

After brew install emscripten, homebrew prompts

Manually set LLVM_ROOT to
  /usr/local/opt/emscripten/libexec/llvm/bin
and comment out BINARYEN_ROOT
in ~/.emscripten after running `emcc` for the first time.

which is written in emscripten.rb.

However, emscripten refuses compiling after following that.

I found:

v1.38.44: 09/11/2019
--------------------
- Remove Binaryen from the ports system. This means that emscripten will
   no longer automatically build Binaryen from source. Instead, either use
   the emsdk (binaries are provided automatically, just like for LLVM), or
   build it yourself and point `BINARYEN_ROOT` in .emscripten to it. See #9409

at Emscripten Release Notes

As https://github.com/emscripten-core/emscripten/issues/9409 saying we need BINARYEN_ROOT to be set in ~.emscripten.

My workaroud:

disable wasm output using em++ -s WASM=0 src.cpp

or install brew install binaryen then set BINARYEN_ROOT to /usr/local

Then, why didn't you make a PR?

I found another PR https://github.com/Homebrew/homebrew-core/pull/44846 dealing with all the llvm, binaryen stuff. I'm not sure if my PR conflicts.

Also I don't know what BINARYEN_ROOT should be.. /usr/local or /usr/local/opt/binaryen/?

outdated stale

Most helpful comment

I ran into this issue as well and used BINARYEN_ROOT = '/usr/local/opt/binaryen'

All 4 comments

I ran into this issue as well and used BINARYEN_ROOT = '/usr/local/opt/binaryen'

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

Stalebot is a bit over-keen here; this issue still exists.

The suggested workaround works perfectly:

brew install emscripten binaryen
echo "BINARYEN_ROOT = '/usr/local'" >> ~/.emscripten

I guess the proper fix is to make binaryen an explicit dependency of emscripten and change the ~/.emscripten content on installation.


Since this issue was a bit tricky to find, I'm including the latest observed error message in full for future searchers (seems to have changed since the issue first appeared):

shared:ERROR: BINARYEN_ROOT is not defined in /Users/me/.emscripten

Stalebot is correct, homebrew only keeps issues around if they're needed for active development. Since nothing is happening here it can be closed. Maybe you could make a pull request with your workaround?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oli-laban picture oli-laban  路  3Comments

Steffen911 picture Steffen911  路  3Comments

jakepetroules picture jakepetroules  路  3Comments

Thirudhas picture Thirudhas  路  4Comments

faraazkhan picture faraazkhan  路  3Comments