Skip to content

wasm-opt: unknown option '--no-stack-ir' #22249

Closed

Description

@agarny

Version of emscripten/emsdk:

emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.64-git
clang version 19.0.0git
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /opt/homebrew/Cellar/emscripten/3.1.63/libexec/llvm/bin

Failing command line in full:
The following command gets automatically executed by my CMake-build system that uses emcmake and emcc:

/opt/homebrew/Cellar/emscripten/3.1.63/libexec/binaryen/bin/wasm-opt --strip-target-features --post-emscripten -O3 --low-memory-unused --zero-filled-memory --pass-arg=directize-initial-contents-immutable --no-stack-ir src/libopencor.wasm -o src/libopencor.wasm --mvp-features --enable-multivalue --enable-mutable-globals --enable-reference-types --enable-sign-ext

and it results in:

Unknown option '--no-stack-ir'

From a quick search, it looks like the issue got introduced here.

Activity

  1. agarny commented on Jul 16, 2024

    @agarny
    Author

    FWIW, I reverted to emscripten 3.1.62 and, sure enough, it's all working fine for me once again.

  2. sbc100 commented on Jul 16, 2024

    @sbc100
    Collaborator

    It looks like you are trying to mix emscripten version 3.1.64-git with binaryen from 3.1.62. Because that is new option that was added to binaryen recently mixing versions like that won't work.

  3. agarny commented on Jul 16, 2024

    @agarny
    Author

    It looks like you are trying to mix emscripten version 3.1.64-git with binaryen from 3.1.62. Because that is new option that was added to binaryen recently mixing versions like that won't work.

    No, 3.1.62 is the version I reverted to and which works for me. I was using version 3.1.63. And, indeed, which emcc returns /opt/homebrew/bin/emcc which redirects to ../Cellar/emscripten/3.1.63/bin/emcc. So, no idea why emcc -v mentions 3.1.64-git, but as far as I can tell everything is from version 3.1.63. Also, note that InstalledDir mentions /opt/homebrew/Cellar/emscripten/3.1.63/libexec/llvm/bin.

  4. sbc100 commented on Jul 16, 2024

    @sbc100
    Collaborator

    Ah, I see what happened here. I tagged slightly the wrong version in the emscripten repo for 3.1.63.

    I accidentally tagged #22228 which updated the changelog instead of #22200 which was actually used to make the official 3.1.63 release.

    This means folks downstream like homebrew got slightly the wrong emscripten version. Normally this would not matter but in this case the intervening revisions started using a brand new binaryen flag. Bag luck I guess.. but good that we caught it.

    @kripken what do you think we should do here? I could force push the tag to update it? But I'm not sure how that might effect.

  5. kripken commented on Jul 16, 2024

    @kripken
    Member

    Hmm, updating the tag now might be too late for homebrew, if they've already built from the old tag (unless they want to rebuild, but I have no idea if they do such things, or would be interested to even if they do).

    But also updating the tag seems low-risk, and might fix other people, so I'd support updating the tag. You can just delete it remotely and then push it again (no need for a force-push, which at least feels riskier to me as I never remember what is being pushed by the git command - sometimes it pushes branches too).

    If we agree to do that then let's file a homebrew issue after we update the tag.

    Side issue, when we do that, it might make sense to suggest some kind of testing on the homebrew side (testing an optimized build could have caught this).

  6. added a commit that references this issue on Jul 16, 2024
  7. sbc100 commented on Jul 16, 2024

    @sbc100
    Collaborator

    I added a comment to the downstream release commit: Homebrew/homebrew-core@ee9351f

  8. agarny commented on Jul 18, 2024

    @agarny
    Author

    Hi @sbc100, may I ask when we can expect 3.1.64 to be released so that Homebrew can also release a new update? Right now, it's breaking our continuous integration (which installs Emscripten from Homebrew) and, apparently, I am not the only one in this situation.

  9. sbc100 commented on Jul 19, 2024

    @sbc100
    Collaborator

    I'm on vacation for the next 10 days I'm afraid. I think @kripken or @dschuff should be able to make a release before then.

  10. kripken commented on Jul 19, 2024

    @kripken
    Member

    We can try to do one next week, but @agarny can you use the previous version until then?

  11. agarny commented on Jul 19, 2024

    @agarny
    Author

    We can try to do one next week, but @agarny can you use the previous version until then?

    I am using 3.1.62 on my development machine (not thanks to Homebrew since they don't provide an easy way to switch to an older version of a formula), but not in my CI. I guess I could use the same "hack" on GitHub Actions where my CI is done, but that would be messy. Anyway, I am happy to wait until next week. Thanks in advance...

  12. csjh commented on Jul 20, 2024

    @csjh

    For anyone else looking for a workaround, commenting out line 436 in <emscripten>/tools/link.py seems to work

  13. JohnSmith-132 commented on Jul 20, 2024

    @JohnSmith-132

    Beast. Thanks, that immediately got the build up and running.

      if will_metadce():
        # passes += ['--no-stack-ir']
        pass
      return passes
  14. kripken commented on Jul 22, 2024

    @kripken
    Member

    @agarny I released 3.1.64 now which should resolve this. (At least once homebrew updates to that.)

  15. agarny commented on Jul 24, 2024

    @agarny
    Author

    @agarny I released 3.1.64 now which should resolve this. (At least once homebrew updates to that.)

    Thanks a lot @kripken, I can confirm that everything is back to normal for me now.

  16. vittorioromeo commented on Aug 14, 2024

    @vittorioromeo
    Contributor

    I am still getting this error with my installation of Emscripten on MSYS2/CLANG64:

    emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.64-git (7b466b4f097b05b9f1e4f6ae0753f525cac08c92)
    clang version 19.0.0git
    Target: wasm32-unknown-emscripten
    Thread model: posix
    InstalledDir: C:/msys64/clang64/opt/emscripten-llvm/bin
    

    I used @csjh's workaround in #22249 (comment), but now I am getting another error:

    Unknown option '--optimize-level'
    em++: error: 'C:\msys64\clang64/bin/wasm-metadce --graph-file=C:/msys64/tmp/emcc_dce_graph_69960a4g.json --optimize-level=3 --shrink-level=0 --optimize-stack-ir bin\text_benchmark.wasm -o bin\text_benchmark.wasm --mvp-features --enable-threads --enable-bulk-memory --enable-multivalue --enable-mutable-globals --enable-reference-types --enable-sign-ext --enable-reference-types' failed (returned 1)
    

    These are my flags:

    
    set(SFML_EMSCRIPTEN_TARGET_COMPILE_OPTIONS
        -O3
        -pthread
    )
    
    set(SFML_EMSCRIPTEN_TARGET_LINK_OPTIONS
        -SMINIFY_HTML=1
    
        -pthread
    
        -Wno-pthreads-mem-growth
        -Wno-limited-postlink-optimizations
    
        -sALLOW_MEMORY_GROWTH=1
        -sFETCH=1
        -sFORCE_FILESYSTEM=1
        -sFULL_ES3=1
        -sMAX_WEBGL_VERSION=2
        -sMIN_WEBGL_VERSION=2
        -sSTACK_SIZE=4mb
        -sUSE_PTHREADS=1
        -sWASM=1
        -sJSPI=1
        -sEXIT_RUNTIME=1
        -sASYNCIFY_IGNORE_INDIRECT=1
    
        --emrun
    )
    

    Am I doing something wrong?

  17. sbc100 commented on Aug 14, 2024

    @sbc100
    Collaborator

    There was a problem with the 3.1.63 release of emscripten which was incorrectly tagged as 7b466b4. This mean that distributions other than emsdk itself included the wrong version of emscripten, which depended on a more recent version of binaryen.

    The fix is to update to 3.1.64 which doesn't have this problem.

  18. vittorioromeo commented on Aug 15, 2024

    @vittorioromeo
    Contributor

    There was a problem with the 3.1.63 release of emscripten which was incorrectly tagged as 7b466b4. This mean that distributions other than emsdk itself included the wrong version of emscripten, which depended on a more recent version of binaryen.

    The fix is to update to 3.1.64 which doesn't have this problem.

    I was confused because emcc -v does output 3.1.64 as the installed version, and because the workaround mentioned here did not fully work for me. I guess this particular 3.1.64 build is broken then?

  19. patham9 commented on Aug 15, 2024

    @patham9

    @sbc100 Unfortunately the issue still occurs with 3.1.64, and somehow this bugged version made it into Homebrew.

  20. sbc100 commented on Aug 15, 2024

    @sbc100
    Collaborator

    What does wasm-opt --version say for your 3.1.64 install?

    Does homebrew include binaryen as a separate package? If so how does it represent the tight version coupling?

  21. arximboldi commented on Sep 3, 2024

    @arximboldi

    Also struggling with this issue with Nix (using nixpkgs-unstable with 3.1.64 and binaryen 118).

  22. sbc100 commented on Sep 3, 2024

    @sbc100
    Collaborator

    Emscripten is not generally supported/tested with stable versions of llvm or binaryen. i.e. you need to use a custom/pinned version of binaryen, not version 118 itself.

    See #11362 and #22408

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