Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The recommended luarocks invocation completely breaks SILE (on macOS?) #2215

Open
davidchisnall opened this issue Jan 15, 2025 · 6 comments
Open
Assignees
Labels
question Ask for advice or investigate solutions
Milestone

Comments

@davidchisnall
Copy link

If you use a package that does not exist, SILE tells you to first do:

      luarocks --lua-version 5.1 --tree lua_modules install {package}

This installs the package under lua_modules. So far so good.

It then tells you to:

      eval $(luarocks --lua-version 5.1 --tree lua_modules path)

This then sets LUA_PATH and LUA_CPATH, which overrides SILE's built-in paths and prevents it from finding things (the first error is for penlight, but then all of the other things SILE depends on).

It looks as if SILE forcibly preserves some paths. The error list includes things like:

	no file '/opt/homebrew/Cellar/sile/0.15.9/lib/sile/lua-libraries/pl/import_into.lua'
	no file '/opt/homebrew/Cellar/sile/0.15.9/lib/sile/lua-libraries/pl/import_into/init.lua'
	no file '/opt/homebrew/Cellar/sile/0.15.9/lib/sile/pl/import_into.lua'
	no file '/opt/homebrew/Cellar/sile/0.15.9/lib/sile/pl/import_into/init.lua'
	no file '/opt/homebrew/Cellar/sile/0.15.9/lib/sile/lua_modules/share/lua/5.1/sile/pl/import_into.lua'
	no file '/opt/homebrew/Cellar/sile/0.15.9/lib/sile/lua_modules/share/lua/5.1/sile/pl/import_into/init.lua'
	no file '/opt/homebrew/Cellar/sile/0.15.9/lib/sile/lua_modules/share/lua/5.1/pl/import_into.lua'
	no file '/opt/homebrew/Cellar/sile/0.15.9/lib/sile/lua_modules/share/lua/5.1/pl/import_into/init.lua'
	no file '/opt/homebrew/Cellar/sile/0.15.9/share/sile/lua-libraries/pl/import_into.lua'
	no file '/opt/homebrew/Cellar/sile/0.15.9/share/sile/lua-libraries/pl/import_into/init.lua'
	no file '/opt/homebrew/Cellar/sile/0.15.9/share/sile/pl/import_into.lua'
	no file '/opt/homebrew/Cellar/sile/0.15.9/share/sile/pl/import_into/init.lua'
	no file '/opt/homebrew/Cellar/sile/0.15.9/share/sile/lua_modules/share/lua/5.1/sile/pl/import_into.lua'
	no file '/opt/homebrew/Cellar/sile/0.15.9/share/sile/lua_modules/share/lua/5.1/sile/pl/import_into/init.lua'
	no file '/opt/homebrew/Cellar/sile/0.15.9/share/sile/lua_modules/share/lua/5.1/pl/import_into.lua'
	no file '/opt/homebrew/Cellar/sile/0.15.9/share/sile/lua_modules/share/lua/5.1/pl/import_into/init.lua'

But the SILE dependencies are installed under /opt/homebrew/Cellar/sile/0.15.9/libexec, so this doesn't work.

You can work around this by doing:

export LUA_PATH="${LUA_PATH};;"
export LUA_CPATH="${LUA_CPATH};;" 

This (from reading the comments in the SILE code) makes add (prepend) the environment variables to the default path, rather than replacing.

@alerque
Copy link
Member

alerque commented Jan 15, 2025

If you are installing Rocks to a project-local lua_modules tree, you shouldn't need that eval $(luarocks path) business at all, that one tree location is built in already.

That's not to say there isn't a real issue here, just a tip to maybe get you back to work fast while I try to make out what's up with the rest of this.

@davidchisnall
Copy link
Author

Ah, I had a stale invocation left over in that terminal. Okay, simply not running the second command seems to work well.

@alerque alerque added this to the v0.15.10 milestone Jan 17, 2025
@alerque alerque self-assigned this Jan 17, 2025
@Omikhleia Omikhleia added the question Ask for advice or investigate solutions label Feb 5, 2025
@Omikhleia
Copy link
Member

Reading the exchanges, I've added the "question" label, but honestly

  • Is there an issue? It's not clear.
  • Is there something actually being worked upon?

Please clarify the expectations ;)

@davidchisnall
Copy link
Author

davidchisnall commented Feb 6, 2025

Ideally, SILE would not tell you to run a command that breaks SILE if you run it. Especially when you get the correct behaviour by simply not running the command.

@alerque
Copy link
Member

alerque commented Feb 6, 2025

@davidchisnall That's kind of obvious. What isn't obvious is that the command is needed in some circumstances and we are not able to detect whether it will or won't be needed, so we just suggest it it all cases. What really needed fixing is that the command should either ⓐ fix the problem if necessary or ⓑ be a no-op for situations that didn't need the fix. It should not have broken anything in the first place, and that was an issue with Homebrew packaging. I'm addressing this from that end so that the fix either works or is a noop.

@davidchisnall
Copy link
Author

If I understood the rest of the thread:

  • If you follow the first command correctly, it installs things in the lua_rocks subdirectory of the current directory.
  • By default, SILE looks there for packages.
  • The second command is never needed if the first command was followed verbatim.
  • The second command is not correct if the first command was not followed verbatim because it replaces, rather than augmenting, the directories where SILE looks for Lua packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Ask for advice or investigate solutions
Projects
None yet
Development

No branches or pull requests

3 participants