Closed deepakjois closed 8 years ago
I've got the same output on Fedora, the problem is that it is incorrect, these directories doesn't exist here. Correct directories are listed with luarocks path
. Because we can't call arbitrary commands from luatex
without -shell-escape
option, it needs to be saved, which is done with make_paths
at install time.
The other problem is that luatex uses kpse
library for locating Lua files, we fix that in hb_lualoader.lua
and add loader which also search in package.path
and package.cpath
On Thu, Dec 24, 2015 at 3:45 PM, Michal Hoftich notifications@github.com wrote:
I've got the same output on Fedora, the problem is that it is incorrect, these directories doesn't exist here. Correct directories are listed with luarocks path. Because we can't call arbitrary commands from luatex without -shell-escape option, it needs to be saved, which is done with make_paths at install time.
I don’t understand when you say it is ‘incorrect’. Maybe on Fedora
things are different. But on the Mac for example, I can find
harfbuzz.lua in /usr/local/share/lua/5.2/
and luaharfbuzz.so in
/usr/local/lib/lua/5.2/
. These are the same paths that are set by
default, and also reported by luarocks path
.
The other problem is that luatex uses kpse library for locating Lua files, we fix that in hb_lualoader.lua and add loader which also search in package.path and package.cpath
Yes, I understand that part. I was just trying to find a way to avoid
the awkward make make_paths
step.
I don’t understand when you say it is ‘incorrect’. Maybe on Fedora things are different. But on the Mac for example, I can find harfbuzz.lua in
/usr/local/share/lua/5.2/
and luaharfbuzz.so in/usr/local/lib/lua/5.2/
. These are the same paths that are set by default, and also reported byluarocks path
.
it is incorrect in Fedora TeX Live. When I modify doc.lua
to run under normal Lua:
print("Initial package.path:"..package.path)
print("Initial package.cpath:"..package.cpath)
print("No. of searchers: "..#package.searchers)
then the output with lua
is:
Initial package.path:/usr/share/lua/5.2/?.lua;/usr/share/lua/5.2/?/init.lua;/usr/lib64 /lua/5.2/?.lua;/usr/lib64/lua/5.2/?/init.lua;./?.lua
Initial package.cpath:/usr/lib64/lua/5.2/?.so;/usr/lib64/lua/5.2/loadall.so;./?.so
No. of searchers: 4
and with luatex
:
Initial package.path:/usr/local/share/lua/5.2/?.lua;/usr/local/share/lua/5.2/?/init.lua;/usr/local/lib/lua/5.2/?.lua;/usr/local/lib/lua/5.2/?/init.lua;./?.lua
Initial package.cpath:/usr/local/lib/lua/5.2/?.so;/usr/local/lib/lua/5.2/loadall.so;./?.so
No. of searchers: 4
the problem is that directories /usr/local/share/lua/
and /usr/local/lib/lua/
don't exist, the correct values are these used in lua
. But even normal Lua paths aren't enough, as Luarocks
may use local directory in user's home dir. luarocks path
:
export LUA_PATH='/home/michal/.luarocks/share/lua/5.2/?.lua;/home/michal/.luarocks/share/lua/5.2/?/init.lua;/usr/share/lua/5.2/?.lua;/usr/share/lua/5.2/?/init.lua;/usr/lib64/lua/5.2/?.lua;/usr/lib64/lua/5.2/?/init.lua;./?.lua'
export LUA_CPATH='/home/michal/.luarocks/lib/lua/5.2/?.so;/usr/lib/lua/5.2/?.so;/usr/lib64/lua/5.2/?.so;/usr/lib64/lua/5.2/loadall.so;./?.so'
Ok, I understand now. Thanks. I will close the issue.
I am looking into the package searching mechanism in Lua and LuaTeX (See references below).
I have these two files:
doc.lua:
doc.tex:
The output that I get on OS X is:
So in short, the
package.path
andpackage.cpath
values are already set to the correct value. It seems we don’t need to do the awkward stepmake make_paths
and thenrequire 'hb_paths'
. We can just modify thepackage.searchers
table to use a custom loading function that uses the existingpackage.path
andpackage.cpath
.References: