tree-sitter-php icon indicating copy to clipboard operation
tree-sitter-php copied to clipboard

bug: wasm build error

Open wszgrcy opened this issue 1 year ago • 1 comments

Did you check existing issues?

  • [X] I have read all the tree-sitter docs if it relates to using the parser
  • [X] I have searched the existing issues of tree-sitter-php

Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)

tree-sitter 0.22.1 (1c38d34deac5ae7ea797a559f596fb4ec9008eb4)

Describe the bug

run tree-sitter build-wasm ./temp/tree-sitter/php/php

scanner.c:1:10: fatal error: '../../common/scanner.h' file not found
#include "../../common/scanner.h"
         ^~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
emcc: error: '/emsdk/upstream/bin/clang -target wasm32-unknown-emscripten -fignore-exceptions -fPIC -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -DEMSCRIPTEN -Werror=implicit-function-declaration --sysroot=/emsdk/upstream/emscripten/cache/sysroot -Xclang -iwithsysroot/include/fakesdl -Xclang -iwithsysroot/include/compat -Os -fno-exceptions -fvisibility=hidden -I. scanner.c -c -o /tmp/emscripten_temp_5w46mjsx/scanner_0.o' failed (returned 1)
emcc command failed

Steps To Reproduce/Bad Parse Tree

  1. tree-sitter build-wasm ./temp/tree-sitter/php/php
  2. throw error

Expected Behavior/Parse Tree

success build

Repro

// Example code that causes the issue
function foo() {
  // Code that fails to parse, or causes an error
}

wszgrcy avatar Mar 14 '24 14:03 wszgrcy

Thoughts @amaanq? The path is correct from the viewpoint of scanner.c but the relative path is likely being applied where tree-sitter build-wasm finds the grammar.js (or wherever it is building from).

calebdw avatar Mar 14 '24 16:03 calebdw

docker issue w/ upstream, same issue in typescript/xml, I'll close as a dupe of the upstream https://github.com/tree-sitter/tree-sitter/issues/3233

amaanq avatar May 04 '24 03:05 amaanq