Skip to content

Instantly share code, notes, and snippets.

@akors
Last active April 21, 2016 19:54
Show Gist options
  • Save akors/5db13e874c144b3b111f0e0326d7b771 to your computer and use it in GitHub Desktop.
Save akors/5db13e874c144b3b111f0e0326d7b771 to your computer and use it in GitHub Desktop.
diff --git a/src/test/java/com/google/devtools/build/lib/MOCK_CROSSTOOL b/src/test/java/com/google/devtools/build/lib/MOCK_CROSSTOOL
index 323c359..4e6a264 100644
--- a/src/test/java/com/google/devtools/build/lib/MOCK_CROSSTOOL
+++ b/src/test/java/com/google/devtools/build/lib/MOCK_CROSSTOOL
@@ -36,10 +36,10 @@ toolchain {
tool_path { name: "ar" path: "/usr/bin/ar" }
tool_path { name: "compat-ld" path: "/usr/bin/ld" }
- tool_path { name: "cpp" path: "/usr/bin/cpp" }
+ tool_path { name: "cpp" path: "/opt/gcc-4.9/bin/cpp" }
tool_path { name: "dwp" path: "/usr/bin/dwp" }
- tool_path { name: "gcc" path: "/usr/bin/gcc" }
- tool_path { name: "gcov" path: "/usr/bin/gcov" }
+ tool_path { name: "gcc" path: "/opt/gcc-4.9/bin/gcc" }
+ tool_path { name: "gcov" path: "/opt/gcc-4.9/bin/gcov" }
tool_path { name: "ld" path: "/usr/bin/ld" }
tool_path { name: "nm" path: "/usr/bin/nm" }
tool_path { name: "objcopy" path: "/usr/bin/objcopy" }
@@ -52,9 +52,9 @@ toolchain {
builtin_sysroot: ""
cxx_flag: "-std=c++0x"
linker_flag: "-lstdc++"
- cxx_builtin_include_directory: "/usr/lib/gcc/"
- cxx_builtin_include_directory: "/usr/local/include"
- cxx_builtin_include_directory: "/usr/include"
+ cxx_builtin_include_directory: "/opt/gcc-4.9/lib/gcc/"
+ cxx_builtin_include_directory: "/opt/gcc-4.9/local/include"
+ cxx_builtin_include_directory: "/opt/gcc-4.9/include"
objcopy_embed_flag: "-I"
objcopy_embed_flag: "binary"
supports_interface_shared_objects: true
@@ -75,10 +75,10 @@ toolchain {
tool_path { name: "ar" path: "/usr/bin/ar" }
tool_path { name: "compat-ld" path: "/usr/bin/ld" }
- tool_path { name: "cpp" path: "/usr/bin/cpp" }
+ tool_path { name: "cpp" path: "/opt/gcc-4.9/bin/cpp" }
tool_path { name: "dwp" path: "/usr/bin/dwp" }
- tool_path { name: "gcc" path: "/usr/bin/gcc" }
- tool_path { name: "gcov" path: "/usr/bin/gcov" }
+ tool_path { name: "gcc" path: "/opt/gcc-4.9/bin/gcc" }
+ tool_path { name: "gcov" path: "/opt/gcc-4.9/bin/gcov" }
tool_path { name: "ld" path: "/usr/bin/ld" }
tool_path { name: "nm" path: "/usr/bin/nm" }
tool_path { name: "objcopy" path: "/usr/bin/objcopy" }
@@ -91,9 +91,9 @@ toolchain {
builtin_sysroot: ""
cxx_flag: "-std=c++0x"
linker_flag: "-lstdc++"
- cxx_builtin_include_directory: "/usr/lib/gcc/"
- cxx_builtin_include_directory: "/usr/local/include"
- cxx_builtin_include_directory: "/usr/include"
+ cxx_builtin_include_directory: "/opt/gcc-4.9/lib/gcc/"
+ cxx_builtin_include_directory: "/opt/gcc-4.9/local/include"
+ cxx_builtin_include_directory: "/opt/gcc-4.9/include"
objcopy_embed_flag: "-I"
objcopy_embed_flag: "binary"
supports_interface_shared_objects: true
@@ -114,10 +114,10 @@ toolchain {
tool_path { name: "ar" path: "/usr/bin/ar" }
tool_path { name: "compat-ld" path: "/usr/bin/ld" }
- tool_path { name: "cpp" path: "/usr/bin/cpp" }
+ tool_path { name: "cpp" path: "/opt/gcc-4.9/bin/cpp" }
tool_path { name: "dwp" path: "/usr/bin/dwp" }
- tool_path { name: "gcc" path: "/usr/bin/gcc" }
- tool_path { name: "gcov" path: "/usr/bin/gcov" }
+ tool_path { name: "gcc" path: "/opt/gcc-4.9/bin/gcc" }
+ tool_path { name: "gcov" path: "/opt/gcc-4.9/bin/gcov" }
tool_path { name: "ld" path: "/usr/bin/ld" }
tool_path { name: "nm" path: "/usr/bin/nm" }
tool_path { name: "objcopy" path: "/usr/bin/objcopy" }
@@ -129,9 +129,9 @@ toolchain {
builtin_sysroot: ""
cxx_flag: "-std=c++0x"
linker_flag: "-lstdc++"
- cxx_builtin_include_directory: "/usr/lib/gcc/"
- cxx_builtin_include_directory: "/usr/local/include"
- cxx_builtin_include_directory: "/usr/include"
+ cxx_builtin_include_directory: "/opt/gcc-4.9/lib/gcc/"
+ cxx_builtin_include_directory: "/opt/gcc-4.9/local/include"
+ cxx_builtin_include_directory: "/opt/gcc-4.9/include"
objcopy_embed_flag: "-I"
objcopy_embed_flag: "binary"
supports_interface_shared_objects: true
@@ -152,10 +152,10 @@ toolchain {
tool_path { name: "ar" path: "/usr/bin/libtool" }
tool_path { name: "compat-ld" path: "/usr/bin/ld" }
- tool_path { name: "cpp" path: "/usr/bin/cpp" }
+ tool_path { name: "cpp" path: "/opt/gcc-4.9/bin/cpp" }
tool_path { name: "dwp" path: "/usr/bin/dwp" }
- tool_path { name: "gcc" path: "/usr/bin/gcc" }
- tool_path { name: "gcov" path: "/usr/bin/gcov" }
+ tool_path { name: "gcc" path: "/opt/gcc-4.9/bin/gcc" }
+ tool_path { name: "gcov" path: "/opt/gcc-4.9/bin/gcov" }
tool_path { name: "ld" path: "/usr/bin/ld" }
tool_path { name: "nm" path: "/usr/bin/nm" }
tool_path { name: "objcopy" path: "/usr/bin/objcopy" }
@@ -170,7 +170,7 @@ toolchain {
ar_flag: "-s"
ar_flag: "-o"
linker_flag: "-lstdc++"
- cxx_builtin_include_directory: "/usr/include"
+ cxx_builtin_include_directory: "/opt/gcc-4.9/include"
cxx_builtin_include_directory: "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain"
cxx_builtin_include_directory: "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs"
cxx_builtin_include_directory: "/opt/local/include"
@@ -195,10 +195,10 @@ toolchain {
tool_path { name: "ar" path: "/usr/bin/libtool" }
tool_path { name: "compat-ld" path: "/usr/bin/ld" }
- tool_path { name: "cpp" path: "/usr/bin/cpp" }
+ tool_path { name: "cpp" path: "/opt/gcc-4.9/bin/cpp" }
tool_path { name: "dwp" path: "/usr/bin/dwp" }
- tool_path { name: "gcc" path: "/usr/bin/gcc" }
- tool_path { name: "gcov" path: "/usr/bin/gcov" }
+ tool_path { name: "gcc" path: "/opt/gcc-4.9/bin/gcc" }
+ tool_path { name: "gcov" path: "/opt/gcc-4.9/bin/gcov" }
tool_path { name: "ld" path: "/usr/bin/ld" }
tool_path { name: "nm" path: "/usr/bin/nm" }
tool_path { name: "objcopy" path: "/usr/bin/objcopy" }
@@ -213,7 +213,7 @@ toolchain {
ar_flag: "-s"
ar_flag: "-o"
linker_flag: "-lstdc++"
- cxx_builtin_include_directory: "/usr/include"
+ cxx_builtin_include_directory: "/opt/gcc-4.9/include"
cxx_builtin_include_directory: "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain"
cxx_builtin_include_directory: "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs"
cxx_builtin_include_directory: "/opt/local/include"
@@ -316,9 +316,9 @@ toolchain {
tool_path { name: "strip" path: "C:/Program Files (x86)/LLVM/bin/strip" }
cxx_flag: "-std=c++0x"
- cxx_builtin_include_directory: "/usr/lib/gcc/"
- cxx_builtin_include_directory: "/usr/local/include"
- cxx_builtin_include_directory: "/usr/include"
+ cxx_builtin_include_directory: "/opt/gcc-4.9/lib/gcc/"
+ cxx_builtin_include_directory: "/opt/gcc-4.9/local/include"
+ cxx_builtin_include_directory: "/opt/gcc-4.9/include"
objcopy_embed_flag: "-I"
objcopy_embed_flag: "binary"
builtin_sysroot: ""
diff --git a/tools/cpp/CROSSTOOL b/tools/cpp/CROSSTOOL
index a668263..f33cb76 100644
--- a/tools/cpp/CROSSTOOL
+++ b/tools/cpp/CROSSTOOL
@@ -86,21 +86,25 @@ toolchain {
tool_path { name: "ar" path: "/usr/bin/ar" }
tool_path { name: "compat-ld" path: "/usr/bin/ld" }
- tool_path { name: "cpp" path: "/usr/bin/cpp" }
+ tool_path { name: "cpp" path: "/opt/gcc-4.9/bin/cpp" }
tool_path { name: "dwp" path: "/usr/bin/dwp" }
- tool_path { name: "gcc" path: "/usr/bin/gcc" }
+ tool_path { name: "gcc" path: "/opt/gcc-4.9/bin/gcc" }
cxx_flag: "-std=c++0x"
linker_flag: "-lstdc++"
+ linker_flag: "-B/opt/gcc-4.9/bin/"
+ linker_flag: "-Wl,-R/opt/gcc-4.9/lib64"
+ linker_flag: "-L/opt/gcc-4.9/lib64"
linker_flag: "-B/usr/bin/"
# TODO(bazel-team): In theory, the path here ought to exactly match the path
# used by gcc. That works because bazel currently doesn't track files at
# absolute locations and has no remote execution, yet. However, this will need
# to be fixed, maybe with auto-detection?
- cxx_builtin_include_directory: "/usr/lib/gcc/"
- cxx_builtin_include_directory: "/usr/local/include"
+ cxx_builtin_include_directory: "/opt/gcc-4.9/lib/gcc/"
+ cxx_builtin_include_directory: "/opt/gcc-4.9/local/include"
+ cxx_builtin_include_directory: "/opt/gcc-4.9/include"
cxx_builtin_include_directory: "/usr/include"
- tool_path { name: "gcov" path: "/usr/bin/gcov" }
+ tool_path { name: "gcov" path: "/opt/gcc-4.9/bin/gcov" }
# C(++) compiles invoke the compiler (as that is the one knowing where
# to find libraries), but we provide LD so other rules can invoke the linker.
@@ -203,7 +207,7 @@ toolchain {
tool_path { name: "ar" path: "/usr/bin/libtool" }
tool_path { name: "compat-ld" path: "/usr/bin/ld" }
- tool_path { name: "cpp" path: "/usr/bin/cpp" }
+ tool_path { name: "cpp" path: "/opt/gcc-4.9/bin/cpp" }
tool_path { name: "dwp" path: "/usr/bin/dwp" }
tool_path { name: "gcc" path: "osx_cc_wrapper.sh" }
cxx_flag: "-std=c++0x"
@@ -216,7 +220,7 @@ toolchain {
# TODO(ulfjack): This is wrong on so many levels. Figure out a way to auto-detect the proper
# setting from the local compiler, and also how to make incremental builds correct.
cxx_builtin_include_directory: "/"
- tool_path { name: "gcov" path: "/usr/bin/gcov" }
+ tool_path { name: "gcov" path: "/opt/gcc-4.9/bin/gcov" }
tool_path { name: "ld" path: "/usr/bin/ld" }
tool_path { name: "nm" path: "/usr/bin/nm" }
tool_path { name: "objcopy" path: "/usr/bin/objcopy" }
@@ -304,20 +308,20 @@ toolchain {
tool_path { name: "ar" path: "/usr/bin/ar" }
tool_path { name: "compat-ld" path: "/usr/bin/ld" }
- tool_path { name: "cpp" path: "/usr/bin/cpp" }
+ tool_path { name: "cpp" path: "/opt/gcc-4.9/bin/cpp" }
tool_path { name: "dwp" path: "/usr/bin/dwp" }
tool_path { name: "gcc" path: "/usr/bin/clang" }
cxx_flag: "-std=c++0x"
linker_flag: "-lstdc++"
- linker_flag: "-B/usr/bin/"
+ linker_flag: "-B/opt/gcc-4.9/bin/"
# TODO(bazel-team): In theory, the path here ought to exactly match the path
# used by gcc. That works because bazel currently doesn't track files at
# absolute locations and has no remote execution, yet. However, this will need
# to be fixed, maybe with auto-detection?
- cxx_builtin_include_directory: "/usr/local/include"
- cxx_builtin_include_directory: "/usr/include"
- tool_path { name: "gcov" path: "/usr/bin/gcov" }
+ cxx_builtin_include_directory: "/opt/gcc-4.9/local/include"
+ cxx_builtin_include_directory: "/opt/gcc-4.9/include"
+ tool_path { name: "gcov" path: "/opt/gcc-4.9/bin/gcov" }
# C(++) compiles invoke the compiler (as that is the one knowing where
# to find libraries), but we provide LD so other rules can invoke the linker.
@@ -496,9 +500,9 @@ toolchain {
# used by gcc. That works because bazel currently doesn't track files at
# absolute locations and has no remote execution, yet. However, this will need
# to be fixed, maybe with auto-detection?
- cxx_builtin_include_directory: "/usr/lib/gcc/"
- cxx_builtin_include_directory: "/usr/local/include"
- cxx_builtin_include_directory: "/usr/include"
+ cxx_builtin_include_directory: "/opt/gcc-4.9/lib/gcc/"
+ cxx_builtin_include_directory: "/opt/gcc-4.9/local/include"
+ cxx_builtin_include_directory: "/opt/gcc-4.9/include"
tool_path { name: "gcov" path: "C:/Program Files (x86)/LLVM/bin/gcov" }
tool_path { name: "ld" path: "C:/Program Files (x86)/LLVM/bin/ld" }
tool_path { name: "nm" path: "C:/Program Files (x86)/LLVM/bin/nm" }
diff --git a/third_party/gpus/crosstool/CROSSTOOL b/third_party/gpus/crosstool/CROSSTOOL
index a9f26f5..4e0015d 100644
--- a/third_party/gpus/crosstool/CROSSTOOL
+++ b/third_party/gpus/crosstool/CROSSTOOL
@@ -50,17 +50,22 @@ toolchain {
# Use "-std=c++11" for nvcc. For consistency, force both the host compiler
# and the device compiler to use "-std=c++11".
cxx_flag: "-std=c++11"
+ cxx_flag: "-B/usr/bin/"
linker_flag: "-lstdc++"
+ linker_flag: "-L/usr/local/cuda/lib64"
+ linker_flag: "-B/opt/gcc-4.9/bin/"
linker_flag: "-B/usr/bin/"
# TODO(bazel-team): In theory, the path here ought to exactly match the path
# used by gcc. That works because bazel currently doesn't track files at
# absolute locations and has no remote execution, yet. However, this will need
# to be fixed, maybe with auto-detection?
- cxx_builtin_include_directory: "/usr/lib/gcc/"
- cxx_builtin_include_directory: "/usr/local/include"
+ cxx_builtin_include_directory: "/opt/gcc-4.9/lib/gcc/"
+ cxx_builtin_include_directory: "/opt/gcc-4.9/local/include"
+ cxx_builtin_include_directory: "/opt/gcc-4.9/include"
cxx_builtin_include_directory: "/usr/include"
tool_path { name: "gcov" path: "/usr/bin/gcov" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment