I've installed fennel and readline in my LuaRocks and fennel still won't recognize it. cdimara % luarocks list Rocks installed for Lua 5.3 --------------------------- fennel 0.6.0-1 (installed) - /usr/local/lib/luarocks/rocks-5.3 luafilesystem 1.7.0-2 (installed) - /usr/local/lib/luarocks/rocks-5.3 luaposix 34.1.1-1 (installed) - /usr/local/lib/luarocks/rocks-5.3 luasocket 3.0rc1-2 (installed) - /usr/local/lib/luarocks/rocks-5.3 readline 2.7-0 (installed) - /usr/local/lib/luarocks/rocks-5.3 vert 0.0.3-3 (installed) - /usr/local/lib/luarocks/rocks-5.3 cdimara % fennel Welcome to Fennel 0.6.0 on Lua 5.3! Use (doc something) to view documentation. Try installing readline via luarocks for a better repl experience. Any ideas on what might be happening. I'm on a Mac. Installed Lua via homebrew. Everything else came in through LuaRocks.
On Tue, Sep 8, 2020 at 5:44 PM Changa Damany Imara <firstname.lastname@example.org> wrote: > > I've installed fennel and readline in my LuaRocks and fennel still won't > recognize it. > .. > Any ideas on what might be happening. I'm on a Mac. Installed Lua via > homebrew. Everything else came in through LuaRocks. Thanks for bringing this up! On my (arch linux) system, a global luarocks install puts things in /usr/share/lua/5.x/readline.lua, which is also one of the paths Lua will automatically set on package.path when LUA_PATH is unset or contains ';;'. However, the default locations and where luarocks puts its global installs is likely somewhat system-dependent, and it sounds like on homebrew there may be a mismatch, in which case I should probably add a note to the setup guide.... The quickest solution, which will ensure that Lua and Fennel will be able to find all of the luarocks modules installed either globally or with `--local`, is to put the following into your shell's init file (.bashrc, .zshrc, etc): > eval $(luarocks path --bin) Just running that from the shell *should* make it work for you, at which point you can add it to your init script. Since luarocks already knows where it puts things, this will ensure it will be resolved automagically for you by ensuring LUA_PATH and LUA_CPATH env vars contain everything you need. You could, instead, simply set LUA_PATH and LUA_CPATH yourself, but in my experience it's easier to just let luarocks take care of its own locations. Another option would be to configure luarocks to put its global 5.3 module installs in the standard lua 5.3 folder, but that would be more invasive, and isn't something I've done before on MacOS. Outside of just running the REPL and seeing whether readline has loaded, you can easily test how a module is being resolved by doing the following from the REPL (at least in Fennel running on Lua 5.2+ or LuaJit) > (package.searchpath :readline package.path) > (package.searchpath :C-readline package.cpath) This will give you the resolved paths of readline.lua and C-readline.so when found, otherwise it will display nil followed by an error message with all the paths it tried (if you don't wanna see the big list of attempted paths, you can do `(pick-values 1 (package.searchpath :readline package.path))` to ignore the second return value). One other trick: this will print out your current package.path contents nice and readably: `(print (package.path:gsub ";" "\n")) Let me know if that helps! Also, for more interactive troubleshooting, feel free to join us in #Fennel on Matrix or #fennel on freenode ;-) -Jesse