问题描述
我在github上使用了Torch Distro存储库,并安装了LuaJIT和luarocks.
I used torch distro repository on github and installed LuaJIT and luarocks.
我想从源代码安装luarocks软件包,即下载软件包(.zip文件)并从源代码构建它们.
I want to install luarocks packages , from source, that is downloading the packages(.zip files) and building them from source .
我尝试通过从github下载软件包,然后运行luarocks install modulename.rockspec来做到这一点.但是在这里,它再次开始从github克隆.
I tried doing it by downloading the packages from github and then running luarocks install modulename.rockspec . But here it again starts cloning from github.
有人可以告诉我执行此操作的确切程序吗?
Can anyone tell me the exact procedure to do this ?
推荐答案
您可以使用源岩或二元岩.
源代码岩石是具有.src.rock
扩展名的包,其中包含源代码.您创建它包装了一个rockspec:
A source rock is a package with .src.rock
extension containing the sources. You create it packing a rockspec:
luarocks pack bla-1.0-1.rockspec # uses the network
这将产生bla-1.0-1.src.rock.运行luarocks build bla-1.0-1.src.rock
不会使用网络来构建bla
,但是如果需要,它将运行网络以获取依赖项.因此,您需要预先打包并安装所有依赖项.
This produces bla-1.0-1.src.rock. Running luarocks build bla-1.0-1.src.rock
does not use the network to build bla
, but it will hit the network to fetch dependencies if needed. So you need to pack and install all dependencies beforehand.
二进制岩石是具有.PLATFORM.rock
扩展名的已编译软件包,其中包含.lua或.so/.dll模块.您创建它以构建一个模块,然后打包您构建的代码:
A binary rock is a compiled package with .PLATFORM.rock
extension containing the .lua or .so/.dll modules. You create it building a module and then packing the code you built:
luarocks build bla-1.0-1.rockspec # uses the network
luarocks pack bla # doesn't use the network
这将产生一个二进制岩石,例如bla-1.0-1.linux-x86.rock
.但是请注意,要将其安装在另一台计算机上,目标计算机必须与ABI完全兼容,也就是说,源计算机和目标计算机中所有已安装的库都必须兼容(例如,相同的OS/发行版).因此,这对于将岩石部署到服务器场中的多台机器很有用,但对于一般而言不为最终用户分发二进制包.
This produces a binary rock, say bla-1.0-1.linux-x86.rock
. Note however that to install this in another machine, the target machine needs to be fully ABI-compatible, that is, all installed libraries in the source and destination machine need to be compatible (e.g. same OS/distro version). For this reason, this is useful for deploying rocks to multiple machines in a farm, but not for distributing binary packages for end-users in general.
使用上述方法之一打包所有需要的岩石(及其依赖项)后,您可以将它们全部放在一个目录中,然后将其转换为本地服务器":
Once you pack all rocks you need (and their dependencies) using one of the methods above, you can put them all in a directory, then turn it into a "local server":
mkdir my_rocks
mv *.rock my_rocks # suppose we have some packed .rock files here
cd my_rocks
luarocks-admin make-manifest my_rocks
这适用于源岩和二元岩.这样一来,您就可以从那里建造岩石而无需获取网络.
This works with both source and binary rocks. You'll then be able to build rocks from there without fetching the network.
luarocks install bla --only-server=/home/YOURNAME/my_rocks
这篇关于如何在没有互联网的情况下安装luarocks软件包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!