martanne / vis

A vi-like editor based on Plan 9's structural regular expressions
Other
4.19k stars 260 forks source link

Error "attempt to index a nil value" in separate vis-window on fresh install and/or when "require('vis')" is present is visrc.lua #1153

Closed matt-152 closed 6 months ago

matt-152 commented 8 months ago

Hello, I'm running into an issue which appears on a fresh vis install on my MacBook Pro 2019

A second window automatically opens when opening vis, containing only attempt to index a nil value. There also doesn't appear to be any syntax highlighting or color of any sort.

I also can't use the vis lua module in my visrc.lua, which prevents me from doing any configuration.





rnpnr commented 8 months ago

Strange, lua usually gives you a line number and file name for where such a thing has occurred. Can you post the output of echo $VIS_PATH and also from the lua prompt (run lua) the output of print(package.path); print(package.cpath).

matt-152 commented 8 months ago


I'll also note that adding random garbage to my visrc.lua file will cause vis to return a proper stack trace as expected:

Screenshot 2023-10-27 at 4 29 12 PM
matt-152 commented 8 months ago

Another note - I went into my install directory and commented everything out of vis.lua, and this prevented the error from appearing.

Screenshot 2023-10-27 at 4 39 33 PM

I then uncommented vis.lua and commented everything in vis-std.lua, but this time the error appears:

Screenshot 2023-10-27 at 4 42 29 PM

I haven't yet tried this with the other required modules.

rnpnr commented 8 months ago

I don't think its an error in those files themselves since everyone else would also run into them. I'm sorry but I don't know the full details of how brew is installing things but I do notice that you have static lpeg available. Can you try doing ./configure --enable-static-lpeg=no; make. Maybe there is an issue when lpeg is statically linked but lua isn't (I have a completely static vis and everything is working on my end).

matt-152 commented 8 months ago

Running ./configure --enable-static-lpeg=no; make:

MB-Pro ~ % git clone https://github.com/martanne/vis.git
Cloning into 'vis'...
remote: Enumerating objects: 12939, done.
remote: Counting objects: 100% (1551/1551), done.
remote: Compressing objects: 100% (684/684), done.
remote: Total 12939 (delta 976), reused 1360 (delta 856), pack-reused 11388
Receiving objects: 100% (12939/12939), 5.51 MiB | 1.49 MiB/s, done.
Resolving deltas: 100% (8964/8964), done.
MB-Pro ~ % cd vis
MB-Pro vis % ./configure --enable-static-lpeg=no; make
checking for C compiler... cc
checking whether C compiler works... yes
checking whether compiler accepts -Werror=unknown-warning-option... yes
checking whether compiler accepts -Werror=unused-command-line-argument... yes
checking whether linker accepts -Werror=unknown-warning-option... yes
checking whether linker accepts -Werror=unused-command-line-argument... yes
checking whether compiler accepts -pipe... yes
checking whether compiler accepts -O2... yes
checking whether compiler accepts -ffunction-sections... yes
checking whether compiler accepts -fdata-sections... yes
checking whether linker accepts -Wl,--gc-sections... no
checking whether compiler accepts -fPIE... yes
checking whether compiler accepts -fstack-protector-all... yes
checking whether linker accepts -Wl,-z,now... no
checking whether linker accepts -Wl,-z,relro... no
checking whether linker accepts -pie... no
creating config.mk... done
checking for pkg-config... yes
checking for libcurses...
 checking for ncursesw... yes
checking for libtermkey... yes
checking for libtre... yes
checking for liblua >= 5.2 ...
 checking for lua... yes
checking for Lua statically linked liblpeg...
 checking for static lpeg... yes
checking for memrchr... no
completing config.mk... done
mkdir obj
touch obj/.tstamp
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=1 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/array.o -c array.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=1 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/buffer.o -c buffer.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=1 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/libutf.o -c libutf.c
cp config.def.h config.h
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=1 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/main.o -c main.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=1 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/map.o -c map.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=1 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/sam.o -c sam.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=1 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/text.o -c text.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=1 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/text-common.o -c text-common.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=1 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/text-io.o -c text-io.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=1 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/text-iterator.o -c text-iterator.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=1 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/text-motions.o -c text-motions.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=1 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/text-objects.o -c text-objects.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=1 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/text-util.o -c text-util.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=1 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/ui-terminal.o -c ui-terminal.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=1 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/view.o -c view.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=1 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/vis.o -c vis.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=1 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/vis-lua.o -c vis-lua.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=1 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/vis-marks.o -c vis-marks.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=1 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/vis-modes.o -c vis-modes.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=1 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/vis-motions.o -c vis-motions.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=1 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/vis-operators.o -c vis-operators.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=1 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/vis-prompt.o -c vis-prompt.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=1 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/vis-registers.o -c vis-registers.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=1 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/vis-text-objects.o -c vis-text-objects.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=1 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/vis-subprocess.o -c vis-subprocess.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=1 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/text-regex-tre.o -c text-regex-tre.c
cc -o vis obj/array.o obj/buffer.o obj/libutf.o obj/main.o obj/map.o obj/sam.o obj/text.o obj/text-common.o obj/text-io.o obj/text-iterator.o obj/text-motions.o obj/text-objects.o obj/text-util.o obj/ui-terminal.o obj/view.o obj/vis.o obj/vis-lua.o obj/vis-marks.o obj/vis-modes.o obj/vis-motions.o obj/vis-operators.o obj/vis-prompt.o obj/vis-registers.o obj/vis-text-objects.o obj/vis-subprocess.o obj/text-regex-tre.o   -L/usr/local/Cellar/libtermkey/0.22/lib -ltermkey -lncurses   -L/usr/local/Cellar/tre/0.8.0/lib -ltre -L/usr/local/lib -llua -lm -llpeg -lc
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\"  vis-menu.c  -lc   -o vis-menu
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\"  vis-digraph.c  -lc   -o vis-digraph
MB-Pro vis % ./vis

The same error occurs.

I do think you're right though in terms of it being related to lpeg - I played around with commenting things out some more and found that the error happens when require('lpeg') is run.

matt-152 commented 8 months ago

Note re the above: I ran brew uninstall vis and explicitly set VIS_PATH to the lua directory in the vis repo on my machine to make sure it wasn't using lua files from anywhere else in my system.

rnpnr commented 8 months ago

checking for static lpeg... yes ... -DCONFIG_LPEG=1 ...

Huh, maybe the configure script has some bug in that test. Can you manually set CONFIG_LPEG = 0 and clear the libs/cflags (CFLAGS_LPEG = and LDFLAGS_LPEG =) in config.mk.

matt-152 commented 8 months ago

That seems to have fixed the problem!

Edited config.mk (CFLAGS_LPEG was already clear):

MB-Pro vis % cat config.mk
# This version of config.mk was generated by:
# ./configure --enable-static-lpeg=no
# Any changes made here will be lost if configure is re-run
SRCDIR = .
PREFIX = /usr/local
EXEC_PREFIX = $(PREFIX)
BINDIR = $(EXEC_PREFIX)/bin
DOCPREFIX = $(PREFIX)/share/doc
MANPREFIX = $(PREFIX)/share/man
SHAREPREFIX = $(PREFIX)/share
CC = cc
CFLAGS = -pipe -O2 -ffunction-sections -fdata-sections -fPIE
LDFLAGS =
CFLAGS_STD = -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE
LDFLAGS_STD = -lc
CFLAGS_AUTO = -fstack-protector-all
LDFLAGS_AUTO =
CFLAGS_DEBUG = -U_FORTIFY_SOURCE -UNDEBUG -O0 -g3 -ggdb -Wall -Wextra -pedantic -Wno-missing-field-initializers -Wno-unused-parameter
CONFIG_HELP = 1
CFLAGS_TERMKEY = -I/usr/local/Cellar/libtermkey/0.22/include
LDFLAGS_TERMKEY = -L/usr/local/Cellar/libtermkey/0.22/lib -ltermkey
CONFIG_CURSES = 1
CFLAGS_CURSES =
LDFLAGS_CURSES = -lncurses
REGEX_SRC = text-regex-tre.c
CONFIG_TRE = 1
CFLAGS_TRE = -I/usr/local/Cellar/tre/0.8.0/include
LDFLAGS_TRE = -L/usr/local/Cellar/tre/0.8.0/lib -ltre
CONFIG_LUA = 1
CFLAGS_LUA = -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL
LDFLAGS_LUA = -L/usr/local/lib -llua -lm
CONFIG_LPEG = 0
CFLAGS_LPEG =
LDFLAGS_LPEG =
CONFIG_ACL = 0
CFLAGS_ACL =
LDFLAGS_ACL =
CONFIG_SELINUX = 0
CFLAGS_SELINUX =
LDFLAGS_SELINUX =
CFLAGS_LIBC = -DHAVE_MEMRCHR=0

Then built again:

MB-Pro vis % make
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=0 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/array.o -c array.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=0 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/buffer.o -c buffer.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=0 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/libutf.o -c libutf.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=0 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/main.o -c main.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=0 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/map.o -c map.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=0 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/sam.o -c sam.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=0 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/text.o -c text.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=0 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/text-common.o -c text-common.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=0 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/text-io.o -c text-io.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=0 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/text-iterator.o -c text-iterator.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=0 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/text-motions.o -c text-motions.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=0 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/text-objects.o -c text-objects.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=0 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/text-util.o -c text-util.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=0 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/ui-terminal.o -c ui-terminal.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=0 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/view.o -c view.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=0 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/vis.o -c vis.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=0 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/vis-lua.o -c vis-lua.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=0 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/vis-marks.o -c vis-marks.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=0 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/vis-modes.o -c vis-modes.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=0 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/vis-motions.o -c vis-motions.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=0 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/vis-operators.o -c vis-operators.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=0 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/vis-prompt.o -c vis-prompt.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=0 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/vis-registers.o -c vis-registers.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=0 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/vis-text-objects.o -c vis-text-objects.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=0 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/vis-subprocess.o -c vis-subprocess.c
cc -pipe -O2 -ffunction-sections -fdata-sections -fPIE -fstack-protector-all -I/usr/local/Cellar/libtermkey/0.22/include    -I/usr/local/Cellar/tre/0.8.0/include -I/usr/local/include/lua -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_3 -DLUA_COMPAT_ALL  -std=c99 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD -D_DARWIN_C_SOURCE -DVERSION=\"v0.7-142-g18c72a1\" -DHAVE_MEMRCHR=0 -DVIS_PATH=\"/usr/local/share/vis\" -DCONFIG_HELP=1 -DCONFIG_CURSES=1 -DCONFIG_LUA=1 -DCONFIG_LPEG=0 -DCONFIG_TRE=1 -DCONFIG_SELINUX=0 -DCONFIG_ACL=0  -o obj/text-regex-tre.o -c text-regex-tre.c
cc -o vis obj/array.o obj/buffer.o obj/libutf.o obj/main.o obj/map.o obj/sam.o obj/text.o obj/text-common.o obj/text-io.o obj/text-iterator.o obj/text-motions.o obj/text-objects.o obj/text-util.o obj/ui-terminal.o obj/view.o obj/vis.o obj/vis-lua.o obj/vis-marks.o obj/vis-modes.o obj/vis-motions.o obj/vis-operators.o obj/vis-prompt.o obj/vis-registers.o obj/vis-text-objects.o obj/vis-subprocess.o obj/text-regex-tre.o   -L/usr/local/Cellar/libtermkey/0.22/lib -ltermkey -lncurses   -L/usr/local/Cellar/tre/0.8.0/lib -ltre -L/usr/local/lib -llua -lm  -lc
MB-Pro vis % ./vis

Then ran ./vis on a couple files. No errors and color seems to work:

Screenshot 2023-10-27 at 5 38 03 PM

So to sum up, the reason I was running into this error was because my installation of lua can't use the static version of lpeg, which vis will try to use by default?

And it can be fixed by passing --enable-static-lpeg=no to configure when building vis, which makes it not use static lpeg (once that bug in the config script is fixed).

As for the homebrew package, I'll need to reach out to the maintainer of that package if I want vis to work when using brew install, correct?

rnpnr commented 8 months ago

Yes, there is likely a bug in the configure script that doesn't allow you to disable static lpeg if it is found. Additionally it is possible that if lpeg is statically linked into vis then lua must also be statically linked for it to be usable. That will need some more testing to confirm.

I'm adding the help-wanted tag since these should both be easy for someone else to fix/confirm if I don't get to it soon.

matt-152 commented 8 months ago

I found out what the issue was with the configure script not disabling static lpeg - turned out to have been a simple typo in the command.

The argument should have been --enable-lpeg-static=no instead of --enable-static-lpeg=no

From configure:

146 --enable-lpeg-static|--enable-lpeg-static=yes) lpeg=yes ;;
147 --disable-lpeg-static|--enable-lpeg-static=no) lpeg=no ;;

And running ./configure with this corrected argument confirms it

Incorrect: ./configure --enable-static-lpeg=no

checking for C compiler... cc
checking whether C compiler works... yes
checking whether compiler accepts -Werror=unknown-warning-option... yes
checking whether compiler accepts -Werror=unused-command-line-argument... yes
checking whether linker accepts -Werror=unknown-warning-option... yes
checking whether linker accepts -Werror=unused-command-line-argument... yes
checking whether compiler accepts -pipe... yes
checking whether compiler accepts -O2... yes
checking whether compiler accepts -ffunction-sections... yes
checking whether compiler accepts -fdata-sections... yes
checking whether linker accepts -Wl,--gc-sections... no
checking whether compiler accepts -fPIE... yes
checking whether compiler accepts -fstack-protector-all... yes
checking whether linker accepts -Wl,-z,now... no
checking whether linker accepts -Wl,-z,relro... no
checking whether linker accepts -pie... no
creating config.mk... done
checking for pkg-config... yes
checking for libcurses...
 checking for ncursesw... yes
checking for libtermkey... yes
checking for libtre... yes
checking for liblua >= 5.2 ...
 checking for lua... yes
checking for Lua statically linked liblpeg...
 checking for static lpeg... yes
checking for memrchr... no
completing config.mk... done

Correct: ./configure --enable-lpeg-static=no

checking for C compiler... cc
checking whether C compiler works... yes
checking whether compiler accepts -Werror=unknown-warning-option... yes
checking whether compiler accepts -Werror=unused-command-line-argument... yes
checking whether linker accepts -Werror=unknown-warning-option... yes
checking whether linker accepts -Werror=unused-command-line-argument... yes
checking whether compiler accepts -pipe... yes
checking whether compiler accepts -O2... yes
checking whether compiler accepts -ffunction-sections... yes
checking whether compiler accepts -fdata-sections... yes
checking whether linker accepts -Wl,--gc-sections... no
checking whether compiler accepts -fPIE... yes
checking whether compiler accepts -fstack-protector-all... yes
checking whether linker accepts -Wl,-z,now... no
checking whether linker accepts -Wl,-z,relro... no
checking whether linker accepts -pie... no
creating config.mk... done
checking for pkg-config... yes
checking for libcurses...
 checking for ncursesw... yes
checking for libtermkey... yes
checking for libtre... yes
checking for liblua >= 5.2 ...
 checking for lua... yes
checking for memrchr... no
completing config.mk... done
mcepl commented 6 months ago

I found out what the issue was with the configure script not disabling static lpeg - turned out to have been a simple typo in the command.

I am not sure I understand correctly: are you saying that this issue is in the end a PEBKAC and it could be closed?

matt-152 commented 6 months ago

Not quite, the primary issue is that using static lpeg on my machine causes the error I described in my original post.

The “help-wanted” tag was added so that someone could check if this happens when trying to use static lpeg when lua is not statically linked.

rnpnr commented 6 months ago

The “help-wanted” tag was added so that someone could check if this happens when trying to use static lpeg when lua is not statically linked.

I just tried this and it works fine. You just need to make sure that lpeg was built against the same version of lua that you are linking against vis. Doing this defeats the purpose of a static library but this isn't vis' problem.

matt-152 commented 6 months ago

Ok, sounds good. Thank you for your help.

For anyone else running into the same issue, I was able to workaround it in homebrew using the following procedure:

  1. Run brew install vis to make sure vis is installed via homebrew
  2. Run brew edit vis to pull up the formula in your current $EDITOR
  3. Make the following edit to line 31 (as of 2023-12-04): Before: system "./configure", "--prefix=#{prefix}", "--enable-lua" After: system "./configure", "--prefix=#{prefix}", "--enable-lua", "--enable-lpeg-static=no"
  4. Save your changes
  5. Run export HOMEBREW_NO_INSTALL_FROM_API=1 to ensure brew uses the edited formula.
  6. Run brew reinstall -s vis to reinstall vis, building it from source and applying the new ./configure option

I thought I could submit a PR to add an option to the formula to disable static lpeg, but options aren't allowed in homebrew-core formulas: https://docs.brew.sh/Formula-Cookbook#adding-optional-steps

It would have to be a change to the default ./configure options. Unless everyone installing vis using brew is encountering this issue, that would probably do more harm than good.

UWUnc0 commented 6 months ago

Seems to work when building from source by just running ./configure --enable-lpeg-static=no && make. Maybe the two others flags present by default within the Brew formula are broken?

matt-152 commented 6 months ago

I don't think so - on my system, the only thing that matters is whether the --enable-lpeg-static=no flag is passed to configure. Running ./configure by itself causes the error to appear for me, when building from source.