没有规则来生成“Makefile”所需的目标“/Makefile”;
我正在尝试使用一个非常简单的 makefile 来“制作”。我的 makefile 名为“Makefile”,因此我只需使用命令“make”。
我收到这个奇怪的错误:
<代码> make: *** 没有规则来制作“Makefile”所需的目标“/Makefile”。停止。
但是,如果我使用 make -f "full-path-to-makefile"
它实际上确实运行了(产生了奇怪的后果......)。当然,我应该说我是从 Makefile 所在的目录运行所有这些。
我正在 Mac OSX 上工作,使用 tcsh。
编辑:
我正在 LLVM 框架中工作,尝试编译一个 pass 函数,这是相关的 makefile:
LEVEL = ../../../ LIBRARYNAME = FunctionName LOADABLE_MODULE = 1 include $(LEVEL)/Makefile.common
任何想法将不胜感激:)
I'm trying to 'make' using a pretty simple makefile. My makefile is named 'Makefile' so I'm simply using the command 'make'.
I get this strange error:
make: *** No rule to make target `/Makefile', needed by `Makefile'. Stop.
If, however, I usemake -f "full-path-to-makefile"
it actually does run (with odd consequences...). I should say that I'm running all this from the directory where the Makefile lies, of course.
I'm working on Mac OSX, using tcsh.
Edit:
I'm working in the LLVM framework, trying to compile a pass function and this is the associated makefile:
LEVEL = ../../../ LIBRARYNAME = FunctionName LOADABLE_MODULE = 1 include $(LEVEL)/Makefile.common
Any ideas will be appreciated :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
我在尝试为 LLVM 编写新的 pass 时遇到了同样的问题,我按照这些说明尝试制作 HelloB (因为 Hello 已经存在) http://llvm.org/docs/WritingAnLLVMPass.html#quickstart
我要做的就是再次执行./configure,然后从基本目录进行制作。
I had the same problem trying to write a new pass for LLVM i followed these instructions trying to make a HelloB (as Hello already exsited) http://llvm.org/docs/WritingAnLLVMPass.html#quickstart
What i has to do was do a ./configure again then make from the base directory.
我会冒险:你有一个额外的斜线。尝试省略 $(LEVEL) 中的最后一个斜杠。
I'll go out on a limb: you have an extra slash. Try omitting the final slash in $(LEVEL).
我找到了答案,有点:
问题出在 LLVM 的安装过程上。似乎如果您按照一种顺序而不是另一种顺序进行安装,则可能会导致此错误。这对我来说没有任何意义,但是在我正确安装它之后,一切都编译得很好(相同的代码,相同的 Makefile,相同的 make 程序)。
我真的不知道为什么会发生这种情况,但我知道如何解决它:)
你想要做的是再次./configure,然后从基本目录进行制作(与中所述相反)网站上的说明)。这对我有用。
顺便说一句 - 我在 Ubuntu 上运行得到了相同的结果(具有相同的修复)。
I found the answer, sort of:
The problem was with the installation process of LLVM. It seems that if you do the installation in one order instead of another it can lead to this error. It doesn't make any sense to me, but after I installed it properly everything compiles great (same code, same Makefile, same make program).
I don't really know why this happened, but I know how to fix it :)
What you want to do is ./configure again then make from the base directory (contrary to what is stated in the instructions on the web-site). That worked for me.
BTW - I got the same results running on Ubuntu (with the same fix).
只是为了在此处添加一些信息(因为这是在查找错误时在 Google 上出现的第一个结果) - 我遇到了同样的问题,该问题突然出现在 OSX 上的(以前工作的)LLVM 设置上,并将其追溯到make 中 realpath 命令的行为。
具体来说,发生的情况是我有一个名为“LLVM/llvm-2.9-build”的目录,但由于某种原因,尝试解析 Makefile.config 顶部的 PROJECT_OBJ_ROOT 将决定该目录实际上称为“llvm/ llvm-2.9-build”。由于 OSX 默认情况下不区分大小写,因此这不会立即导致问题,只是随后 LLVM_SRC_ROOT 将设置为“LLVM/llvm-2.9-build”。这意味着使用 patsubst 创建 PROJ_SRC_DIR 来替换对象目录将导致路径不存在(因为不匹配的情况意味着不会发生模式替换),而实际路径又将被解析为 / 。
将 PROJ_SRC_DIR 设置为 / 时,这会导致 Makefile.rules 中的 makefile 复制规则决定源 makefile 位于 $(PROJ_SRC_DIR)/Makefile(即 /Makefile),并显示错误消息。
似乎只有 Make 中的 realpath 内置实现(我的例子中是 GNU Make 3.81)具有此行为,因为强制使用 Makefile.config 顶部的 realpath 宏版本可以解决该问题。然而,这并不是一个好的长期修复方法,因为您必须手动修补每个 LLVM makefile。
最后,我看不到 realpath 会从哪里获取小写的“llvm”,但我认为这可能是从我引用目录的时间点开始对名称进行某种缓存的产物它的小写名称。因此,我尝试进入该目录并将其 mv-ing 为一个完全不同的名称,然后返回“LLVM”,然后再进入并再次构建,这似乎已经解决了问题。
我希望这对遇到这种特殊奇怪现象的其他人有所帮助!
Just to add some information here (since this is the first hit that comes up on Google when looking for the error) - I had the same problem which suddenly popped up on a (previously working) LLVM setup on OSX, and traced it back to the behavior of the realpath command in make.
Specifically, what was happening was that I had a directory called "LLVM/llvm-2.9-build", but for some reason the attempt to resolve PROJECT_OBJ_ROOT at the top of Makefile.config would decide that this directory was in fact called "llvm/llvm-2.9-build". Since OSX is case-insensitive by default, this doesn't cause an immediate problem, except that subsequently LLVM_SRC_ROOT would be set to "LLVM/llvm-2.9-build". This then meant that the creation of PROJ_SRC_DIR using patsubst to replace the object directory would result in a non-existent path (as the unmatched case means that no pattern replace occurs), which in turn would get resolved to / by realpath.
With PROJ_SRC_DIR set to /, this results in the makefile copy rule in Makefile.rules deciding that the source makefile is at $(PROJ_SRC_DIR)/Makefile (ie /Makefile), and the error message described.
It seems that it is only the built-in implementation of realpath in Make (GNU Make 3.81 in my case) that has this behaviour, as forcibly using the macro version of realpath from the top of Makefile.config fixes the problem. However, this isn't a good long-term fix, as you'd have to manually patch every one of the LLVM makefiles.
In the end, I couldn't see where realpath would be getting the lower-case "llvm" from, but figured it was probably an artifact somehow of some caching of the name from a point in time when I'd referenced the directory using its lower-case name. Hence I tried going to that directory and mv-ing it to a completely different name, and then back to "LLVM" before going in and building again, and that seems to have solved the problem.
I hope that's of some use to anyone else who comes across this particular weirdness!
这不是一个完整的答案,但您看到的是 gmake 找不到它被告知要包含的 Makefile,因此它试图重新制作它并失败,因为它也找不到它的配方。
但是,您发布的 Makefile 片段不会产生您所看到的错误消息,因此我认为问题出在 Makefile.common 文件内。查找引用 $(某些变量扩展)/Makefile 的 include 语句并从那里向后工作。您还可以尝试使用 -d 选项运行 gmake 并根据输出进行处理。
It's not a complete answer, but what you are seeing is gmake not finding the Makefile it is told to include, and thus it is trying to remake it and failing because it can't find a recipe for it either.
However, the Makefile snippet you posted does not produce the error message you are seeing, so I think the problem is inside the Makefile.common file. Look for include statements which reference a $(some variable expansion)/Makefile and work backwards from there. You can also try to run gmake with the -d option and follow the processing based on the output.
由于您的包含行内容如下:
令人困惑的是您没有收到有关
/Makefile.common
的错误。如果是的话,那么我建议您在 LEVEL 定义之后可能有一个尾随空白。Makefile.common 中是否有一行本身包含 $(SOMEMACRO)/Makefile 并且您尚未设置 SOMEMACRO 的值?
Since your include line reads:
it is puzzling that you are not getting an error about
/Makefile.common
. If you were, then I'd suggest that maybe you have a trailing blank after the definition of LEVEL.Could there be a line in Makefile.common that itself includes $(SOMEMACRO)/Makefile and you have not set the value of SOMEMACRO?
这是我对此问题的修复:(https://github.com/rust -lang/rust/issues/24887#issuecomment-99391849)
在运行 ./configure 之前更新 src/llvm/Makefile.config.in
或更新 x86_64-apple-darwin/ llvm/Makefile.config之前make
第59行:
更新到
第86行:
更新到
here's my fixes for this issue: (https://github.com/rust-lang/rust/issues/24887#issuecomment-99391849)
update src/llvm/Makefile.config.in before running ./configure
or update x86_64-apple-darwin/llvm/Makefile.config before make
line 59:
update to
line 86:
update to