2

I'm trying to build Git on OS X. Git depends on libidn2. libidn2 2.0.0 fails:

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

My recipe to build libidn2 finds all Makefiles and it fixes AR and 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

I've confirmed it fixes all the Makefiles:

$ 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

I also tried AR="/usr/bin/libtool" ARFLAGS="-static -o" ./configure and make AR="/usr/bin/libtool" ARFLAGS="-static -o", but the choices are not honored. It produces additional failed builds.

Makefile debugging support is fairly crappy, so I'm not sure how to proceed. make -d fails even the simplest tasks, like providing a filename and line number. remake -d produces the same unhelpful results. The large project written by someone else aggravates the situation.

$ 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

Here's line 1027, which is not the call to 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)

How can I locate where ar is being called in the collection of Makefiles?

jww
  • 97,681
  • 90
  • 411
  • 885
  • 2
    [This annswer](https://stackoverflow.com/a/5820432/425738) may help -- basically add `make V=1 ...` – ldav1s Oct 14 '17 at 02:56

1 Answers1

-1

To a simple understanding of a failing recipe you can:

  1. echo the rule (i.e. echo $(AM_V_CCLD)$(libidn2_la_LINK) ...)
  2. add a second command which fails to stop the make

If you need additional help please reports here the make output after these changes.

In your case the use of makefile option --debug=m can help

Luca_65
  • 123
  • 9
  • The whole point of the question is that the OP doesn't know which rule is causing the error, so how does a suggestion to modify the rule help? Also, the option `-d` (see above) covers the option `--debug=m`. – Beta Oct 15 '17 at 01:42
  • The error message pinpoints directly to the recipe, as stated in the question: "Makefile:1027: recipe for target 'libidn2.la' failed" Please note that the make option -d is equivalent to --debug=a which do not cover --debug=m, as explained at page 105 of the gmake document: [link](https://www.gnu.org/software/make/manual/make.pdf) – Luca_65 Oct 15 '17 at 05:23
  • It is not obvious -- to me, anyway -- that the OP is looking at the right makefile, but on reflection yes, an `echo` command would confirm that. And according to your link, "Note that the ‘all’ option [--debug=a] does enable this option [--debug=m]." – Beta Oct 15 '17 at 14:51
  • Ok, I'll have to be more clear than synthetic, thank you for your help. If you deduct a point to my answer perhaps now you could restore it. – Luca_65 Oct 15 '17 at 15:01