我想在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和它修復AR
和ARFLAGS
:
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" ./configure
和make 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
集合中?
[這annswer(https://stackoverflow.com/a/5820432/425738)可以幫助 - 基本上加上'使V = 1 ...' – ldav1s