Skip to content

Fix Swift build cannot find src/scanner.c.#372

Open
thiezn wants to merge 1 commit intotree-sitter:masterfrom
thiezn:master
Open

Fix Swift build cannot find src/scanner.c.#372
thiezn wants to merge 1 commit intotree-sitter:masterfrom
thiezn:master

Conversation

@thiezn
Copy link

@thiezn thiezn commented Dec 19, 2025

Missing src/scanner.c caused compile issues within Xcode.

Updated package.swift to follow the working tree-sitter-html Package.swift format.

Example output:

ld: warning: Could not parse or use implicit file '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/SwiftUICore.framework/Versions/A/SwiftUICore.tbd': cannot link directly with 'SwiftUICore' because product being built is not an allowed client of it Undefined symbols for architecture arm64:
"_tree_sitter_css_external_scanner_create", referenced from:
_tree_sitter_css.language in TreeSitterCSS.o
"_tree_sitter_css_external_scanner_deserialize", referenced from:
_tree_sitter_css.language in TreeSitterCSS.o
"_tree_sitter_css_external_scanner_destroy", referenced from:
_tree_sitter_css.language in TreeSitterCSS.o
"_tree_sitter_css_external_scanner_scan", referenced from:
_tree_sitter_css.language in TreeSitterCSS.o
"_tree_sitter_css_external_scanner_serialize", referenced from:
_tree_sitter_css.language in TreeSitterCSS.o
"_tree_sitter_javascript_external_scanner_create", referenced from:
_tree_sitter_javascript.language in TreeSitterJavaScript.o
"_tree_sitter_javascript_external_scanner_deserialize", referenced from:
_tree_sitter_javascript.language in TreeSitterJavaScript.o
"_tree_sitter_javascript_external_scanner_destroy", referenced from:
_tree_sitter_javascript.language in TreeSitterJavaScript.o
"_tree_sitter_javascript_external_scanner_scan", referenced from:
_tree_sitter_javascript.language in TreeSitterJavaScript.o
"_tree_sitter_javascript_external_scanner_serialize", referenced from:
_tree_sitter_javascript.language in TreeSitterJavaScript.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

missing src/scanner.c caused compile issues within Xcode.

example output:

ld: warning: Could not parse or use implicit file '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/SwiftUICore.framework/Versions/A/SwiftUICore.tbd': cannot link directly with 'SwiftUICore' because product being built is not an allowed client of it
Undefined symbols for architecture arm64:
  "_tree_sitter_css_external_scanner_create", referenced from:
      _tree_sitter_css.language in TreeSitterCSS.o
  "_tree_sitter_css_external_scanner_deserialize", referenced from:
      _tree_sitter_css.language in TreeSitterCSS.o
  "_tree_sitter_css_external_scanner_destroy", referenced from:
      _tree_sitter_css.language in TreeSitterCSS.o
  "_tree_sitter_css_external_scanner_scan", referenced from:
      _tree_sitter_css.language in TreeSitterCSS.o
  "_tree_sitter_css_external_scanner_serialize", referenced from:
      _tree_sitter_css.language in TreeSitterCSS.o
  "_tree_sitter_javascript_external_scanner_create", referenced from:
      _tree_sitter_javascript.language in TreeSitterJavaScript.o
  "_tree_sitter_javascript_external_scanner_deserialize", referenced from:
      _tree_sitter_javascript.language in TreeSitterJavaScript.o
  "_tree_sitter_javascript_external_scanner_destroy", referenced from:
      _tree_sitter_javascript.language in TreeSitterJavaScript.o
  "_tree_sitter_javascript_external_scanner_scan", referenced from:
      _tree_sitter_javascript.language in TreeSitterJavaScript.o
  "_tree_sitter_javascript_external_scanner_serialize", referenced from:
      _tree_sitter_javascript.language in TreeSitterJavaScript.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
@1024jp
Copy link

1024jp commented Jan 25, 2026

The same as tree-sitter/tree-sitter-css#90.

I’m encountering the same issue, and I’ve confirmed that this PR resolves it in my project as well.

I hope this PR will be merges.

@amaanq
Copy link
Member

amaanq commented Feb 11, 2026

How does this fix anything? The logic is not any different, which means however you've setup the project is messing with scanner detection. The point of the code is to have generated bindings that work for grammars with and without scanners.

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

Successfully merging this pull request may close these issues.

3 participants