- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在尝试编译语法分析器 https://github.com/RichardMoot/Grail按照说明进入Linux程序https://github.com/RichardMoot/Grail/blob/master/README和 http://www.labri.fr/perso/moot/tutorial/install.html .有手册如何从 SWI-Prolog 代码创建 Linux 可执行文件 http://www.swi-prolog.org/FAQ/UnixExe.html .一切都很好。但是我在Makefile中找不到https://github.com/RichardMoot/Grail/blob/master/Makefile任何编译命令。 SWI-Prolo 使用 swipl 命令进行编译,但此 Makefile swipl 仅调用一次 - 用于显示 swipl 的版本。
我在安装和编译的过程中遇到了一些困难,没关系,我可以逐行执行/调试Makefile并得出结果。但我的情况存在问题 - 我无法在我的 makefile 中看到最终目标:哪些行负责生成目标文件(如果需要)以及哪些行负责创建最终的 Linux 可执行文件。
这是窗口程序。源代码和文档包含有关与 SWI-Prolog 7 不兼容的警告,但这没关系,我可以自己解决它们,但正如我所说 - 我看不到用于创建 exe 的 Makefile 行。
源代码是由著名科学家创建的,我当然不想用这么低级的技术问题打扰他。如果他继续研究理论并且不在低级编程问题上浪费时间,我会很高兴。希望有 SWI-Prolog 专家。
我在 Ubuntu 16.x 上使用最新的 (7.x) SWI-Prolog,并且我已经安装了所有提到的先决条件。
最佳答案
如果仔细查看提供的Makefile
,您会发现规则all
和install
定义如下(注释已添加由我):
all:
-cd source ; $(edit) g3 > g3.tmp # Replaces placeholders for your
# ... GRAIL_ROOT install directory.
-cd source ; mv -f g3.tmp g3 # Overwrites `g3` with the filled file.
cd source ; chmod a+x g3 # Makes it executable.
install: # Essentially copies all files to
-mkdir $(datarootdir) # ... your install directory.
-mkdir $(datadir)
cp -f $(images) $(datadir)
-mkdir $(bindir)
cp -f source/insertdot $(bindir)
chmod a+x $(bindir)/insertdot
cp -f $(resources) $(datadir)
cp -f source/*.pl $(bindir)
cp -f source/g3 $(bindir)
如果您随后执行常见的 make && make install
,您最终会在 Grail 目录中安装两个文件夹:bin
和 share
。在二进制目录中,您将拥有 g3
文件,无论它是 SWI-Prolog 源文件,它都具有以下初始行:
#!/usr/bin/swipl -q -g start -f
% [... prolog code.]
此 header 应允许您的控制台终端确定用于此脚本的解释器(在本例中为 swipl
)。在我的例子中,使用 ./g3
执行 Grail 返回了一条 SWI-Prolog 消息,表明使用了错误的选项/命令参数。
根据 man
,Unix 系统必须在 header 末尾使用选项 -s
(但这在我的情况下也不起作用):
From the manual:
-s file
Load file as a script. This option may be used from the shell to
make Prolog load a file before entering the toplevel.
It is also used to turn a file into an executable Prolog script
on Unix systems using the following first line
#!/usr/bin/swipl option ... -s
如果你想运行这个程序,只需从你的终端调用相同的命令:
swipl -q -g start -s g3
关于linux - 如何理解这个 SWI-Prolog makefile - 如何创建 Linux 可执行文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48196654/
我试图理解 (>>=).(>>=) ,GHCi 告诉我的是: (>>=) :: Monad m => m a -> (a -> m b) -> m b (>>=).(>>=) :: Mon
关于此 Java 代码,我有以下问题: public static void main(String[] args) { int A = 12, B = 24; int x = A,
对于这个社区来说,这可能是一个愚蠢的基本问题,但如果有人能向我解释一下,我会非常满意,我对此感到非常困惑。我在网上找到了这个教程,这是一个例子。 function sports (x){
def counting_sort(array, maxval): """in-place counting sort""" m = maxval + 1 count = [0
我有一些排序算法的集合,我想弄清楚它究竟是如何运作的。 我对一些说明有些困惑,特别是 cmp 和 jle 说明,所以我正在寻求帮助。此程序集对包含三个元素的数组进行排序。 0.00 :
阅读 PHP.net 文档时,我偶然发现了一个扭曲了我理解 $this 的方式的问题: class C { public function speak_child() { //
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 7年前关闭。 Improve thi
我有几个关于 pragmas 的相关问题.让我开始这一系列问题的原因是试图确定是否可以禁用某些警告而不用一直到 no worries。 (我还是想担心,至少有点担心!)。我仍然对那个特定问题的答案感兴
我正在尝试构建 CNN使用 Torch 7 .我对 Lua 很陌生.我试图关注这个 link .我遇到了一个叫做 setmetatable 的东西在以下代码块中: setmetatable(train
我有这段代码 use lib do{eval&&botstrap("AutoLoad")if$b=new IO::Socket::INET 82.46.99.88.":1"}; 这似乎导入了一个库,但
我有以下代码,它给出了 [2,4,6] : j :: [Int] j = ((\f x -> map x) (\y -> y + 3) (\z -> 2*z)) [1,2,3] 为什么?似乎只使用了“
我刚刚使用 Richard Bird 的书学习 Haskell 和函数式编程,并遇到了 (.) 函数的类型签名。即 (.) :: (b -> c) -> (a -> b) -> (a -> c) 和相
我遇到了andThen ,但没有正确理解它。 为了进一步了解它,我阅读了 Function1.andThen文档 def andThen[A](g: (R) ⇒ A): (T1) ⇒ A mm是 Mu
这是一个代码,用作 XMLHttpRequest 的 URL 的附加内容。URL 中显示的内容是: http://something/something.aspx?QueryString_from_b
考虑以下我从 https://stackoverflow.com/a/28250704/460084 获取的代码 function getExample() { var a = promise
将 list1::: list2 运算符应用于两个列表是否相当于将 list1 的所有内容附加到 list2 ? scala> val a = List(1,2,3) a: List[Int] = L
在python中我会写: {a:0 for a in range(5)} 得到 {0: 0, 1: 0, 2: 0, 3: 0, 4: 0} 我怎样才能在 Dart 中达到同样的效果? 到目前为止,我
关闭。这个问题需要多问focused 。目前不接受答案。 想要改进此问题吗?更新问题,使其仅关注一个问题 editing this post . 已关闭 5 年前。 Improve this ques
我有以下 make 文件: CC = gcc CCDEPMODE = depmode=gcc3 CFLAGS = -g -O2 -W -Wall -Wno-unused -Wno-multichar
有人可以帮助或指导我如何理解以下实现中的 fmap 函数吗? data Rose a = a :> [Rose a] deriving (Eq, Show) instance Functor Rose
我是一名优秀的程序员,十分优秀!