Closed GWW closed 1 year ago
static_assert is valid in C11 (and compiling with clang and gcc with -std=c99 also works for me), there is a check for the __STDC_VERSION__
, what platform and compiler are you using?
Hi,
Thanks for the reply. I am getting the error when I try to compile with clang v16.06. The plugin does compile with GCC 13.1.0
, however, neovim crashes when I try to open a python file.
/usr/local/bin/nvim: symbol lookup error: /home/gww/.local/share/nvim/lazy/nvim-treesitter/parser/python.so: undefined symbol: static_assert
It seems like it's linking the wrong version of libc
and not the one in my mamba environment.
gww@GWW-AMD:~/.config/nvim$ nm -D /home/gww/.local/share/nvim/lazy/nvim-treesitter/parser/python.so
w _ITM_deregisterTMCloneTable
w _ITM_registerTMCloneTable
U __assert_fail
w __cxa_finalize
w __gmon_start__
00000000000115ac T _fini
0000000000003000 T _init
U calloc
0000000000010e1e T delimiter_vec_new
U free
0000000000010e00 T indent_vec_new
U realloc
U static_assert
0000000000010dbf T tree_sitter_python
000000000001152c T tree_sitter_python_external_scanner_create
00000000000113e7 T tree_sitter_python_external_scanner_deserialize
0000000000011580 T tree_sitter_python_external_scanner_destroy
0000000000010e3c T tree_sitter_python_external_scanner_scan
000000000001138c T tree_sitter_python_external_scanner_serialize
gww@GWW-AMD:~/.config/nvim$ ldd /home/gww/.local/share/nvim/lazy/nvim-treesitter/parser/python.so
linux-vdso.so.1 (0x00007ffcebbdf000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fc965a70000)
/lib64/ld-linux-x86-64.so.2 (0x00007fc965cd8000)
gww@GWW-AMD:~/.config/nvim$ ldd --version ldd
ldd (Ubuntu GLIBC 2.31-0ubuntu9.9) 2.31
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
I upgraded to ubuntu 22.04 and that seems to have fixed the issue. I was using ubuntu 20 before.
Hmm, weird that it was linking the wrong libraries at runtime - glad you got it fixed
I upgraded to ubuntu 22.04 and that seems to have fixed the issue. I was using ubuntu 20 before.
@GWW
Did you have micromamba activated when treesitter's python.so
was compiled (and your micromamba did have gcc installed)? I assume you compiled the failing one with micromamba's gcc and after the ubuntu upgrade you compiled with the system gcc one.
Because: Have the same problem here. Using lazyvim and have it compiling python.so. Which fails when micromamba is activated, using its compiler with the same problem than you described, crashing(!) neovim :-1:
Then I installed python-devel on the system, i.e. have system gcc, deactivate micromamba, then simply delete the python.so
from treesitter and have lazy/mason compile it again, I get a working python.so
. neovim works, also then within micromamba activated.
Differences:
strings python.so > nw # (non working, same for working one, named "w")
[foo2@fedora-4gb-hel1-3 nvim]$ diff nw w
3,4d2
< _init
< _fini
19d16
< static_assert <---- NOT in the working python.so but in the one from micromamba gcc
23,24c20
< /home/foo2/micromamba/lib
< u(UH
---
> u+UH
240c236
< tmp != ((void *)0)
---
> tmp != NULL
244,248c240,241
< GCC: (GNU) 4.4.7 20120313 (Red Hat 4.4.7-23)
< GCC: (conda-forge gcc 13.1.0-0) 13.1.0
< crti.o
< call_gmon_start
< crtstuff.c
---
> GCC: (GNU) 13.1.1 20230614 (Red Hat 13.1.1-4)
> crtbeginS.o
283a277
> crtendS.o
284a279
> _fini
289a285
> _init
294d289
< _fini
304d298
< static_assert
308d301
< _init
311a305,306
> .note.gnu.property
> .note.gnu.build-id
320d314
< .plt.got
329a324
> .got
331d325
< .data
333a328
> .gnu.build.attributes
[foo2@fedora-4gb-hel1-3 nvim]$
I'm not a C dev, have no idea how I could compile it within micromamba, i.e. set some compile flags or so (?)
Would be really good if this could work in micromamba, since I don't have root always to install gcc systemwide...
Update: Found a way
export CFLAGS=-std=c99
... to no avail, crashing still with static_assert
problem :-(micromamba install zig
, export CC=zig
rm ~/.local/share/nvim/lazy/nvim-treesitter/parser/python.so
=> works. Zig is obviously not passing the __STDC_VERSION__
check for using static_asssert
which @amaanq mentioned.
Hi,
I ended up ensuring that micromamba was deactivated and compiled the library with the system gcc
. I didn't spend much time investigating why it was causing an issue. It would be nice if it would work with micromamba but I am just happy it doesn't crash now.
Micromamba uses gcc 4.4.7, static_assert was officially added in gcc 4.6 which is conditionally checked with __STDC_VERSION__
being greater than 201112L, I don't know if that's a custom gcc fork because static_assert should be available based on that flag being true, yet gcc being 4.4.7. Sorry but I'd take it up with Micromamba
Hi,
When I try to
:TSInstall python
I get the following error:From my understanding
static_assert
is C++11 and not compatiable with ISO C99.