2013-07-31 54 views
1

我試圖從源代碼構建trace-cmd.git;最糟糕的是,我已經在同一臺機器上建立過一次,成功;但是沒有留下任何註釋,也不能說出在此期間發生了什麼。使錯誤的路徑,與「沒有規則制定目標」失敗

所以現在我試圖重建,我也得到了可怕的:

trace-cmd$ make 
make: *** No rule to make target `/media/disk/trace-cmd/event-parse.c', needed by `event-parse.o'. Stop. 

好吧,讓我們來看看調試說:

trace-cmd$ make -d 
... 
    Successfully remade target file `trace_python_dir'. 
    Pruning file `tc_version.h'. 
    Considering target file `libparsevent.a'. 
     Considering target file `event-parse.o'. 
     Pruning file `/media/disk/src/trace-cmd/event-parse.c'.  ## THIS EXISTS! 
     Pruning file `.event-parse.d'. 
     Considering target file `/media/disk/trace-cmd/event-parse.c'. ## THIS DOESN'T??? 
     File `/media/disk/trace-cmd/event-parse.c' does not exist. 
     ... 
      Trying pattern rule with stem `event-parse.w'. 
      Trying implicit prerequisite `/media/disk/trace-cmd/SCCS/s.event-parse.w'. 
     Trying pattern rule with stem `event-parse'. 
     Rejecting impossible implicit prerequisite `/media/disk/trace-cmd/event-parse.w'. 
     No implicit rule found for `/media/disk/trace-cmd/event-parse.c'. 
     Finished prerequisites of target file `/media/disk/trace-cmd/event-parse.c'. 
     Must remake target `/media/disk/trace-cmd/event-parse.c'. 
make: *** No rule to make target `/media/disk/trace-cmd/event-parse.c', needed by `event-parse.o'. Stop. 

OK,這是怎麼回事?當然實際文件存在:

trace-cmd$ ls -la /media/disk/src/trace-cmd/event-parse.c 
-rw-r--r-- 1 user user 121563 2013-03-20 19:03 /media/disk/src/trace-cmd/event-parse.c 

...但這是/media/disk/src/trace-cmd/event-parse.c !!並且:

  • make已經發現它一次;
  • 尚未make決定,出於某種原因,從路徑刪除/src/

...這顯然文件不存在:

trace-cmd$ ls /media/disk/trace-cmd/event-parse.c 
ls: cannot access /media/disk/trace-cmd/event-parse.c: No such file or directory 

有人能解釋我, make有什麼可能的原因決定放棄一部分路徑,使它找不到一個文件,它最初有一個正確的參考?

回答

1

明白了 - 想我會專注於.event-parse.d文件:

trace-cmd$ head -n 4 .event-parse.d 
event-parse.o: /media/disk/trace-cmd/event-parse.c \ 
/usr/include/stdio.h /usr/include/features.h /usr/include/bits/predefs.h \ 
/usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \ 
/usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \ 

......而事實上,這是錯誤的路徑有...如果我刪除此文件.d會發生什麼?

trace-cmd$ rm .event-parse.d 
trace-cmd$ make 
    COMPILE FPIC   event-parse.o 
make: *** No rule to make target `/media/disk/trace-cmd/trace-seq.c', needed by `trace-seq.o'. Stop. 

哦,我的。必須有更多的人:

trace-cmd$ ls .*.d 
.event-parse.d  .plugin_kmem.d   .trace-filter.d  .trace-options.d .trace-seq.d 
.kbuffer-parse.d .plugin_kvm.d   .trace-ftrace.d  .trace-output.d  .trace-split.d 
.kernel-shark.d  .plugin_mac80211.d  .trace-graph.d  .trace-plot-cpu.d .trace-stack.d 
... 

......事實上,有;顯然緩存來自以前編譯的文件,其中的確是我編譯在另一個目錄中。如果我全部刪除它們:

trace-cmd$ rm .*.d 
trace-cmd$ make 
... 
gcc --shared event-parse.o trace-seq.o parse-filter.o parse-utils.o trace-util.o trace-input.o trace-ftrace.o trace-output.o trace-recorder.o trace-restore.o trace-usage.o trace-blk-hack.o kbuffer-parse.o ctracecmd_wrap.o -o ctracecmd.so 
Note: to build the gui, type "make gui" 
     to build man pages, type "make doc" 

那麼,看似工作;我又回到了高興:)
乾杯!

+3

下一次,請考慮使用'remake'來調試這些問題。 –

+0

非常感謝評論,@BasileStarynkevitch--之前曾聽說過「重拍」,但我沒有想到它適用於這種情況。乾杯! – sdaau

相關問題