Skip to content

yarn fails with "undefined exported symbol" #82

Open
@wolfmanstout

Description

@wolfmanstout

I need to bump the kotlin tree-sitter version (I'm working on adding support to Cursorless). I just cloned this for the first time, along with a fresh clone of emscripten (which I did activate) and I'm getting the following build failure:

~/projects/vscode-parse-tree$ yarn
yarn install v1.22.22
$ make web-tree-sitter
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 2902k    0 2902k    0     0  3340k      0 --:--:-- --:--:-- --:--:-- 3340k
emcc: error: undefined exported symbol: "__ZNSt3__212basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE9__grow_byEmmmmmm" [-Wundefined] [-Werror]
make: *** [Makefile:59: vendor/web-tree-sitter/README.md] Error 1
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

I'm doing all this on WSL with an LTS installation of node/npm and a fresh installation of yarn. I see a similar closed bug but I'm not sure what the fix is: #30

Activity

wolfmanstout

wolfmanstout commented on Jun 10, 2024

@wolfmanstout
SponsorAuthor

Some more investigation indicates that I can reproduce this within a separate tree-sitter clone with ./script/build-wasm, but only if I check out the commit listed in in tree-sitter-version. tree-sitter builds fine at HEAD.

If I update tree-sitter-version here, I hit issues later in the build:

gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.<anonymous> (/home/jwstout/.nvm/versions/node/v20.14.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
gyp ERR! System Linux 5.15.146.1-microsoft-standard-WSL2
gyp ERR! command "/home/jwstout/.nvm/versions/node/v20.14.0/bin/node" "/home/jwstout/.nvm/versions/node/v20.14.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/jwstout/projects/vscode-parse-tree/node_modules/tree-sitter-clojure
wolfmanstout

wolfmanstout commented on Jun 10, 2024

@wolfmanstout
SponsorAuthor

I updated to the latest Ubuntu LTS (22.04.04, Jammy) on WSL, which includes a later Python version (3.10), and the build completes, but only if I update tree-sitter-version (otherwise it fails with the originally reported error). So I guess we could bump the tree-sitter-version and close this out? Not sure what testing needs to be done.

wolfmanstout

wolfmanstout commented on Jun 12, 2024

@wolfmanstout
SponsorAuthor

I tried bumping tree-sitter-version to HEAD and Cursorless failed a bunch of tests. I did a little more research to understand why I wasn't able to compile with the current tree-sitter-version. It turns out that each tree-sitter version is only guaranteed to work with a specific emscripten version. If you look at the tree-sitter repository at the pinned version, you can see that version is currently 3.1.37:
https://github.com/tree-sitter/tree-sitter/blob/6bbb50bef8249e6460e7d69e42cc8146622fa4fd/cli/emscripten-version#L1C1-L1C7

Hence, what I did was run:

emsdk install 3.1.37
emsdk activate 3.1.37

And now it builds.

I'm not sure what you want to do with this bug. At the very least it seems like a good idea to update the README to explain to users how to find the right emscripten version and activate it.

pokey

pokey commented on Jun 12, 2024

@pokey
Member

I'm doing the upgrade now; been a battle, but I'm pretty close. Stay tuned

pokey

pokey commented on Jun 12, 2024

@pokey
Member

(see #84)

wolfmanstout

wolfmanstout commented on Jun 13, 2024

@wolfmanstout
SponsorAuthor

Thanks! Still would be good to document the emsdk stuff better so future contributors don't run into the same problems I did. I can send a PR to update the readme if you want.

pokey

pokey commented on Jun 13, 2024

@pokey
Member

That would be awesome

pokey

pokey commented on Jun 14, 2024

@pokey
Member

ok we're now on tree-sitter version tree-sitter/tree-sitter@604d38e as of vscode-parse-tree version 0.31.0

pokey

pokey commented on Jun 17, 2024

@pokey
Member

fwiw looks like that emscripten version file has moved. Here's where it is for the version of tree-sitter we're currently on https://github.com/tree-sitter/tree-sitter/blob/604d38e6b327ed33877e1285680b505b9484a71c/cli/loader/emscripten-version

also just wanted to confirm whether this issue is fixed for you?

wolfmanstout

wolfmanstout commented on Jun 17, 2024

@wolfmanstout
SponsorAuthor

Thanks for the heads up about the file move. Yes this issue is fixed for me. Feel free to close now or after I send the docs improvement when I find time.

pokey

pokey commented on Jun 17, 2024

@pokey
Member

Great. Sure, I'll leave it open until docs fix lands

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

      Participants

      @pokey@wolfmanstout

      Issue actions

        yarn fails with "undefined exported symbol" · Issue #82 · cursorless-dev/vscode-parse-tree