Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build errors #14

Open
yuriv opened this issue Oct 11, 2022 · 2 comments
Open

build errors #14

yuriv opened this issue Oct 11, 2022 · 2 comments

Comments

@yuriv
Copy link

yuriv commented Oct 11, 2022

I have run build ./build.py libjava-tree-sitter tree-sitter-c on the fresh installation and got following feedback:

Traceback (most recent call last):
File "./build.py", line 137, in
build(args.repositories, args.output, args.arch, args.verbose)
File "./build.py", line 57, in build
source_mtimes = [os.path.getmtime(file)] + [os.path.getmtime(path) for path in source_paths]
File "./build.py", line 57, in
source_mtimes = [os.path.getmtime(file)] + [os.path.getmtime(path) for path in source_paths]
File "/usr/lib64/python3.6/genericpath.py", line 55, in getmtime
return os.stat(filename).st_mtime
FileNotFoundError: [Errno 2] No such file or directory: 'libjava-tree-sitter/src/parser.c'

I have install java-tree-sitter with modules. Where I am wrong?

@WhileBug
Copy link

I have the same problem. Have you fixed it?

@dabico
Copy link

dabico commented Nov 28, 2022

EDIT:

I figured it out in the end, just include the v0.19.0 release of the grammar(s) you want in the root directory (example). Then run the build script (do not forget the -o flag if you want a custom library name) specifying the names of the grammars:

./build.py -o libjava-tree-sitter tree-sitter-c tree-sitter-cpp tree-sitter-java tree-sitter-javascript tree-sitter-python

I think the documentation on how to set up the project is not very clear. First of all, the above command is not correct as the help points out:

$ ./build.py

usage: build.py [-h] [-a ARCH] [-o OUTPUT] [-v] repositories [repositories ...]
build.py: error: the following arguments are required: repositories

Fair enough, I try not to specify the output file and let it default to whatever, only to be met with the same flavor of error:

Stacktrace
$ ./build.py tree-sitter-python

make: *** No rule to make target `clean'.  Stop.
make: *** No targets specified and no makefile found.  Stop.
Traceback (most recent call last):
  File "/Users/ozrendabic/Desktop/java-tree-sitter/build.py", line 137, in <module>
    build(args.repositories, args.output, args.arch, args.verbose)
  File "/Users/ozrendabic/Desktop/java-tree-sitter/build.py", line 57, in build
    source_mtimes = [os.path.getmtime(__file__)] + [os.path.getmtime(path) for path in source_paths]
  File "/Users/ozrendabic/Desktop/java-tree-sitter/build.py", line 57, in <listcomp>
    source_mtimes = [os.path.getmtime(__file__)] + [os.path.getmtime(path) for path in source_paths]
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/genericpath.py", line 55, in getmtime
    return os.stat(filename).st_mtime
FileNotFoundError: [Errno 2] No such file or directory: 'tree-sitter-python/src/parser.c'

Upon more investigation, I deduced that you need to clone the official tree-sitter grammar modules (i.e. tree-sitter-python) and include them in the root. I did so, but now receive a completely different error:

Stacktrace
$ ./build.py tree-sitter-python

make: *** No rule to make target `clean'.  Stop.
make: *** No targets specified and no makefile found.  Stop.
clang: error: no such file or directory: '/Users/ozrendabic/Desktop/java-tree-sitter/tree-sitter/libtree-sitter.a'
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/unixccompiler.py", line 204, in link
    self.spawn(linker + ld_args)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/ccompiler.py", line 917, in spawn
    spawn(cmd, dry_run=self.dry_run, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/spawn.py", line 68, in spawn
    raise DistutilsExecError(
distutils.errors.DistutilsExecError: command '/usr/bin/cc' failed with exit code 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/ozrendabic/Desktop/java-tree-sitter/build.py", line 137, in <module>
    build(args.repositories, args.output, args.arch, args.verbose)
  File "/Users/ozrendabic/Desktop/java-tree-sitter/build.py", line 109, in build
    compiler.link_shared_object(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/ccompiler.py", line 713, in link_shared_object
    self.link(CCompiler.SHARED_OBJECT, objects,
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/unixccompiler.py", line 206, in link
    raise LinkError(msg)
distutils.errors.LinkError: command '/usr/bin/cc' failed with exit code 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants