[commit: ghc] master: Darwin: Detect broken NM program at configure time (da99a7f)

git at git.haskell.org git at git.haskell.org
Mon Aug 15 20:43:46 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/da99a7f515cddb7e9eebd81283375c245e1625d4/ghc

>---------------------------------------------------------------

commit da99a7f515cddb7e9eebd81283375c245e1625d4
Author: Erik de Castro Lopo <erik.decastrolopo at ambiata.com>
Date:   Tue Aug 16 06:41:19 2016 +1000

    Darwin: Detect broken NM program at configure time
    
    Some recent versions of XCode ship a broken version of `nm`. Detect this
    at configure time, and error out with a suggestion to rerun configure
    with a `--with-nm=...` argument.
    
    Test Plan: Test of Linux and OS X
    
    Reviewers: carter, hvr, austin, bgamari
    
    Reviewed By: bgamari
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D2425


>---------------------------------------------------------------

da99a7f515cddb7e9eebd81283375c245e1625d4
 configure.ac | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/configure.ac b/configure.ac
index acd33cf..ea3ba4e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -483,6 +483,32 @@ AC_SUBST([LdCmd])
 dnl ** Which nm to use?
 dnl --------------------------------------------------------------
 FP_ARG_WITH_PATH_GNU_PROG([NM], [nm], [nm])
+
+if test "$TargetOS_CPP" = "darwin"
+then
+    AC_MSG_CHECKING(whether nm program is broken)
+    # Some versions of XCode ship a broken version of `nm`. Detect and work
+    # around this issue. See : https://ghc.haskell.org/trac/ghc/ticket/11744
+    nmver=$(${NM} --version | grep version | sed 's/ //g')
+    case "$nmver" in
+        LLVMversion7.3.0|LLVMversion7.3.1)
+            AC_MSG_RESULT(yes)
+            echo "The detected nm program is broken."
+            echo
+            echo "See: https://ghc.haskell.org/trac/ghc/ticket/11744"
+            echo
+            echo "Try re-running configure with:"
+            echo
+            echo '   ./configure --with-nm=$(xcrun --find nm-classic)'
+            echo
+            exit 1
+            ;;
+        *)
+            AC_MSG_RESULT(no)
+            ;;
+        esac
+fi
+
 NmCmd="$NM"
 AC_SUBST([NmCmd])
 



More information about the ghc-commits mailing list