Prechádzať zdrojové kódy

Fix GCC port usage on FreeBSD where clang is not default.

Without using -rpath to the proper /usr/local path the binary
will refuse to startup due to finding an older libstdc++.so.6
in /usr/lib:

/libexec/ld-elf.so.1: /usr/lib/libstdc++.so.6: version GLIBCXX_3.4.18 required by wraith not found
Bryan Drewery 11 rokov pred
rodič
commit
c2d93fe963

+ 1 - 0
build/autotools/configure.ac

@@ -18,6 +18,7 @@ AC_LANG(C++)
 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.5 g++-4.4 g++-4.4.1 g++-4.4.2 g++-4.4.0 g++44 g++4 eg++ g++-3.3 g++33 g++-3 g++3 g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC])
 dnl AC_PROG_CC([gcc34 gcc-3.4 gcc33 gcc3 gcc-3.3 gcc cc c1])
 EGG_CHECK_CC
+CXX_RPATH_CHECK
 
 #checkpoint
 AC_CACHE_SAVE 

+ 16 - 0
build/autotools/includes/acinclude.m4

@@ -211,6 +211,22 @@ EOF
   fi
 ])
 
+dnl Fix GCC lame compiler paths (FreeBSD)
+dnl @summary check whether compiler requires -rpath for libstdc++.so
+AC_DEFUN([CXX_RPATH_CHECK],
+[
+  AC_CACHE_CHECK([whether the compiler requires -rpath], ax_cv_prog_cc_rpath, [
+    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
+        ax_cv_prog_cc_rpath="${path}"
+        LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-Wl,-rpath,${path}"
+        break
+      fi
+    done
+  ])
+])
+
 dnl  EGG_CHECK_CCSTATIC()
 dnl
 dnl  Checks whether the compiler supports the `-static' flag.

+ 20 - 0
configure

@@ -2996,6 +2996,26 @@ 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_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
+        ax_cv_prog_cc_rpath="${path}"
+        LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-Wl,-rpath,${path}"
+        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; }
+
+
 #checkpoint
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure

+ 1 - 0
doc/UPDATES

@@ -1,5 +1,6 @@
 maint
   * Disable demo TCL support by default to prevent confusion during build.
+  * Fix broken startup with GCC from ports on FreeBSD.
 
 1.4.5
   * Remove ahbl as it now positively identifies all hosts as abusive