[OpenWrt-Devel] [PATCH 0/1] libubox installs incorrectly on Ubuntu due to incorrect LUAPATH

Sergey Ponomarev stokito at gmail.com
Thu Nov 29 10:20:07 EST 2018


I'm working on porting openwrt utils like UCI and UHTTPD to Ubuntu and trying to create a PPA.
During creation of a debian package for libubox it's build failed with:
    dh_install: Cannot find (any matches for) "/usr/lib/x86_64-linux-gnu/lua/5.1/uloop.so" (tried in ., debian/tmp)
After investigation it turned out that LUAPATH variable was evaluated as /usr/local/lib/lua/5.1 while correct path is /usr/lib/x86_64-linux-gnu/lua/5.1.
The LUAPATH is evaluated by the command:
    $ lua -e "for k in string.gmatch(package.cpath .. \";\", \"([^;]+)/..so;\") do if k:sub(1,1) == \"/\" then print(k) break end end"
So it looks for array package.cpath and gets a first line which starts with / (this is why k:sub(1,1) == \"/\").
To see all pathes let's change the command a little bit:
    $ lua -e "for k in string.gmatch(package.cpath .. \";\", \"([^;]+)/..so;\") do print(k) end"
    .
    /usr/local/lib/lua/5.1
    /usr/lib/x86_64-linux-gnu/lua/5.1
    /usr/lib/lua/5.1
So on Ubuntu 18.10 and maybe in other distros the LUAPATH variable will receive the /usr/local/lib/lua/5.1 as first path.
To fix that all what we need to do is just to get path which starts with not just / but with /usr/lib/ i.e.
    $ lua -e "for k in string.gmatch(package.cpath .. \";\", \"([^;]+)/..so;\") do if k:sub(1,9) == \"/usr/lib/\" then print(k) break end end"
So this parch is intended to fix that.
Also the similar pathes needed for UCI and UBUS but I'll send them separately if you accept this patch. Also you can that yourself.

Sergey Ponomarev (1):
  libubox/lua/CMakeLists.txt: fix LUAPATH so it will use /usr/lib/
    instead of /usr/local/lib/

 lua/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.19.1


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list