Installing "markdown.sile" on WSL
celtic-coder opened this issue · 2 comments
Hi Didier (@Omikhleia),
In the past few days, I've been working on installing both the SILE Typesetter and "markdown.sile" in the Windows Subsystem for Linux (WSL). Through trial and error, I was finally able to get it installed in Ubuntu by working through the following steps. I would be interested to know if I just got it working by accident, or might there be a better way of doing this?
In Section 2.7 of the SILE manual (Installing third-party packages), it mentions checking the version of Lua that SILE uses, so that Luarocks will install the correct version. Since I wanted to install locally, I used:
luarocks --lua-version 5.2 install --dev markdown.sile
However, there were problems downloading the "rockspec" file, so I did it manually using:
wget https://luarocks.org/dev/markdown.sile-dev-1.rockspec
I then tried this command, but it gave an error about Lua header files:
luarocks install --dev --local markdown.sile-dev-1.rockspec
Cloning into 'markdown.sile'...
remote: Enumerating objects: 722, done.
remote: Counting objects: 100% (211/211), done.
remote: Compressing objects: 100% (119/119), done.
remote: Total 722 (delta 106), reused 175 (delta 88), pack-reused 511
Receiving objects: 100% (722/722), 527.47 KiB | 2.14 MiB/s, done.
Resolving deltas: 100% (364/364), done.
Error: Failed finding Lua header files. You may need to install them or configure LUA_INCDIR.
The article Error: Failed finding Lua header files. You may need to install them or configure LUA_INCDIR. - Windows 10 with Lua distribution, mentioned that Luarocks could not find "lua.h", "lualib.h" and other related files.
To find these on my system, I installed locate (sudo apt install locate -y
) and updated the database (sudo updatedb --prunepaths='/mnt'
) and then updated the LUA_INCDIR as follows:
luarocks-5.2 config variables.LUA_INCDIR /usr/include/lua5.1 --local
However, the installation still failed. Running the Luarocks command by itself (luarocks
) to get the configuration information, was showing the same error for the "include" directory, even though the folder existed and "lua.h" was present:
LUA_INCDIR : (not found)
I installed Lua 5.2 (sudo apt install lua5.2
), but this did not create any further "include" folders. The article Lua 5.3 is installed, but I can't locate the correct lua.h, however, gave a pointer in the correct direction.
I installed liblua5.2-dev and updated the "locate" database:
sudo apt install liblua5.2-dev
sudo updatedb --prunepaths='/mnt'
and then checked for further "include" folders:
locate include | grep lua
This gave the following:
/usr/include/lua5.1
/usr/include/lua5.1/lauxlib.h
/usr/include/lua5.1/lua.h
....
/usr/include/lua5.2
/usr/include/lua5.2/lauxlib.h
/usr/include/lua5.2/lua.h
....
Updating the LUA_INCDIR (luarocks config variables.LUA_INCDIR "/usr/include/lua5.2" --local
) gave the following configuration, with the "include" directory finally being recognised:
Lua:
Version : 5.2
Interpreter: /usr/bin/lua5.2 (ok)
LUA_DIR : /usr (ok)
LUA_BINDIR : /usr/bin (ok)
LUA_INCDIR : /usr/include/lua5.2 (ok)
LUA_LIBDIR : /usr/lib/x86_64-linux-gnu (ok)
This allowed the installation to work correctly (luarocks-5.2 install --dev --local markdown.sile-dev-1.rockspec
):
Cloning into 'markdown.sile'...
remote: Enumerating objects: 722, done.
remote: Counting objects: 100% (211/211), done.
remote: Compressing objects: 100% (119/119), done.
remote: Total 722 (delta 106), reused 175 (delta 88), pack-reused 511
Receiving objects: 100% (722/722), 527.47 KiB | 1.70 MiB/s, done.
Resolving deltas: 100% (364/364), done.
Missing dependencies for markdown.sile dev-1:
embedders.sile (not installed)
labelrefs.sile (not installed)
ptable.sile (not installed)
smartquotes.sile (not installed)
textsubsuper.sile (not installed)
markdown.sile dev-1 depends on lua >= 5.1 (5.2-1 provided by VM)
markdown.sile dev-1 depends on embedders.sile (not installed)
Installing https://luarocks.org/dev/embedders.sile-dev-1.rockspec
....
....
markdown.sile dev-1 depends on textsubsuper.sile (not installed)
Installing https://luarocks.org/dev/textsubsuper.sile-dev-1.rockspec
Cloning into 'textsubsuper.sile'...
remote: Enumerating objects: 56, done.
remote: Counting objects: 100% (56/56), done.
remote: Compressing objects: 100% (32/32), done.
remote: Total 56 (delta 23), reused 42 (delta 15), pack-reused 0
Receiving objects: 100% (56/56), 47.15 KiB | 928.00 KiB/s, done.
Resolving deltas: 100% (23/23), done.
textsubsuper.sile dev-1 depends on lua >= 5.1 (5.2-1 provided by VM)
textsubsuper.sile dev-1 is now installed in /home/<user>/.luarocks (license: MIT)
markdown.sile dev-1 is now installed in /home/<user>/.luarocks (license: MIT)
As I said, this was trial-and-error over several days. I wasn't always consistent with the commands and the Lua versions that I used, so I may have been giving myself extra work to get it installed locally.
Some final questions: might there have been some checks that I could have run earlier to find out what was missing? Since I am not familiar with the dependencies between Lua versions, or much about the Lua ecosystem, are there some assumptions that needed to be corrected?
Kind Regards,
Liam
Greetings @celtic-coder
I'm afraid I cannot help much here and that it goes beyond what I can do here. I don't have a Windows 10 machine to tinker with WSL, but I once had something similar though (i.e. complaints on missing files) on a regular native Ubuntu system which had Lua 5.2 installed, but an older version of luarocks that was only looking for Lua 5.1... I think I upgraded the system and rebuilt_ luarocks by myself to get it working, though I can't recollect my exact steps... I've no idea why there was such a discrepancy in the first place.
Hi Didier (@Omikhleia),
You have put a huge amount of work into the SILE packages. I was not expecting that you would put any extra work into trying to sort out a particular WSL or Ubuntu problem. I was just hoping that you might have come across something like this in the past, and that you could share from your expertise.
In any case, it was a good learning experience for me. Both personally and professionally, my main platform has been Windows, with occasional stints on Linux. I had expectations that everything would work "out of the box", and so trying to figure out the "development" environment was useful.
Yes, there seems to be a problem involving the version of "luarocks" in combination with the default Lua installation on the vanilla Ubuntu provided on WSL. Thankfully, I didn't have to rebuild "luarocks" like you did, but I at least now have a complete installation of "markdown.sile".
In any case, I trust that what I have written might help some other user who may have a problem with WSL.
Thanks for your help! I am going to close this issue.
Kind Regards,
Liam