Bug 1278456 - Add the tooltool GCC library directory to LD_LIBRARY_PATH on Linux builds. r?mshal
Build slaves on automation are based on Centos 6, which doesn't have a
recent enough version of libstdc++ for our new requirements. But since
we're building with a recent GCC or clang with its own libstdc++, we do
have such a libstdc++ available somewhere, and the compiler picks it
when invoking the linker.
Problems start happening when we execute some of the built programs
during the build, like host tools (e.g. nsinstall), or target programs
(xpcshell, during packaging). In that case, we need the compiler's
libstdc++ to be used. Which required adding the GCC or clang library
directory to LD_LIBRARY_PATH.
Unconveniently enough, the clang 3.5 tooltool package we're using for
ASAN builds until we can update to at least 3.8 (
bug 1278718) doesn't
contain libstdc++.so. So for those builds, pull the GCC package from
tooltool as well, and pick libstdc++ from there.
--- a/b2g/config/mozconfigs/common
+++ b/b2g/config/mozconfigs/common
@@ -7,17 +7,17 @@
. "$topsrcdir/build/mozconfig.common"
# Normally, we'd set this unconditionally, but this file is also used
# for local builds and there is no other mozconfig in this tree that
# is included on device builds.
if test -d $topsrcdir/gcc/bin; then
HOST_CC="$topsrcdir/gcc/bin/gcc"
HOST_CXX="$topsrcdir/gcc/bin/g++"
- ac_add_options --enable-stdcxx-compat
+ . "$topsrcdir/build/unix/mozconfig.stdcxx"
fi
# Allow overriding this from the environment, and don't
# try to set it if it doesn't exist. As per above, this file is also
# used for local builds, and we may need to override this for builds in
# other environments.
if test -z "$SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE" -a -f /builds/crash-stats-api.token; then
export SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE=/builds/crash-stats-api.token
--- a/b2g/graphene/config/horizon-mozconfigs/common
+++ b/b2g/graphene/config/horizon-mozconfigs/common
@@ -11,14 +11,14 @@ MOZ_AUTOMATION_SDK=0
. "$topsrcdir/build/mozconfig.common"
# Normally, we'd set this unconditionally, but this file is also used
# for local builds and there is no other mozconfig in this tree that
# is included on device builds.
if test -d $topsrcdir/../gcc/bin; then
HOST_CC="$topsrcdir/../gcc/bin/gcc"
HOST_CXX="$topsrcdir/../gcc/bin/g++"
- ac_add_options --enable-stdcxx-compat
+ . "$topsrcdir/build/unix/mozconfig.stdcxx"
fi
MOZ_HORIZON=1
ac_add_options --with-branding=b2g/branding/horizon
ac_add_options --enable-application=b2g/graphene
--- a/b2g/graphene/config/mozconfigs/common
+++ b/b2g/graphene/config/mozconfigs/common
@@ -11,14 +11,14 @@ MOZ_AUTOMATION_SDK=0
. "$topsrcdir/build/mozconfig.common"
# Normally, we'd set this unconditionally, but this file is also used
# for local builds and there is no other mozconfig in this tree that
# is included on device builds.
if test -d $topsrcdir/../gcc/bin; then
HOST_CC="$topsrcdir/../gcc/bin/gcc"
HOST_CXX="$topsrcdir/../gcc/bin/g++"
- ac_add_options --enable-stdcxx-compat
+ . "$topsrcdir/build/unix/mozconfig.stdcxx"
fi
ac_add_options --with-branding=b2g/branding/browserhtml
ac_add_options --enable-application=b2g/graphene
--- a/browser/config/mozconfigs/linux64/debug-static-analysis-clang
+++ b/browser/config/mozconfigs/linux64/debug-static-analysis-clang
@@ -12,16 +12,15 @@ export CC="$topsrcdir/clang/bin/clang"
export CXX="$topsrcdir/clang/bin/clang++"
# Add the static checker
ac_add_options --enable-clang-plugin
# Treat warnings as errors (modulo ALLOW_COMPILER_WARNINGS).
ac_add_options --enable-warnings-as-errors
-# Avoid dependency on libstdc++ 4.7
-ac_add_options --enable-stdcxx-compat
+. "$topsrcdir/build/unix/mozconfig.stdcxx"
export PKG_CONFIG_LIBDIR=/usr/lib64/pkgconfig:/usr/share/pkgconfig
. $topsrcdir/build/unix/mozconfig.gtk
. "$topsrcdir/build/mozconfig.common.override"
. "$topsrcdir/build/mozconfig.cache"
--- a/browser/config/mozconfigs/linux64/hazards
+++ b/browser/config/mozconfigs/linux64/hazards
@@ -4,17 +4,18 @@
# Do NOT include build/unix/mozconfig.linux because it points directly at the
# tooltool-installed gcc, and the analysis works by wrapping the gcc invocation
# with a script that invokes the real gcc with -fplugin and its configuration
# directives. Instead, duplicate the contents of that mozconfig here:
. "$topsrcdir/build/mozconfig.common"
ac_add_options --enable-elf-hack
-ac_add_options --enable-stdcxx-compat
+
+. "$topsrcdir/build/unix/mozconfig.stdcxx"
# The objdir must be at a known location so its path can be stripped from the
# filenames stored by the analysis
mk_add_options MOZ_OBJDIR=obj-analyzed
# The configuration options are chosen to compile the most code
# (--enable-debug, --enable-tests) in the trickiest way possible
# (--enable-optimize) to maximize the chance of seeing tricky static orderings.
--- a/browser/config/mozconfigs/linux64/opt-static-analysis-clang
+++ b/browser/config/mozconfigs/linux64/opt-static-analysis-clang
@@ -11,16 +11,15 @@ CC="$topsrcdir/clang/bin/clang"
CXX="$topsrcdir/clang/bin/clang++"
# Add the static checker
ac_add_options --enable-clang-plugin
# Treat warnings as errors (modulo ALLOW_COMPILER_WARNINGS).
ac_add_options --enable-warnings-as-errors
-# Avoid dependency on libstdc++ 4.7
-ac_add_options --enable-stdcxx-compat
+. "$topsrcdir/build/unix/mozconfig.stdcxx"
export PKG_CONFIG_LIBDIR=/usr/lib64/pkgconfig:/usr/share/pkgconfig
. $topsrcdir/build/unix/mozconfig.gtk
. "$topsrcdir/build/mozconfig.common.override"
. "$topsrcdir/build/mozconfig.cache"
--- a/browser/config/tooltool-manifests/linux64/asan.manifest
+++ b/browser/config/tooltool-manifests/linux64/asan.manifest
@@ -1,10 +1,18 @@
[
{
+"version": "gcc 4.8.5 + PR64905",
+"size": 80160264,
+"digest": "c1a9dc9da289b8528874d16300b9d13a997cec99195bb0bc46ff665216d8535d6d6cb5af6b4b1f2749af6815dab12e703fdb3849014e5c23a70eff351a0baf4e",
+"algorithm": "sha512",
+"filename": "gcc.tar.xz",
+"unpack": true
+},
+{
"version": "clang 3.5/r200213",
"size": 71282740,
"digest": "ee9edb1ef3afd9ab29e39565145545ad57e8d8d2538be4d822d7dbd64038f4529b0b287cecf48bf83def52a26ac2c6faa331686c3ad5e8b4ba4c22686ee0808f",
"algorithm": "sha512",
"filename": "clang.tar.bz2",
"unpack": true
},
{
--- a/build/unix/mozconfig.asan
+++ b/build/unix/mozconfig.asan
@@ -19,10 +19,9 @@ ac_add_options --enable-address-sanitize
# Mandatory options required for ASan builds (both on Linux and Mac)
export MOZ_DEBUG_SYMBOLS=1
ac_add_options --enable-debug-symbols
ac_add_options --disable-install-strip
ac_add_options --disable-jemalloc
ac_add_options --disable-crashreporter
ac_add_options --disable-elf-hack
-# Avoid dependency on libstdc++ 4.7
-ac_add_options --enable-stdcxx-compat
+. "$topsrcdir/build/unix/mozconfig.stdcxx"
--- a/build/unix/mozconfig.gtk
+++ b/build/unix/mozconfig.gtk
@@ -18,9 +18,11 @@ LDFLAGS="-L$TOOLTOOL_DIR/gtk3/usr/local/
ac_add_options --enable-default-toolkit=cairo-gtk3
# Set things up to use Gtk+3 from the tooltool package
mk_add_options "export FONTCONFIG_PATH=$TOOLTOOL_DIR/gtk3/usr/local/etc/fonts"
mk_add_options "export PANGO_SYSCONFDIR=$TOOLTOOL_DIR/gtk3/usr/local/etc"
mk_add_options "export PANGO_LIBDIR=$TOOLTOOL_DIR/gtk3/usr/local/lib"
mk_add_options "export GDK_PIXBUF_MODULE_FILE=$TOOLTOOL_DIR/gtk3/usr/local/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"
mk_add_options "export GDK_PIXBUF_MODULEDIR=$TOOLTOOL_DIR/gtk3/usr/local/lib/gdk-pixbuf-2.0/2.10.0/loaders"
-mk_add_options "export LD_LIBRARY_PATH=$TOOLTOOL_DIR/gtk3/usr/local/lib"
+
+LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$TOOLTOOL_DIR/gtk3/usr/local/lib
+mk_add_options "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
--- a/build/unix/mozconfig.linux
+++ b/build/unix/mozconfig.linux
@@ -23,17 +23,16 @@ then
mk_add_options PATH="$TOOLTOOL_DIR/gcc/bin:$PATH"
else
CC="/tools/gcc-4.7.3-0moz1/bin/gcc"
CXX="/tools/gcc-4.7.3-0moz1/bin/g++"
fi
ac_add_options --enable-elf-hack
-# Avoid dependency on libstdc++ 4.7
-ac_add_options --enable-stdcxx-compat
+. "$topsrcdir/build/unix/mozconfig.stdcxx"
# PKG_CONFIG_LIBDIR is appropriately overridden in mozconfig.linux32
export PKG_CONFIG_LIBDIR=/usr/lib64/pkgconfig:/usr/share/pkgconfig
export SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE=/builds/crash-stats-api.token
. "$topsrcdir/build/unix/mozconfig.gtk"
new file mode 100644
--- /dev/null
+++ b/build/unix/mozconfig.stdcxx
@@ -0,0 +1,15 @@
+# Avoid dependency on libstdc++ 4.7
+ac_add_options --enable-stdcxx-compat
+
+TOOLTOOL_DIR=${TOOLTOOL_DIR:-$topsrcdir}
+
+if [ -f "$TOOLTOOL_DIR/clang/lib/libstdc++.so" ]; then
+ LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$TOOLTOOL_DIR/clang/lib
+elif [ -f "$TOOLTOOL_DIR/gcc/lib/libstdc++.so" ]; then
+ # We put both 32-bits and 64-bits library path in LD_LIBRARY_PATH: ld.so
+ # will prefer the files in the 32-bits path when loading 32-bits executables,
+ # and the files in the 64-bits path when loading 64-bits executables.
+ LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$TOOLTOOL_DIR/gcc/lib64:$TOOLTOOL_DIR/gcc/lib
+fi
+
+mk_add_options "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
--- a/build/unix/mozconfig.tsan
+++ b/build/unix/mozconfig.tsan
@@ -25,10 +25,9 @@ ac_add_options --disable-crashreporter
ac_add_options --disable-elf-hack
ac_add_options --enable-pie
# Keep symbols to symbolize TSan traces
ac_add_options --disable-install-strip
# -gline-tables-only results in significantly smaller binaries.
ac_add_options --enable-debug-symbols="-gline-tables-only"
-# Avoid dependency on libstdc++ 4.7
-ac_add_options --enable-stdcxx-compat
+. "$topsrcdir/build/unix/mozconfig.stdcxx"
--- a/mobile/android/config/mozconfigs/common
+++ b/mobile/android/config/mozconfigs/common
@@ -72,15 +72,14 @@ export SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE=
export MOZ_PACKAGE_JSSHELL=1
# Use ccache
. "$topsrcdir/build/mozconfig.cache"
HOST_CC="$topsrcdir/gcc/bin/gcc"
HOST_CXX="$topsrcdir/gcc/bin/g++"
-# Avoid dependency on libstdc++ 4.7
-ac_add_options --enable-stdcxx-compat
+. "$topsrcdir/build/unix/mozconfig.stdcxx"
# Use libc++ as our C++ standard library
ac_add_options --with-android-cxx-stl=libc++
JS_BINARY="$topsrcdir/mobile/android/config/js_wrapper.sh"