Skip to content

How should external tools find emscripten? #9685

@sbc100

Description

@sbc100

There are several external tools that want to be able to run emscripten (usually in order to run emcc/em++, etc). The ones that I know about are:

The method that both scons used to use, and the qtcreator is currently using is to open the ~/.emscripten config file (which is in python format) and somehow parse out the value of EMSCRIPTEN_ROOT and use that.

Note that the EMSCRIPTEN_ROOT key is completely useless for emscripten itself since emcc and all the other tools in emscripten already know where they are when they are run. In fact the presence of this key can be confusing and contradictory (what does it mean if you run emcc and the EMSCRIPTEN_ROOT points to a different place?).

The method that cmake uses is to look for the EMSCRIPTEN environment variable. The scons tools were changed to be purely environment-variable-based a while back: #7249. It now looks for EMSCRIPTEN_ROOT in the environment.

qtcreator looks like its parsing the config file as an ini file, which I guess works in many cases.

As part of #9543 I would like to avoid having external tools try to parse the emscripten config file.

We should pick a single, recommended way to locate emscripten and implement that in all the tools. The options I see are:

  1. Look for $EMSCRIPTEN to $EMSCRIPTEN_ROOT in the environment.
  2. Look for emcc in the $PATH environment.
  3. Create a new ~/.emscripten_root file that contains just a single string which is the emscripten directory.

We could also do (1) followed by (2), which I think is my preferred method.

The only downside of (1) or (2) is that it requires the user's environment variables to be changed.
With emsdk we already ask the user to run ./emsdk_env in order to do this, or to modify their startup files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions