Opened 2 weeks ago

Last modified 2 weeks ago

#69744 assigned defect

tree-sitter-cpp: Undefined Symbol "_static_assert"

Reported by: RobK88 Owned by: amake (Aaron Madlon-Kay)
Priority: Normal Milestone:
Component: ports Version: 2.9.3
Keywords: mountainlion Cc: RobK88
Port: tree-sitter-cpp

Description

tree-sitter-cpp fails to build on Mtn Lion - Undefined Symbol "_static_assert".

bash-3.2$ sudo port clean tree-sitter-cpp
Password:
--->  Cleaning tree-sitter-cpp

bash-3.2$ sudo port -v upgrade tree-sitter-cpp
--->  Computing dependencies for tree-sitter-cpp.
--->  Fetching archive for tree-sitter-cpp
--->  tree-sitter-cpp-0.21.0_0.darwin_12.x86_64.tbz2 doesn't seem to exist in /opt/local/var/macports/incoming/verified
--->  Attempting to fetch tree-sitter-cpp-0.21.0_0.darwin_12.x86_64.tbz2 from http://packages.macports.org/tree-sitter-cpp
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
--->  Attempting to fetch tree-sitter-cpp-0.21.0_0.darwin_12.x86_64.tbz2 from http://ywg.ca.packages.macports.org/mirror/macports/packages/tree-sitter-cpp
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
--->  Attempting to fetch tree-sitter-cpp-0.21.0_0.darwin_12.x86_64.tbz2 from http://mirror.fcix.net/macports/packages/tree-sitter-cpp
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
--->  Fetching distfiles for tree-sitter-cpp
--->  Verifying checksums for tree-sitter-cpp
--->  Checksumming tree-sitter-cpp-0.21.0.tar.gz
--->  Extracting tree-sitter-cpp
--->  Extracting tree-sitter-cpp-0.21.0.tar.gz
Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_tree-sitter-cpp/tree-sitter-cpp/work" && /usr/bin/gzip -dc '/opt/local/var/macports/distfiles/tree-sitter-cpp/tree-sitter-cpp-0.21.0.tar.gz' | /usr/bin/gnutar --no-same-owner -xf - 
--->  Configuring tree-sitter-cpp
--->  Building tree-sitter-cpp
scanner.c:126:5: warning: implicit declaration of function 'static_assert' is invalid in C99 [-Wimplicit-function-declaration]
    static_assert(MAX_DELIMITER_LENGTH * sizeof(wchar_t) < TREE_SITTER_SERIALIZATION_BUFFER_SIZE,
    ^
1 warning generated.
Undefined symbols for architecture x86_64:
  "_static_assert", referenced from:
      _tree_sitter_cpp_external_scanner_serialize in scanner.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Command failed: /usr/bin/clang -isystem/opt/local/include/LegacySupport -I/opt/local/include -Os -arch x86_64 -fPIC -shared *.o -o libtree-sitter-cpp.dylib
Exit code: 1
Error: Failed to build tree-sitter-cpp: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_tree-sitter-cpp/tree-sitter-cpp/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug.

Attachments (1)

main.log (8.6 KB) - added by RobK88 2 weeks ago.
main.log

Download all attachments as: .zip

Change History (6)

Changed 2 weeks ago by RobK88

Attachment: main.log added

main.log

comment:1 Changed 2 weeks ago by RobK88

Cc: RobK88 added

comment:2 Changed 2 weeks ago by RobK88

Here is a workaround -- use a newer compiler like clang-11

bash-3.2$ sudo port clean tree-sitter-cpp
--->  Cleaning tree-sitter-cpp
bash-3.2$ 
bash-3.2$ sudo port upgrade tree-sitter-cpp configure.compiler=macports-clang-11
--->  Computing dependencies for tree-sitter-cpp
--->  Fetching archive for tree-sitter-cpp
--->  Attempting to fetch tree-sitter-cpp-0.21.0_0.darwin_12.x86_64.tbz2 from http://packages.macports.org/tree-sitter-cpp
--->  Attempting to fetch tree-sitter-cpp-0.21.0_0.darwin_12.x86_64.tbz2 from http://ywg.ca.packages.macports.org/mirror/macports/packages/tree-sitter-cpp
--->  Attempting to fetch tree-sitter-cpp-0.21.0_0.darwin_12.x86_64.tbz2 from http://mirror.fcix.net/macports/packages/tree-sitter-cpp
--->  Fetching distfiles for tree-sitter-cpp
--->  Verifying checksums for tree-sitter-cpp
--->  Extracting tree-sitter-cpp
--->  Configuring tree-sitter-cpp
--->  Building tree-sitter-cpp
--->  Staging tree-sitter-cpp into destroot
--->  Installing tree-sitter-cpp @0.21.0_0
--->  Cleaning tree-sitter-cpp
--->  Computing dependencies for tree-sitter-cpp
--->  Activating tree-sitter-cpp @0.21.0_0
--->  Cleaning tree-sitter-cpp
--->  Scanning binaries for linking errors
etc

comment:3 Changed 2 weeks ago by ryandesign (Ryan Carsten Schmidt)

Cc: amake removed
Keywords: mountainlion added; mtnlion removed
Owner: set to amake
Status: newassigned
Summary: tree-sitter-cpp Fails to Build on Mtn Lion - Undefined Symbol "_static_assert"tree-sitter-cpp: Undefined Symbol "_static_assert"

It's a fairly common problem. Using legacysupport is a cheaper workaround. See #66055 for an example.

comment:4 Changed 2 weeks ago by jmroot (Joshua Root)

It's already using legacysupport, and requiring a C11 capable compiler. What it's not doing is passing -std=c11 to the compiler.

comment:5 Changed 2 weeks ago by ryandesign (Ryan Carsten Schmidt)

Because tree-sitter-cpp is using the tree_sitter portgroup which completely overrides the configure, build, and destroot phases with its own commands. Why does it do that? tree-sitter-cpp ships with a Makefile that does specify -std=c11. Why isn't the port using that?

Note: See TracTickets for help on using tickets.