emscripten config file not found (emsdk-2.0.1-64bit)

876 views
Skip to first unread message

Raphael Stonehorse

unread,
Jul 27, 2021, 10:01:45 AM7/27/21
to emscripten-discuss

Hi all!,

I've installed emscripten in Ubuntu 20.04 .
The installation seemed ok:

    (base) raphy@pc:~$ git clone https://github.com/emscripten-core/emsdk.git
    Cloning into 'emsdk'...
    remote: Enumerating objects: 2819, done.
    remote: Counting objects: 100% (81/81), done.
    remote: Compressing objects: 100% (46/46), done.
    remote: Total 2819 (delta 48), reused 62 (delta 35), pack-reused 2738
    Receiving objects: 100% (2819/2819), 1.48 MiB | 20.81 MiB/s, done.
    Resolving deltas: 100% (1800/1800), done.

    (base) raphy@pc:~$ cd emsdk/
    (base) raphy@pc:~/emsdk$ ./emsdk install sdk-2.0.1-64bit
    (base) raphy@pc:~/emsdk$ ./emsdk install sdk-2.0.1-64bit
    Resolving SDK version '2.0.1' to 'sdk-releases-upstream-   
    13e29bd55185e3c12802bc090b4507901856b2ba-64bit'
    Installing SDK 'sdk-releases-upstream-
    13e29bd55185e3c12802bc090b4507901856b2ba-64bit'..
    Installing tool 'node-14.15.5-64bit'..
    Downloading: /home/raphy/emsdk/zips/node-v14.15.5-linux-x64.tar.xz from    
    v14.15.5-linux-x64.tar.xz, 21391232 Bytes
    Unpacking '/home/raphy/emsdk/zips/node-v14.15.5-linux-x64.tar.xz' to '/home/raphy
    /emsdk/node/14.15.5_64bit'
    Done installing tool 'node-14.15.5-64bit'.
    Installing tool 'releases-upstream-13e29bd55185e3c12802bc090b4507901856b2ba-
    64bit'..
    Downloading: /home/raphy/emsdk
    /zips/13e29bd55185e3c12802bc090b4507901856b2ba-wasm-binaries.tbz2 from   
    /13e29bd55185e3c12802bc090b>
    Unpacking '/home/raphy/emsdk
    /zips/13e29bd55185e3c12802bc090b4507901856b2ba-wasm-binaries.tbz2' to '
    /home/raphy/emsdk/upstream'
    Done installing tool 'releases-upstream-   
    13e29bd55185e3c12802bc090b4507901856b2ba-64bit'.
    Running post-install step: npm ci ...
    Done running: npm ci
    Done installing SDK 'sdk-releases-upstream-    13e29bd55185e3c12802bc090b4507901856b2ba-64bit'.

    (base) raphy@pc:~/emsdk$ ./upstream/emscripten/emc
    emcc            emcmake         emconfigure
    emcc.py         emcmake.py      emconfigure.py
    (base) raphy@pc:~/emsdk$ ./upstream/emscripten/emcc --check

   ========================================================================   ======
    Welcome to Emscripten!

    This is the first time any of the Emscripten tools has been run.

    A settings file has been copied to /home/raphy/emsdk/upstream/emscripten
    /.emscripten, at absolute path: /home/raphy/emsdk/upstream/emscripten
    /.emscripten

    It contains our best guesses for the important paths, which are:

      LLVM_ROOT       = /usr/bin
      NODE_JS         = /home/raphy/.nvm/versions/node/v14.17.0/bin/node
      EMSCRIPTEN_ROOT = /home/raphy/emsdk/upstream/emscripten

    Please edit the file if any of those are incorrect.

    This command will now exit. When you are done editing those paths, re-run it.
    ========================================================================   ======

But when just simply checking the version I get "no config file found" : 

    (base) raphy@pc:~/emsdk$ ./upstream/emscripten/emcc -v
    emcc: error: emscripten config file not found: /home/raphy/emsdk/.emscripten

What am I missing? How to solve the problem?

Raphael Stonehorse

unread,
Jul 27, 2021, 10:24:31 AM7/27/21
to emscripte...@googlegroups.com
After executing `activate`:

    (base) raphy@pc:~/emsdk$ ./emsdk activate sdk-2.0.1-64bit

    Resolving SDK version '2.0.1' to 'sdk-releases-upstream-13e29bd55185e3c12802bc090b4507901856b2ba-64bit'
    Setting the following tools as active:
       node-14.15.5-64bit
       releases-upstream-13e29bd55185e3c12802bc090b4507901856b2ba-64bit

    Next steps:
    - To conveniently access emsdk tools from the command line,
      consider adding the following directories to your PATH:
        /home/raphy/emsdk
        /home/raphy/emsdk/node/14.15.5_64bit/bin
        /home/raphy/emsdk/upstream/emscripten
    - This can be done for the current shell by running:
        source "/home/raphy/emsdk/emsdk_env.sh"
    - Configure emsdk in your shell startup scripts by running:
        echo 'source "/home/raphy/emsdk/emsdk_env.sh"' >> $HOME/.bash_profile
    (base) raphy@pc:~/emsdk$

I've set in .bashrc :

    export PATH="/home/raphy/emsdk:$PATH"
    export PATH="/home/raphy/emsdk/node/14.15.5_64bit/bin:$PATH"
    export PATH="/home/raphy/emsdk/upstream/emscripten:$PATH"

Now I get:

    (base) raphy@pc:~$ emcc -v
    emcc: error: BINARYEN_ROOT is set to empty value in /home/raphy/emsdk/upstream/emscripten/.emscripten



--
You received this message because you are subscribed to a topic in the Google Groups "emscripten-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/emscripten-discuss/a-Ph7m7CXAU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to emscripten-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/f34991ca-9b2b-449c-b779-c100df70caf8n%40googlegroups.com.

Raphael Stonehorse

unread,
Jul 27, 2021, 10:32:13 AM7/27/21
to emscripte...@googlegroups.com
After manually specifying the path:

    BINARYEN_ROOT = os.path.expanduser(os.getenv('BINARYEN', '/home/raphy/emsdk/upstream/emscripten/emcc')) # directory

I get this other error:  No such file or directory: '/usr/bin/clang'


    (base) raphy@pc:~$ emcc -v
    emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 2.0.1
    Traceback (most recent call last):
      File "/home/raphy/emsdk/upstream/emscripten/emcc.py", line 3327, in <module>
        sys.exit(run(sys.argv))
      File "/home/raphy/emsdk/upstream/emscripten/emcc.py", line 781, in run
        code = run_process([clang, '-v'], check=False).returncode
      File "/home/raphy/emsdk/upstream/emscripten/tools/shared.py", line 204, in run_process
        ret = subprocess.run(cmd, check=check, input=input, *args, **kw)
      File "/home/raphy/anaconda3/lib/python3.8/subprocess.py", line 493, in run
        with Popen(*popenargs, **kwargs) as process:
      File "/home/raphy/anaconda3/lib/python3.8/subprocess.py", line 858, in __init__
        self._execute_child(args, executable, preexec_fn, close_fds,
      File "/home/raphy/anaconda3/lib/python3.8/subprocess.py", line 1706, in _execute_child
        raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/clang'
    (base) raphy@pc:~$

Raphael Stonehorse

unread,
Jul 27, 2021, 10:46:17 AM7/27/21
to emscripte...@googlegroups.com
Based on here: https://apt.llvm.org/
I installed all the repo's packages:

    (base) raphy@pc:~$ sudo apt-get install clang-format clang-tidy clang-tools clang clangd libc++-dev libc++1 libc++abi-dev libc++abi1 libclang-dev libclang1 liblldb-dev libllvm-ocaml-dev libomp-dev libomp5 lld lldb llvm-dev
    llvm-runtime llvm python-clang

And now still have another issue... : 

    (base) raphy@pc:~$ emcc -v
    emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 2.0.1
    clang version 10.0.0-4ubuntu1
    Target: x86_64-pc-linux-gnu
    Thread model: posix
    InstalledDir: /usr/bin
    Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/9
    Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
    Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/9
    Candidate multilib: .;@m64
    Selected multilib: .;@m64
    emcc: warning: LLVM version appears incorrect (seeing "10.0", expected "12.0") [-Wversion-check]
    shared:INFO: (Emscripten: Running sanity checks)
   (base) raphy@pc:~


Floh

unread,
Jul 28, 2021, 3:43:11 AM7/28/21
to emscripten-discuss
I guess the problem is running emcc first before an SDK has been activated, this will create a broken .emscripten file:

./upstream/emscripten/emcc --check

Note the message about "guessing" /usr/bin path for LLVM_ROOT, this is definitely wrong because that's the local system clang toolchain, not the one coming with emscripten.

Instead, try to delete your existing emsdk directory and then start from scratch with exactly the following steps:

git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install 2.0.1
./emsdk activate 2.0.1
source emsdk_env.sh
cd ..

This works fine here on Ubuntu 21. Btw, any reason why you're specifically using 2.0.1? That's an old SDK from last August. If you want install and use the latest stable SDK, do this instead (replace "2.0.1" with "latest"):

git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install latest
./emsdk activate latest
source emsdk_env.sh
cd ..

Test if it works (with your own hello.c file):

emcc hello.c -o hello.js
node hello.js
Hello World!

Hope this works,
-Andre.

Floh

unread,
Jul 28, 2021, 3:51:06 AM7/28/21
to emscripten-discuss
PS: somehow you ended up in a broken state where Emscripten wants to use an external clang version, indicated by this line when running 'emcc -v':

Target: x86_64-pc-linux-gnu

This should be:

Target: wasm32-unknown-emscripten

I would really recommend starting from scratch and just running the simple setup sequence outlined in my previous post (clone, install, activate, source). You should never have to edit any emscripten config files or install additional Ubuntu packages. The Emscripten SDK is completely self-contained.

Raphael Stonehorse

unread,
Jul 28, 2021, 5:41:48 AM7/28/21
to emscripte...@googlegroups.com
Hi Andre,
thank you for your kind help.

    (base) raphy@pc:~$ rm -rf emsdk/

    (base) raphy@pc:~$ git clone https://github.com/emscripten-core/emsdk.git
    Cloning into 'emsdk'...
    remote: Enumerating objects: 2819, done.
    remote: Counting objects: 100% (81/81), done.
    remote: Compressing objects: 100% (46/46), done.
    remote: Total 2819 (delta 48), reused 62 (delta 35), pack-reused 2738
    Receiving objects: 100% (2819/2819), 1.48 MiB | 4.28 MiB/s, done.

    Resolving deltas: 100% (1800/1800), done.
    (base) raphy@pc:~$ cd emsdk/
    (base) raphy@pc:~/emsdk$ ./emsdk install 2.0.1

    Resolving SDK version '2.0.1' to 'sdk-releases-upstream-13e29bd55185e3c12802bc090b4507901856b2ba-64bit'
    Installing SDK 'sdk-releases-upstream-13e29bd55185e3c12802bc090b4507901856b2ba-64bit'..
    Installing tool 'node-14.15.5-64bit'..
    Downloading: /home/raphy/emsdk/zips/node-v14.15.5-linux-x64.tar.xz from https://storage.googleapis.com/webassembly/emscripten-releases-builds/deps/node-v14.15.5-linux-x64.tar.xz, 21391232 Bytes

    Unpacking '/home/raphy/emsdk/zips/node-v14.15.5-linux-x64.tar.xz' to '/home/raphy/emsdk/node/14.15.5_64bit'
    Done installing tool 'node-14.15.5-64bit'.
    Installing tool 'releases-upstream-13e29bd55185e3c12802bc090b4507901856b2ba-64bit'..
    Downloading: /home/raphy/emsdk/zips/13e29bd55185e3c12802bc090b4507901856b2ba-wasm-binaries.tbz2 from https://storage.googleapis.com/webassembly/emscripten-releases-builds/linux/13e29bd55185e3c12802bc090b4507901856b2ba/wasm-binaries.tbz2, 79111519
    Bytes
    Unpacking '/home/raphy/emsdk/zips/13e29bd55185e3c12802bc090b4507901856b2ba-wasm-binaries.tbz2' to '/home/raphy/emsdk/upstream'
    Done installing tool 'releases-upstream-13e29bd55185e3c12802bc090b4507901856b2ba-64bit'.

    Running post-install step: npm ci ...
    Done running: npm ci
    Done installing SDK 'sdk-releases-upstream-13e29bd55185e3c12802bc090b4507901856b2ba-64bit'.

    (base) raphy@pc:~/emsdk$ ./emsdk activate 2.0.1

    Resolving SDK version '2.0.1' to 'sdk-releases-upstream-13e29bd55185e3c12802bc090b4507901856b2ba-64bit'
    Setting the following tools as active:
       node-14.15.5-64bit
       releases-upstream-13e29bd55185e3c12802bc090b4507901856b2ba-64bit

    Next steps:
    - To conveniently access emsdk tools from the command line,
      consider adding the following directories to your PATH:
        /home/raphy/emsdk
        /home/raphy/emsdk/node/14.15.5_64bit/bin
        /home/raphy/emsdk/upstream/emscripten
    - This can be done for the current shell by running:
        source "/home/raphy/emsdk/emsdk_env.sh"
    - Configure emsdk in your shell startup scripts by running:
        echo 'source "/home/raphy/emsdk/emsdk_env.sh"' >> $HOME/.bash_profile

   
    (base) raphy@pc:~/emsdk$ source emsdk_env.sh
    Setting environment variables:
    PATH = /home/raphy/emsdk:/home/raphy/emsdk/upstream/emscripten:/home/raphy/emsdk/node/14.15.5_64bit/bin:/usr/local/go/bin:/home/raphy/anaconda3/bin:/home/raphy/anaconda3/condabin:/home/raphy/.pyenv/shims:/home/raphy/.pyenv/bin:/home/raphy/.nvm/versions
    /node/v14.17.0/bin:/home/raphy/.local/bin:/home/raphy/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
    EMSDK = /home/raphy/emsdk
    EM_CONFIG = /home/raphy/emsdk/.emscripten
    EMSDK_NODE = /home/raphy/emsdk/node/14.15.5_64bit/bin/node


    (base) raphy@pc:~/emsdk$ cd ..


    (base) raphy@pc:~$ emcc -v
    emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 2.0.1
    clang version 12.0.0 (/b/s/w/ir/cache/git/chromium.googlesource.com-external-github.com-llvm-llvm--project 365f861c45bb504c7b61f64943916fc570818cd1)
    Target: x86_64-unknown-linux-gnu
    Thread model: posix
    InstalledDir: /home/raphy/emsdk/upstream/bin

    Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
    Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9

    Candidate multilib: .;@m64
    Selected multilib: .;@m64
    shared:INFO: (Emscripten: Running sanity checks)


    (base) raphy@pc:~/emsdk$ emcc hello_world.c

    (base) raphy@pc:~/emsdk$ node a.out.js
    hello, world!


I wanted to install emscripten 2.0.1 version because I would like to try to use cpython:

"Emscripten is also required for the cross compilation. Emsdk 2.0.1 has been tested, and there are known issues with 2.0.2 - 2.0.14."

But... is this Emsdk 2.0.1 too old??



Floh

unread,
Jul 28, 2021, 12:14:56 PM7/28/21
to emscripten-discuss
Looks like it's working now :)

> But... is this Emsdk 2.0.1 too old??

Not really, but older versions like 2.0.1 have confusing things like this with 'emcc -v', which might make troubleshooting a bit harder:

Target: x86_64-unknown-linux-gnu

...I just checked 2.0.1 on macOS, and this prints:

Target: x86_64-apple-darwin20.6.0

Looks like it's trying to emulate a native compiler toolchain. Newer emscripten versions have fewer warts like this (for instance they clearly say "wasm" in the target triple). But if 2.0.1 is required for your use case then it's fine of course :)

Cheers,
-Andre.

Reply all
Reply to author
Forward
0 new messages