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

Emscripten needs Binaryen while compiling to wasm #47869

4 tasks done
openingnow opened this issue Dec 14, 2019 · 4 comments
4 tasks done

Emscripten needs Binaryen while compiling to wasm #47869

openingnow opened this issue Dec 14, 2019 · 4 comments
outdated PR was locked due to age stale No recent activity


Copy link

@openingnow openingnow commented Dec 14, 2019

  • ran brew update and can still reproduce the problem?
  • ran brew doctor, fixed all issues and can still reproduce the problem?
  • ran brew gist-logs <formula> (where <formula> is the name of the formula that failed) and included the output link?
  • 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
HEAD: aeefacc816a345bbf43259b6aff40c035868e8fd
Last commit: 15 hours ago
Core tap ORIGIN:
Core tap HEAD: 680e941d54f3212161e1d5544fb17938bce9690a
Core tap last commit: 8 hours ago
HOMEBREW_CASK_OPTS: --appdir=/Applications --fontdir=/Library/Fonts
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
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
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 emscripten-core/emscripten#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 #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/?

Copy link

@dasa dasa commented Dec 17, 2019

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

Copy link

@stale stale bot commented Jan 24, 2020

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

@stale stale bot added the stale No recent activity label Jan 24, 2020
@stale stale bot closed this as completed Jan 31, 2020
Copy link

@davidje13 davidje13 commented Feb 29, 2020

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

Copy link

@SMillerDev SMillerDev commented Feb 29, 2020

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?

@lock lock bot added the outdated PR was locked due to age label Apr 2, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Apr 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
outdated PR was locked due to age stale No recent activity
None yet

No branches or pull requests

4 participants