1
0
Эх сурвалжийг харах

Only libstdc++ needs to be statically linked. This removes the need for -rpath as well.

Bryan Drewery 11 жил өмнө
parent
commit
0e05cc5a65
3 өөрчлөгдсөн 8 нэмэгдсэн , 159 устгасан
  1. 2 2
      build/autotools/configure.ac
  2. 3 155
      configure
  3. 3 2
      doc/UPDATES

+ 2 - 2
build/autotools/configure.ac

@@ -19,7 +19,7 @@ AC_PROG_CXX([g++49 g++-4.9 g++48 g++-4.8 g++47 g++-4.7 g++46 g++-4.6 g++45 g++-4
 CC="${CXX} -x c"
 AC_SUBST(CC)
 EGG_CHECK_CC
-CXX_RPATH_CHECK
+#CXX_RPATH_CHECK
 
 #checkpoint
 AC_CACHE_SAVE 
@@ -43,7 +43,7 @@ if [[ "${ax_cv_prog_cc_Og}" = "no" ]]; then
 fi
 CXX_FLAG_CHECK([DEBCXXFLAGS], [-fstack-protector-all], [stackprotectorall])
 CXX_FLAG_CHECK([LDFLAGS], [-static-libstdc++], [static_libstdcxx])
-CXX_FLAG_CHECK([LDFLAGS], [-static-libgcc], [static_libgcc])
+#CXX_FLAG_CHECK([LDFLAGS], [-static-libgcc], [static_libgcc])
 
 EGG_CHECK_DEPMODE
 

+ 3 - 155
configure

@@ -2997,104 +2997,7 @@ if test -n "$GXX"; then
 fi
 
 
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler requires -rpath" >&5
-$as_echo_n "checking whether the compiler requires -rpath... " >&6; }
-if ${ax_cv_prog_cc_need_rpath+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-  if test "$cross_compiling" = yes; then :
-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot run test program while cross compiling
-See \`build/config.log' for more details" "$LINENO" 5; }
-else
-  cat build/confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end build/confdefs.h.  */
-
-#include <vector>
-int main() {
-        std::vector<int> test;
-        try {
-                return test.at(5);
-        } catch (...) {
-                ;
-        }
-        return 0;
-}
-
-_ACEOF
-if ac_fn_cxx_try_run "$LINENO"; then :
-  ax_cv_prog_cc_need_rpath=no
-else
-  ax_cv_prog_cc_need_rpath=yes
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_prog_cc_need_rpath" >&5
-$as_echo "$ax_cv_prog_cc_need_rpath" >&6; }
-
-  if [ "${ax_cv_prog_cc_need_rpath}" = "yes" ]; then
-    save_ldflags="$LDFLAGS"
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler requires -rpath" >&5
-$as_echo_n "checking whether the compiler requires -rpath... " >&6; }
-if ${ax_cv_prog_cc_rpath+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-      ax_cv_prog_cc_rpath=
-
-      for path in `${CXX} -print-search-dirs | awk '/^libraries:/ {print substr($0, 13)}' | tr ':' ' '`; do
-        if [ -r "${path}/libstdc++.so" ]; then
-          LDFLAGS="-Wl,-rpath,${path}"
-          if test "$cross_compiling" = yes; then :
-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot run test program while cross compiling
-See \`build/config.log' for more details" "$LINENO" 5; }
-else
-  cat build/confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end build/confdefs.h.  */
-
-#include <vector>
-int main() {
-        std::vector<int> test;
-        try {
-                return test.at(5);
-        } catch (...) {
-                ;
-        }
-        return 0;
-}
-
-_ACEOF
-if ac_fn_cxx_try_run "$LINENO"; then :
-  ax_cv_prog_cc_rpath="`realpath ${path}`"
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-          LDFLAGS="$save_ldflags"
-          [ -n "${ax_cv_prog_cc_rpath}" ] && break
-        fi
-      done
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_prog_cc_rpath" >&5
-$as_echo "$ax_cv_prog_cc_rpath" >&6; }
-    LDFLAGS="$save_ldflags"
-  fi
-
-  if [ -n "${ax_cv_prog_cc_rpath}" ]; then
-    LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-Wl,-rpath,${ax_cv_prog_cc_rpath}"
-  fi
-
+#CXX_RPATH_CHECK
 
 #checkpoint
 cat >confcache <<\_ACEOF
@@ -3185,6 +3088,7 @@ rm -f confcache
 
 # Speedup compile
 
+
   if test -n "$GXX" && test -z "$no_wall"; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler understands -Wall" >&5
 $as_echo_n "checking whether the compiler understands -Wall... " >&6; }
@@ -3672,63 +3576,7 @@ EOF
     exit 1
   fi
 
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler understands -static-libgcc" >&5
-$as_echo_n "checking whether the compiler understands -static-libgcc... " >&6; }
-if ${ax_cv_prog_cc_static_libgcc+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-    ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-    ac_saved_flags="$CXXFLAGS"
-    CXXFLAGS="-Werror -static-libgcc"
-    cat build/confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end build/confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
-  ax_cv_prog_cc_static_libgcc="yes"
-else
-  ax_cv_prog_cc_static_libgcc="no"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-    CXXFLAGS="$ac_saved_flags"
-    ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_prog_cc_static_libgcc" >&5
-$as_echo "$ax_cv_prog_cc_static_libgcc" >&6; }
-
-  if [ "$ax_cv_prog_cc_static_libgcc" = "yes" ]; then
-    LDFLAGS="$LDFLAGS -static-libgcc"
-  elif [ -n "" ]; then
-      cat << 'EOF' >&2
-configure: error:
-
-  Your OS or C++ compiler does not support -static-libgcc.
-  This compile flag is required.
-
-EOF
-    exit 1
-  fi
-
+#CXX_FLAG_CHECK([LDFLAGS], [-static-libgcc], [static_libgcc])
 
 
 CCDEPMODE=gcc

+ 3 - 2
doc/UPDATES

@@ -10,9 +10,10 @@ maint
     bolds being backwards (#86).
   * Fix TCL warnings during build if TCL is not being used.
   * Rework the build to parallelize better and rebuild some things less often.
-  * GCC: Always link libstdc++ and libgcc statically. This avoids distributing
+  * GCC: Always link libstdc++ statically. This avoids distributing
     a binary that would rely on having a specific compiler version installed
-    and avoids issues when updating the local compiler.
+    and avoids issues when updating the local compiler. This also fixes
+    building a binary with GCC on FreeBSD and using it on a clang-only system.
 
 1.4.5
   * Remove ahbl as it now positively identifies all hosts as abusive