brew update and can still reproduce the problem?brew doctor, fixed all issues and can still reproduce the problem?brew gist-logs <formula> (where <formula> is the name of the formula that failed) and included the output link?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.
Compile simple Hello World program(C++)
#include <iostream>
int main()
{
std::cout << "Hello Homebrew!\n";
}
after tons of cache:INFO: generating system library: XXX.bc,
$ em++ src.cpp
shared:ERROR: BINARYEN_ROOT must be set up in .emscripten
Compiles without Error
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.
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
As https://github.com/emscripten-core/emscripten/issues/9409 saying we need BINARYEN_ROOT to be set in ~.emscripten.
disable wasm output using em++ -s WASM=0 src.cpp
or install brew install binaryen then set BINARYEN_ROOT to /usr/local
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/?
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?
Most helpful comment
I ran into this issue as well and used
BINARYEN_ROOT = '/usr/local/opt/binaryen'