2017-10-13 59 views
2

我想在OS X上構建Git。Git依賴於libidn2。 libidn2 2.0.0失敗:如何確定'ar'在Makefile中被調用的位置?

make all-am 
make[3]: Entering directory '/Users/jwalton/Build-Scripts/libidn2-2.0.0/lib' 
    CC  idna.lo 
    CC  lookup.lo 
    CC  decode.lo 
    CC  register.lo 
    CC  bidi.lo 
    CC  version.lo 
    CC  error.lo 
    CC  punycode.lo 
    CC  free.lo 
    CC  data.lo 
    CC  tr46map.lo 
    CC  tables.lo 
    CC  context.lo 
    CCLD  libidn2.la 
warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm: no name list 
warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm: no name list 
copying selected object files to avoid basename conflicts... 
ar: temporary file: No such file or directory 
Makefile:1027: recipe for target 'libidn2.la' failed 
make[3]: *** [libidn2.la] Error 1 
make[3]: Leaving directory '/Users/jwalton/Build-Scripts/libidn2-2.0.0/lib' 
Makefile:955: recipe for target 'all' failed 
make[2]: *** [all] Error 2 
make[2]: Leaving directory '/Users/jwalton/Build-Scripts/libidn2-2.0.0/lib' 
Makefile:1065: recipe for target 'all-recursive' failed 
make[1]: *** [all-recursive] Error 1 
make[1]: Leaving directory '/Users/jwalton/Build-Scripts/libidn2-2.0.0' 
Makefile:974: recipe for target 'all' failed 
make: *** [all] Error 2 

我的食譜打造libidn2找到所有的Makefile和它修復ARARFLAGS

if [[ "$IS_DARWIN" -ne "0" ]]; then 
    for mfile in $(find "$PWD" -name 'Makefile'); do 
     echo "Fixing Makefile $mfile" 
     sed -i "" 's|AR = ar|AR = /usr/bin/libtool|g' "$mfile" 
     sed -i "" 's|ARFLAGS = cr|ARFLAGS = -static -o|g' "$mfile" 
    done 
fi 

我已經證實,它修復了所有的Makefile:

$ find $PWD -name Makefile -exec grep 'AR =' {} \; | egrep -iv 'amtar|char' 
AR = /usr/bin/libtool 
ac_ct_AR = /usr/bin/libtool 
AR = /usr/bin/libtool 
ac_ct_AR = /usr/bin/libtool 
AR = /usr/bin/libtool 
ac_ct_AR = /usr/bin/libtool 
AR = /usr/bin/libtool 
ac_ct_AR = /usr/bin/libtool 
AR = /usr/bin/libtool 
ac_ct_AR = /usr/bin/libtool 
AR = /usr/bin/libtool 
ac_ct_AR = /usr/bin/libtool 
AR = /usr/bin/libtool 
ac_ct_AR = /usr/bin/libtool 
AR = /usr/bin/libtool 
ac_ct_AR = /usr/bin/libtool 
AR = /usr/bin/libtool 
ac_ct_AR = /usr/bin/libtool 

我也試過AR="/usr/bin/libtool" ARFLAGS="-static -o" ./configuremake AR="/usr/bin/libtool" ARFLAGS="-static -o",但是這些選擇沒有兌現。它會產生額外的失敗版本。

Makefile調試支持相當糟糕,所以我不確定如何繼續。 make -d即使是最簡單的任務也失敗了,例如提供文件名和行號。 remake -d會產生相同的無益結果。由別人編寫的大型項目加劇了這種情況。

$ make -d 
... 
Putting child 0x7f9bf0c45cf0 (libidn2.la) PID 75531 on the chain. 
Live child 0x7f9bf0c45cf0 (libidn2.la) PID 75531 
    CCLD  libidn2.la 
warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm: no name list 
warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm: no name list 
copying selected object files to avoid basename conflicts... 
ar: temporary file: No such file or directory 
Reaping losing child 0x7f9bf0c45cf0 PID 75531 
Makefile:1027: recipe for target 'libidn2.la' failed 

這裏的線1027,這是不調用ar

libidn2.la: $(libidn2_la_OBJECTS) $(libidn2_la_DEPENDENCIES) $(EXTRA_libidn2_la\ 
_DEPENDENCIES) 
     $(AM_V_CCLD)$(libidn2_la_LINK) -rpath $(libdir) $(libidn2_la_OBJECTS) $\ 
(libidn2_la_LIBADD) $(LIBS) 

我怎樣才能找到其中ar被稱爲Makefiles集合中?

+2

[這annswer(https://stackoverflow.com/a/5820432/425738)可以幫助 - 基本上加上'使V = 1 ...' – ldav1s

回答

-1

要一個失敗的配方,你可以簡單理解:

  1. 呼應的規則(即回聲$(AM_V_CCLD)$(libidn2_la_LINK)...)
  2. 添加從而未能阻止第二個命令製作

如果您需要其他幫助,請在這裏報告這些更改後的make輸出。

在你的情況下,使用的makefile選項--debug = M可以幫助

+0

問題的關鍵在於OP不知道哪個規則導致錯誤,因此修改規則的建議如何提供幫助?另外,選項'-d'(見上面)涵蓋了選項'--debug = m'。 – Beta

+0

錯誤信息直接指向配方,如問題中所述: 「Makefile:1027:recipe for target'libidn2.la'failed」 請注意make選項-d等同於--debug =一個不包括--debug = m,在gmake文檔的第105頁解釋:[link](https://www.gnu.org/software/make/manual/make.pdf) –

+0

它不明顯 - 無論如何 - 對我來說,OP正在查看正確的makefile,但是反思是的,一個'echo'命令可以證實這一點。並根據您的鏈接,「請注意'all'選項[--debug = a]確實啓用了此選項[--debug = m]。」 – Beta

相關問題