Invalid code signature for grammar library

Hi everyone!

I’m having an issue submitting the new version of Nova Vue.

I’ve added a new tree-sitter based syntax and everything works pretty much ok, except some language injections but this will be for another issue. The main problem I’m facing right now is that if I try to submit the extension to the library I get this error:

I followed the official getting started guide and I’m not sure what I did wrong. Can anyone give me a hand on this? Thanks!

Hello Tommaso,

Do you happen to know what C compiler toolchain you were using to compile? The example scripts from our documentation just invoke Make with the default C compiler that’s available in your shell path, IIRC.

By default, Apple’s toolchain distributed with Xcode signs built libraries automatically using a simple signing method (ad-hoc signing), which should be accepted by the submission process. However, if you’re using a different compiler toolchain (such as GCC or a Clang toolchain built from source) it might not work this way.

Hi Logan,

To be honest I’m not really sure to know how to find the answer to your question. I’ve simply used the makefile you provided in the docs with no extra configurations on my side.

I can tell you that I have Xcode installed on my machine as well as gcc and clang. It’s possible that one of those have been used as the default. I kwon it’s not exactly related to Nova but can you tell me how can I eventually switch to the Xcode toolchain? I’ve tried looking online but I might be missing the right search keywords since I’ve not found any relevant result.

Thanks!

Yep! I’m by no means versed in all of this, I mostly stumble my way through it. But I’ll definitely try. :sweat_smile:

You might invoke cc --version on the command line, and that should tell you what compiler is being used by our makefile. If it prints something like “Apple clang”, then you’re already using Xcode’s toolchain.

If it doesn’t, the printed output might list the actual location of the toolchain, or you might be able to see by invoking which cc. If it does end up that GCC is being used by default, its containing directory might be ahead of /usr/bin in your shell PATH, so you might need to manually specify the compiler toolchain when invoking the Makefile, and I think that’d be something like so:

CC=/usr/bin/cc LD=/usr/bin/ld ./compile_parser.sh ...

Hi Logan,

thanks for your help! Really appreciated.

Unfortunately it doesn’t seem to fix the issue… I guess I’m using the correct toolchain as you can see from the cc --version log:

Apple clang version 14.0.0 (clang-1400.0.29.102)
Target: arm64-apple-darwin22.1.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

and this is the compile_parser.sh output:

➜  tree-sitter-vue git:(master) ✗ CC=/usr/bin/cc LD=/usr/bin/ld ./compile_parser.sh ./ /Applications/Nova.app
+./compile_parser.sh:4> BASEDIR=./
+./compile_parser.sh:5> APPBUNDLE=/Applications/Nova.app
+./compile_parser.sh:6> FRAMEWORKS_PATH=/Applications/Nova.app/Contents/Frameworks/
+./compile_parser.sh:7> WORKINGDIR=+./compile_parser.sh:7> pwd
+./compile_parser.sh:7> WORKINGDIR=/Users/tommaso/Developer/Test/tree-sitter-vue
+./compile_parser.sh:12> BUILD_FLAGS='-arch arm64 -arch x86_64 -mmacosx-version-min=11.0 -I.//src/'
+./compile_parser.sh:15> TMP_BUILD_DIR=/Users/tommaso/Developer/Test/tree-sitter-vue/build
+./compile_parser.sh:16> mkdir -p /Users/tommaso/Developer/Test/tree-sitter-vue/build
+./compile_parser.sh:18> pushd ./
+./compile_parser.sh:20> CFLAGS='-arch arm64 -arch x86_64 -mmacosx-version-min=11.0 -I.//src/ -O3' CXXFLAGS='-arch arm64 -arch x86_64 -mmacosx-version-min=11.0 -I.//src/ -O3' LDFLAGS='-arch arm64 -arch x86_64 -mmacosx-version-min=11.0 -I.//src/ -F/Applications/Nova.app/Contents/Frameworks/ -framework SyntaxKit -rpath @loader_path/../Frameworks' PREFIX=/Users/tommaso/Developer/Test/tree-sitter-vue/build make 'CC=/usr/bin/clang' install
/usr/bin/clang -arch arm64 -arch x86_64 -mmacosx-version-min=11.0 -I.//src/ -F/Applications/Nova.app/Contents/Frameworks/ -framework SyntaxKit -rpath @loader_path/../Frameworks -dynamiclib -Wl,-lc++,-install_name,/Users/tommaso/Developer/Test/tree-sitter-vue/build/lib/libtree-sitter-vue.dylib,-rpath,@executable_path/../Frameworks src/parser.o src/scanner.o  -o libtree-sitter-vue.dylib
ld: warning: dylib (/Applications/Nova.app/Contents/Frameworks//SyntaxKit.framework/SyntaxKit) was built for newer macOS version (11.6) than being linked (11.0)
ld: warning: dylib (/Applications/Nova.app/Contents/Frameworks//SyntaxKit.framework/SyntaxKit) was built for newer macOS version (11.6) than being linked (11.0)
install -d '/Users/tommaso/Developer/Test/tree-sitter-vue/build/lib'
install -m755 libtree-sitter-vue.dylib '/Users/tommaso/Developer/Test/tree-sitter-vue/build/lib'/libtree-sitter-vue.dylib
install -d '/Users/tommaso/Developer/Test/tree-sitter-vue/build/include'/tree_sitter
+./compile_parser.sh:25> popd

I keep getting the same error on submission :disappointed:. I even tried to fix the warning by setting the macOS min version to 11.6 but nothing.

If perhaps you want to try and see by yourself this is the repo I’m using: GitHub - ikatyang/tree-sitter-vue: Vue grammar for tree-sitter

Thanks a lot!

I found I had to add an ad hoc codesign step like this:

codesign -s - mylibrary.dylib
1 Like

Thanks! That solved the issue :rocket:

2 Likes

Good to know! I’ll make sure we add this to our documentation for those that might need it.

1 Like