Skip to content

emscripten:hello-world-wasm fails with tarfile.ReadError #986

Closed

Description

@luxe

I followed the setup instructions here.
The build command I'm using is: bazel build --verbose_failures //code/programs/examples/emscripten:hello-world-wasm
The same code and BUILD definition in the instructions.

The error I get is:

INFO: Analyzed target //code/programs/examples/emscripten:hello-world-wasm (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /home/luxe/Desktop/unilang/source/code/programs/examples/emscripten/BUILD:9:15: Action code/programs/examples/emscripten/hello-world-wasm/hello-world.js failed: (Exit 1): wasm_binary failed: error executing command 
  (cd /home/luxe/.cache/bazel/_bazel_luxe/9b1d289b10540c9752c68b55618a2156/sandbox/linux-sandbox/838/execroot/__main__ && \
  exec env - \
  bazel-out/k8-opt-exec-2B5CBBC6/bin/external/emsdk/emscripten_toolchain/wasm_binary --output_path bazel-out/k8-fastbuild/bin/code/programs/examples/emscripten/hello-world-wasm --archive bazel-out/wasm-fastbuild-ST-95dcf5f511a2/bin/code/programs/examples/emscripten/hello-world)
Execution platform: @local_config_platform//:host

Use --sandbox_debug to see verbose messages from the sandbox
Traceback (most recent call last):
  File "/home/luxe/.cache/bazel/_bazel_luxe/9b1d289b10540c9752c68b55618a2156/sandbox/linux-sandbox/838/execroot/__main__/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/emsdk/emscripten_toolchain/wasm_binary.runfiles/emsdk/emscripten_toolchain/wasm_binary.py", line 68, in <module>
    main()
  File "/home/luxe/.cache/bazel/_bazel_luxe/9b1d289b10540c9752c68b55618a2156/sandbox/linux-sandbox/838/execroot/__main__/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/emsdk/emscripten_toolchain/wasm_binary.runfiles/emsdk/emscripten_toolchain/wasm_binary.py", line 49, in main
    tar = tarfile.open(args.archive)
  File "/usr/lib/python3.9/tarfile.py", line 1616, in open
    raise ReadError("file could not be opened successfully")
tarfile.ReadError: file could not be opened successfully
Target //code/programs/examples/emscripten:hello-world-wasm failed to build
INFO: Elapsed time: 0.170s, Critical Path: 0.05s
INFO: 2 processes: 2 internal.
FAILED: Build did NOT complete successfully

Any suggestions?

Activity

  1. walkingeyerobot commented on Feb 11, 2022

    @walkingeyerobot
    Collaborator

    I suspect those instructions are slightly out of date, and will continue to be out of date with every emscripten release.

    Can you try cloning the emsdk repo, and from the bazel directory, running bazel build hello-world:hello-world-wasm? If that works for you, I'll figure out the best way to update the docs.

  2. dpar39 commented on Sep 28, 2022

    @dpar39

    Did you figure this out? I'm having the same issue with emsdk 3.1.20.

  3. luxe commented on Nov 1, 2022

    @luxe
    ContributorAuthor

    @walkingeyerobot, @dpar39
    Thank you. I had the following in my .bazelrc which caused this problem:

    build --incompatible_use_specific_tool_files=false
    build --incompatible_enable_cc_toolchain_resolution
    

    By removing both, bazel build hello-world:hello-world-wasm builds as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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