Used external roborio compiler instead of local compiler.

Change-Id: Ifec0d68b0b51a822c906bc4f52320004ee2f5d84
diff --git a/tools/cpp/BUILD b/tools/cpp/BUILD
index a29003c..16fb172 100644
--- a/tools/cpp/BUILD
+++ b/tools/cpp/BUILD
@@ -30,6 +30,8 @@
         ":cc-compiler-local",
         ":cc-compiler-k8",
         ":cc-compiler-roborio",
+        '@arm-frc-linux-gnueabi-repo//:compiler_components',
+        ':roborio-compiler-files',
     ],
 )
 
@@ -75,16 +77,39 @@
     supports_param_files = 0,
 )
 
+filegroup(
+  name = 'roborio-compiler-files',
+  srcs = [
+    '//tools/cpp/arm-frc-linux-gnueabi:tool-wrappers',
+    '@arm-frc-linux-gnueabi-repo//:compiler_pieces',
+  ],
+)
+
+filegroup(
+  name = 'roborio_linker_files',
+  srcs = [
+    '//tools/cpp/arm-frc-linux-gnueabi:ld',
+    '//tools/cpp/arm-frc-linux-gnueabi:ar',
+  ],
+)
+filegroup(
+  name = 'roborio_compiler_files',
+  srcs = [
+    '//tools/cpp/arm-frc-linux-gnueabi:gcc',
+    '//tools/cpp/arm-frc-linux-gnueabi:ld',
+  ],
+)
+
 cc_toolchain(
     name = "cc-compiler-roborio",
-    all_files = ":empty",
-    compiler_files = ":empty",
-    cpu = "local",
-    dwp_files = ":empty",
+    all_files = ":roborio-compiler-files",
+    compiler_files = ':roborio_compiler_files',
+    cpu = "roborio",
+    dwp_files = ':empty',
     dynamic_runtime_libs = [":empty"],
-    linker_files = ":empty",
-    objcopy_files = ":empty",
+    linker_files = ":roborio_linker_files",
+    objcopy_files = '//tools/cpp/arm-frc-linux-gnueabi:objcopy',
     static_runtime_libs = [":empty"],
-    strip_files = ":empty",
+    strip_files = '//tools/cpp/arm-frc-linux-gnueabi:strip',
     supports_param_files = 0,
 )
diff --git a/tools/cpp/CROSSTOOL b/tools/cpp/CROSSTOOL
index f874fce..39af245 100644
--- a/tools/cpp/CROSSTOOL
+++ b/tools/cpp/CROSSTOOL
@@ -292,21 +292,21 @@
   target_system_name: "roborio"
   toolchain_identifier: "roborio_linux"
 
-  tool_path { name: "ar" path: "/usr/bin/arm-frc-linux-gnueabi-ar" }
-  tool_path { name: "compat-ld" path: "/usr/bin/arm-frc-linux-gnueabi-ld" }
-  tool_path { name: "cpp" path: "/usr/bin/arm-frc-linux-gnueabi-cpp" }
-  tool_path { name: "dwp" path: "/usr/bin/dwp" }
-  tool_path { name: "gcc" path: "/usr/bin/arm-frc-linux-gnueabi-gcc" }
-  tool_path { name: "gcov" path: "/usr/bin/arm-frc-linux-gnueabi-gcov-4.9" }
+  tool_path { name: "ar" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ar" }
+  tool_path { name: "compat-ld" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld" }
+  tool_path { name: "cpp" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-cpp" }
+  tool_path { name: "dwp" path: "/bin/false" }
+  tool_path { name: "gcc" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcc" }
+  tool_path { name: "gcov" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcov-4.9" }
   # 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.
-  tool_path { name: "ld" path: "/usr/bin/arm-frc-linux-gnueabi-ld" }
-  tool_path { name: "nm" path: "/usr/bin/arm-frc-linux-gnueabi-nm" }
-  tool_path { name: "objcopy" path: "/usr/bin/arm-frc-linux-gnueabi-objcopy" }
+  tool_path { name: "ld" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld" }
+  tool_path { name: "nm" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-nm" }
+  tool_path { name: "objcopy" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objcopy" }
   objcopy_embed_flag: "-I"
   objcopy_embed_flag: "binary"
-  tool_path { name: "objdump" path: "/usr/bin/arm-frc-linux-gnueabi-objdump" }
-  tool_path { name: "strip" path: "/usr/bin/arm-frc-linux-gnueabi-strip" }
+  tool_path { name: "objdump" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objdump" }
+  tool_path { name: "strip" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-strip" }
 
   # 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
diff --git a/tools/cpp/arm-frc-linux-gnueabi/BUILD b/tools/cpp/arm-frc-linux-gnueabi/BUILD
new file mode 100644
index 0000000..4548dbe
--- /dev/null
+++ b/tools/cpp/arm-frc-linux-gnueabi/BUILD
@@ -0,0 +1,70 @@
+package(default_visibility = ['//tools/cpp:__pkg__'])
+
+filegroup(
+  name = 'gcc',
+  srcs = [
+    '@arm-frc-linux-gnueabi-repo//:gcc',
+    'arm-frc-linux-gnueabi-gcc',
+  ],
+)
+
+filegroup(
+  name = 'ar',
+  srcs = [
+    '@arm-frc-linux-gnueabi-repo//:ar',
+    'arm-frc-linux-gnueabi-ar',
+  ],
+)
+
+filegroup(
+  name = 'ld',
+  srcs = [
+    '@arm-frc-linux-gnueabi-repo//:ld',
+    'arm-frc-linux-gnueabi-ld',
+  ],
+)
+
+filegroup(
+  name = 'nm',
+  srcs = [
+    '@arm-frc-linux-gnueabi-repo//:nm',
+    'arm-frc-linux-gnueabi-nm',
+  ],
+)
+
+filegroup(
+  name = 'objcopy',
+  srcs = [
+    '@arm-frc-linux-gnueabi-repo//:objcopy',
+    'arm-frc-linux-gnueabi-objcopy',
+  ],
+)
+
+filegroup(
+  name = 'objdump',
+  srcs = [
+    '@arm-frc-linux-gnueabi-repo//:objdump',
+    'arm-frc-linux-gnueabi-objdump',
+  ],
+)
+
+filegroup(
+  name = 'strip',
+  srcs = [
+    '@arm-frc-linux-gnueabi-repo//:strip',
+    'arm-frc-linux-gnueabi-strip',
+  ],
+)
+
+filegroup(
+  name = 'tool-wrappers',
+  srcs = [
+    ':gcc',
+    ':ar',
+    ':ld',
+    ':nm',
+    ':objcopy',
+    ':objdump',
+    ':strip',
+  ],
+)
diff --git a/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ar b/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ar
new file mode 100755
index 0000000..040a122
--- /dev/null
+++ b/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ar
@@ -0,0 +1,5 @@
+#!/bin/bash --norc
+
+exec -a arm-frc-linux-gnueabi-ar \
+	"${BAZEL_OUTPUT_ROOT}external/arm-frc-linux-gnueabi-repo/usr/bin/arm-frc-linux-gnueabi-ar" \
+	"$@"
diff --git a/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-as b/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-as
new file mode 100755
index 0000000..84b49da
--- /dev/null
+++ b/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-as
@@ -0,0 +1,5 @@
+#!/bin/bash --norc
+
+exec -a arm-frc-linux-gnueabi-as \
+	"${BAZEL_OUTPUT_ROOT}external/arm-frc-linux-gnueabi-repo/usr/bin/arm-frc-linux-gnueabi-as" \
+	"$@"
diff --git a/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-cpp b/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-cpp
new file mode 100755
index 0000000..c04ad23
--- /dev/null
+++ b/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-cpp
@@ -0,0 +1,5 @@
+#!/bin/bash --norc
+
+exec -a arm-frc-linux-gnueabi-cpp \
+	"${BAZEL_OUTPUT_ROOT}external/arm-frc-linux-gnueabi-repo/usr/bin/arm-frc-linux-gnueabi-cpp" \
+	"$@"
diff --git a/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-dwp b/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-dwp
new file mode 100755
index 0000000..04bfaa3
--- /dev/null
+++ b/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-dwp
@@ -0,0 +1,5 @@
+#!/bin/bash --norc
+
+exec -a arm-frc-linux-gnueabi-dwp \
+	"${BAZEL_OUTPUT_ROOT}external/arm-frc-linux-gnueabi-repo/usr/bin/arm-frc-linux-gnueabi-dwp" \
+	"$@"
diff --git a/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcc b/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcc
new file mode 100755
index 0000000..0e306f1
--- /dev/null
+++ b/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcc
@@ -0,0 +1,5 @@
+#!/bin/bash --norc
+
+exec \
+	"${BAZEL_OUTPUT_ROOT}external/arm-frc-linux-gnueabi-repo/usr/bin/arm-frc-linux-gnueabi-gcc" \
+	"$@"
diff --git a/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcov b/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcov
new file mode 100755
index 0000000..d220b95
--- /dev/null
+++ b/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcov
@@ -0,0 +1,5 @@
+#!/bin/bash --norc
+
+exec -a arm-frc-linux-gnueabi-gcov \
+	"${BAZEL_OUTPUT_ROOT}external/arm-frc-linux-gnueabi-repo/usr/bin/arm-frc-linux-gnueabi-gcov" \
+	"$@"
diff --git a/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld b/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld
new file mode 100755
index 0000000..db762f3
--- /dev/null
+++ b/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld
@@ -0,0 +1,5 @@
+#!/bin/bash --norc
+
+exec -a arm-frc-linux-gnueabi-ld \
+	"${BAZEL_OUTPUT_ROOT}external/arm-frc-linux-gnueabi-repo/usr/bin/arm-frc-linux-gnueabi-ld" \
+	"$@"
diff --git a/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-nm b/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-nm
new file mode 100755
index 0000000..6348eda
--- /dev/null
+++ b/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-nm
@@ -0,0 +1,5 @@
+#!/bin/bash --norc
+
+exec -a arm-frc-linux-gnueabi-nm \
+	"${BAZEL_OUTPUT_ROOT}external/arm-frc-linux-gnueabi-repo/usr/bin/arm-frc-linux-gnueabi-nm" \
+	"$@"
diff --git a/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objcopy b/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objcopy
new file mode 100755
index 0000000..b126fc7
--- /dev/null
+++ b/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objcopy
@@ -0,0 +1,5 @@
+#!/bin/bash --norc
+
+exec -a arm-frc-linux-gnueabi-objcopy \
+	"${BAZEL_OUTPUT_ROOT}external/arm-frc-linux-gnueabi-repo/usr/bin/arm-frc-linux-gnueabi-objcopy" \
+	"$@"
diff --git a/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objdump b/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objdump
new file mode 100755
index 0000000..dacf923
--- /dev/null
+++ b/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objdump
@@ -0,0 +1,5 @@
+#!/bin/bash --norc
+
+exec -a arm-frc-linux-gnueabi-objdump \
+	"${BAZEL_OUTPUT_ROOT}external/arm-frc-linux-gnueabi-repo/usr/bin/arm-frc-linux-gnueabi-objdump" \
+	"$@"
diff --git a/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-repo b/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-repo
new file mode 120000
index 0000000..1c8656d
--- /dev/null
+++ b/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-repo
@@ -0,0 +1 @@
+../../../bazel-out/../../external/arm-frc-linux-gnueabi-repo
\ No newline at end of file
diff --git a/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-strip b/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-strip
new file mode 100755
index 0000000..8469103
--- /dev/null
+++ b/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-strip
@@ -0,0 +1,5 @@
+#!/bin/bash --norc
+
+exec -a arm-frc-linux-gnueabi-strip \
+	"${BAZEL_OUTPUT_ROOT}external/arm-frc-linux-gnueabi-repo/usr/bin/arm-frc-linux-gnueabi-strip" \
+	"$@"
diff --git a/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi.BUILD b/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi.BUILD
new file mode 100644
index 0000000..e579f39
--- /dev/null
+++ b/tools/cpp/arm-frc-linux-gnueabi/arm-frc-linux-gnueabi.BUILD
@@ -0,0 +1,98 @@
+package(default_visibility = ["//visibility:public"])
+
+filegroup(
+  name = 'gcc',
+  srcs = [
+    'usr/bin/arm-frc-linux-gnueabi-gcc-4.9',
+  ],
+)
+
+filegroup(
+  name = 'ar',
+  srcs = [
+    'usr/bin/arm-frc-linux-gnueabi-ar',
+  ],
+)
+
+filegroup(
+  name = 'ld',
+  srcs = [
+    'usr/bin/arm-frc-linux-gnueabi-ld',
+  ],
+)
+
+filegroup(
+  name = 'nm',
+  srcs = [
+    'usr/bin/arm-frc-linux-gnueabi-nm',
+  ],
+)
+
+filegroup(
+  name = 'objcopy',
+  srcs = [
+    'usr/bin/arm-frc-linux-gnueabi-objcopy',
+  ],
+)
+
+filegroup(
+  name = 'objdump',
+  srcs = [
+    'usr/bin/arm-frc-linux-gnueabi-objdump',
+  ],
+)
+
+filegroup(
+  name = 'strip',
+  srcs = [
+    'usr/bin/arm-frc-linux-gnueabi-strip',
+  ],
+)
+
+filegroup(
+  name = 'compiler_pieces',
+  srcs = glob([
+    'usr/bin/**/*',
+    'usr/include/**/*',
+    'usr/lib/**/*',
+  ]),
+)
+
+filegroup(
+  name = 'compiler_components',
+  srcs = [
+    ':gcc',
+    ':ar',
+    ':ld',
+    ':nm',
+    ':objcopy',
+    ':objdump',
+    ':strip',
+  ],
+)
+
+cc_library(
+  name = 'librt',
+  srcs = [
+    'usr/arm-frc-linux-gnueabi/usr/lib/librt.so'
+  ],
+)
+
+cc_library(
+  name = 'libdl',
+  srcs = [
+    'usr/arm-frc-linux-gnueabi/usr/lib/libdl.so'
+  ],
+)
+
+cc_library(
+  name = 'libm',
+  srcs = [
+    'usr/arm-frc-linux-gnueabi/usr/lib/libm.so'
+  ],
+)
+
+cc_library(
+  name = 'libpthread',
+)
+