[llvm] r199313 - Add a check to configure that the libstdc++ selected by Clang isn't

Chandler Carruth chandlerc at gmail.com
Fri Jan 17 00:18:54 PST 2014


Yep, just haven't gotten there yet.


On Fri, Jan 17, 2014 at 12:15 AM, Evgeniy Stepanov <
eugeni.stepanov at gmail.com> wrote:

> Do you plan to add the same check to cmake?
>
>
> On Wed, Jan 15, 2014 at 2:31 PM, Chandler Carruth <chandlerc at gmail.com>
> wrote:
> > Author: chandlerc
> > Date: Wed Jan 15 04:31:15 2014
> > New Revision: 199313
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=199313&view=rev
> > Log:
> > Add a check to configure that the libstdc++ selected by Clang isn't
> > libstdc++v4.6. This is quite hard to test directly, so we test for it by
> > checking a known missing feature in that version that was added in v4.7.
> >
> > This should prevent users from upgrading Clang but not GCC and hosting
> > with a too-old GCC's libstdc++ and getting strange and hard to debug
> > errors when we switch to C++11 by default.
> >
> > Also, switch several of the macros I introduced to use AC_LANG_SOURCE
> > rather than AC_LANG_PROGRAM as we don't need configure's help writing
> > our main function (and we don't need such a function at all for most of
> > the tests).
> >
> > Modified:
> >     llvm/trunk/autoconf/configure.ac
> >     llvm/trunk/configure
> >
> > Modified: llvm/trunk/autoconf/configure.ac
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=199313&r1=199312&r2=199313&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/autoconf/configure.ac (original)
> > +++ llvm/trunk/autoconf/configure.ac Wed Jan 15 04:31:15 2014
> > @@ -102,15 +102,15 @@ dnl other possible compilers.
> >  AC_MSG_CHECKING([whether GCC or Clang is our host compiler])
> >  AC_LANG_PUSH([C++])
> >  llvm_cv_cxx_compiler=unknown
> > -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! __clang__
> > -                                     #error
> > -                                     #endif
> > -                                     ]])],
> > +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#if ! __clang__
> > +                                    #error
> > +                                    #endif
> > +                                    ]])],
> >                    llvm_cv_cxx_compiler=clang,
> > -                  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! __GNUC__
> > -                                                        #error
> > -                                                        #endif
> > -                                                        ]])],
> > +                  [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#if ! __GNUC__
> > +                                                       #error
> > +                                                       #endif
> > +                                                       ]])],
> >                                       llvm_cv_cxx_compiler=gcc, [])])
> >  AC_LANG_POP([C++])
> >  AC_MSG_RESULT([${llvm_cv_cxx_compiler}])
> > @@ -129,7 +129,7 @@ case "$enableval" in
> >      case "$llvm_cv_cxx_compiler" in
> >      clang)
> >        AC_MSG_CHECKING([whether Clang is new enough])
> > -      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
> > +      AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
> >  #if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 1)
> >  #error This version of Clang is too old to build LLVM
> >  #endif
> > @@ -140,10 +140,34 @@ case "$enableval" in
> >  The selected Clang compiler is not new enough to build LLVM. Please
> upgrade to
> >  Clang 3.1. You may pass --disable-compiler-version-checks to configure
> to
> >  bypass these sanity checks.])])
> > +
> > +      dnl Note that libstdc++4.6 is known broken for C++11 builds. The
> errors
> > +      dnl are sometimes deeply confusing though. Here we test for an
> obvious
> > +      dnl incomplete feature in 4.6's standard library that was
> completed in
> > +      dnl 4.7's.
> > +      AC_MSG_CHECKING([whether Clang will select a modern C++ standard
> library])
> > +      llvm_cv_old_cxxflags="$CXXFLAGS"
> > +      CXXFLAGS="$CXXFLAGS -std=c++0x"
> > +      AC_LINK_IFELSE([AC_LANG_SOURCE([[
> > +#include <atomic>
> > +std::atomic<float> x(0.0f);
> > +int main() { return (float)x; }
> > +]])],
> > +          [AC_MSG_RESULT([yes])],
> > +          [AC_MSG_RESULT([no])
> > +           AC_MSG_ERROR([
> > +We detected a missing feature in the standard C++ library that was
> known to be
> > +missing in libstdc++4.6 and implemented in libstdc++4.7. There are
> numerous
> > +C++11 problems with 4.6's library, and we don't support GCCs or
> libstdc++ older
> > +than 4.7. You will need to update your system and ensure Clang uses the
> newer
> > +standard library.
> > +
> > +If this error is incorrect or you need to force things to work, you may
> pass
> > +'--disable-compiler-version-checks' to configure to bypass this
> test.])])
> >        ;;
> >      gcc)
> >        AC_MSG_CHECKING([whether GCC is new enough])
> > -      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
> > +      AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
> >  #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7)
> >  #error This version of GCC is too old to build LLVM
> >  #endif
> >
> > Modified: llvm/trunk/configure
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=199313&r1=199312&r2=199313&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/configure (original)
> > +++ llvm/trunk/configure Wed Jan 15 04:31:15 2014
> > @@ -3593,16 +3593,9 @@ cat confdefs.h >>conftest.$ac_ext
> >  cat >>conftest.$ac_ext <<_ACEOF
> >  /* end confdefs.h.  */
> >  #if ! __clang__
> > -                                     #error
> > -                                     #endif
> > +                                    #error
> > +                                    #endif
> >
> > -int
> > -main ()
> > -{
> > -
> > -  ;
> > -  return 0;
> > -}
> >  _ACEOF
> >  rm -f conftest.$ac_objext
> >  if { (ac_try="$ac_compile"
> > @@ -3650,16 +3643,9 @@ cat confdefs.h >>conftest.$ac_ext
> >  cat >>conftest.$ac_ext <<_ACEOF
> >  /* end confdefs.h.  */
> >  #if ! __GNUC__
> > -                                                        #error
> > -                                                        #endif
> > -
> > -int
> > -main ()
> > -{
> > +                                                       #error
> > +                                                       #endif
> >
> > -  ;
> > -  return 0;
> > -}
> >  _ACEOF
> >  rm -f conftest.$ac_objext
> >  if { (ac_try="$ac_compile"
> > @@ -3748,13 +3734,6 @@ cat >>conftest.$ac_ext <<_ACEOF
> >  #error This version of Clang is too old to build LLVM
> >  #endif
> >
> > -int
> > -main ()
> > -{
> > -
> > -  ;
> > -  return 0;
> > -}
> >  _ACEOF
> >  rm -f conftest.$ac_objext
> >  if { (ac_try="$ac_compile"
> > @@ -3810,6 +3789,88 @@ bypass these sanity checks." >&2;}
> >  fi
> >
> >  rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
> > +
> > +                              { echo "$as_me:$LINENO: checking whether
> Clang will select a modern C++ standard library" >&5
> > +echo $ECHO_N "checking whether Clang will select a modern C++ standard
> library... $ECHO_C" >&6; }
> > +      llvm_cv_old_cxxflags="$CXXFLAGS"
> > +      CXXFLAGS="$CXXFLAGS -std=c++0x"
> > +      cat >conftest.$ac_ext <<_ACEOF
> > +/* confdefs.h.  */
> > +_ACEOF
> > +cat confdefs.h >>conftest.$ac_ext
> > +cat >>conftest.$ac_ext <<_ACEOF
> > +/* end confdefs.h.  */
> > +
> > +#include <atomic>
> > +std::atomic<float> x(0.0f);
> > +int main() { return (float)x; }
> > +
> > +_ACEOF
> > +rm -f conftest.$ac_objext conftest$ac_exeext
> > +if { (ac_try="$ac_link"
> > +case "(($ac_try" in
> > +  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
> > +  *) ac_try_echo=$ac_try;;
> > +esac
> > +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
> > +  (eval "$ac_link") 2>conftest.er1
> > +  ac_status=$?
> > +  grep -v '^ *+' conftest.er1 >conftest.err
> > +  rm -f conftest.er1
> > +  cat conftest.err >&5
> > +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
> > +  (exit $ac_status); } &&
> > +        { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s
> conftest.err'
> > +  { (case "(($ac_try" in
> > +  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
> > +  *) ac_try_echo=$ac_try;;
> > +esac
> > +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
> > +  (eval "$ac_try") 2>&5
> > +  ac_status=$?
> > +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
> > +  (exit $ac_status); }; } &&
> > +        { ac_try='test -s conftest$ac_exeext'
> > +  { (case "(($ac_try" in
> > +  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
> > +  *) ac_try_echo=$ac_try;;
> > +esac
> > +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
> > +  (eval "$ac_try") 2>&5
> > +  ac_status=$?
> > +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
> > +  (exit $ac_status); }; }; then
> > +  { echo "$as_me:$LINENO: result: yes" >&5
> > +echo "${ECHO_T}yes" >&6; }
> > +else
> > +  echo "$as_me: failed program was:" >&5
> > +sed 's/^/| /' conftest.$ac_ext >&5
> > +
> > +       { echo "$as_me:$LINENO: result: no" >&5
> > +echo "${ECHO_T}no" >&6; }
> > +           { { echo "$as_me:$LINENO: error:
> > +We detected a missing feature in the standard C++ library that was
> known to be
> > +missing in libstdc++4.6 and implemented in libstdc++4.7. There are
> numerous
> > +C++11 problems with 4.6's library, and we don't support GCCs or
> libstdc++ older
> > +than 4.7. You will need to update your system and ensure Clang uses the
> newer
> > +standard library.
> > +
> > +If this error is incorrect or you need to force things to work, you may
> pass
> > +'--disable-compiler-version-checks' to configure to bypass this test."
> >&5
> > +echo "$as_me: error:
> > +We detected a missing feature in the standard C++ library that was
> known to be
> > +missing in libstdc++4.6 and implemented in libstdc++4.7. There are
> numerous
> > +C++11 problems with 4.6's library, and we don't support GCCs or
> libstdc++ older
> > +than 4.7. You will need to update your system and ensure Clang uses the
> newer
> > +standard library.
> > +
> > +If this error is incorrect or you need to force things to work, you may
> pass
> > +'--disable-compiler-version-checks' to configure to bypass this test."
> >&2;}
> > +   { (exit 1); exit 1; }; }
> > +fi
> > +
> > +rm -f core conftest.err conftest.$ac_objext \
> > +      conftest$ac_exeext conftest.$ac_ext
> >        ;;
> >      gcc)
> >        { echo "$as_me:$LINENO: checking whether GCC is new enough" >&5
> > @@ -3825,13 +3886,6 @@ cat >>conftest.$ac_ext <<_ACEOF
> >  #error This version of GCC is too old to build LLVM
> >  #endif
> >
> > -int
> > -main ()
> > -{
> > -
> > -  ;
> > -  return 0;
> > -}
> >  _ACEOF
> >  rm -f conftest.$ac_objext
> >  if { (ac_try="$ac_compile"
> > @@ -10606,7 +10660,7 @@ else
> >    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
> >    lt_status=$lt_dlunknown
> >    cat > conftest.$ac_ext <<EOF
> > -#line 10609 "configure"
> > +#line 10663 "configure"
> >  #include "confdefs.h"
> >
> >  #if HAVE_DLFCN_H
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140117/47fafa3f/attachment.html>


More information about the llvm-commits mailing list