diff options
author | Zhong Wang <linuxerwang@gmail.com> | 2015-08-12 15:06:08 +0000 |
---|---|---|
committer | Kristina Chodorow <kchodorow@google.com> | 2015-08-12 15:24:50 +0000 |
commit | 8c2881324d2e98bbc876b84eddd58baa98d40121 (patch) | |
tree | 4f9bc6bbd439dd5d96a407403b338ba692354da1 | |
parent | 4c5eb0ff6540f7e90fbad3a04053699840163477 (diff) |
Add native support for linux on ARM Cpu (32 bits)
--
Change-Id: Ia70ca1b8482e10bc1ac91799aa238f8613e5c824
Reviewed-on: https://bazel-review.googlesource.com/#/c/1801
MOS_MIGRATED_REVID=100476467
-rwxr-xr-x | scripts/bootstrap/buildenv.sh | 5 | ||||
-rwxr-xr-x | scripts/bootstrap/compile.sh | 6 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java | 2 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/util/CPU.java | 1 | ||||
-rw-r--r-- | third_party/BUILD | 6 | ||||
-rw-r--r-- | third_party/protobuf/README.md | 11 | ||||
-rw-r--r-- | tools/cpp/CROSSTOOL | 38 |
7 files changed, 68 insertions, 1 deletions
diff --git a/scripts/bootstrap/buildenv.sh b/scripts/bootstrap/buildenv.sh index 336785de71..ab4dbeaaa7 100755 --- a/scripts/bootstrap/buildenv.sh +++ b/scripts/bootstrap/buildenv.sh @@ -31,6 +31,11 @@ if [ "${MACHINE_TYPE}" = 'amd64' -o "${MACHINE_TYPE}" = 'x86_64' ]; then MACHINE_IS_64BIT='yes' fi +MACHINE_IS_ARM='no' +if [ "${MACHINE_TYPE}" = 'arm' -o "${MACHINE_TYPE}" = 'armv7l' ]; then + MACHINE_IS_ARM='yes' +fi + ATEXIT_="" function atexit() { ATEXIT_="$1; ${ATEXIT_}" diff --git a/scripts/bootstrap/compile.sh b/scripts/bootstrap/compile.sh index 3db29f71c1..cd7a5b3e5b 100755 --- a/scripts/bootstrap/compile.sh +++ b/scripts/bootstrap/compile.sh @@ -93,7 +93,11 @@ linux) if [ "${MACHINE_IS_64BIT}" = 'yes' ]; then PROTOC=${PROTOC:-third_party/protobuf/protoc-linux-x86_64.exe} else - PROTOC=${PROTOC:-third_party/protobuf/protoc-linux-x86_32.exe} + if [ "${MACHINE_IS_ARM}" = 'yes' ]; then + PROTOC=${PROTOC:-third_party/protobuf/protoc-linux-arm32.exe} + else + PROTOC=${PROTOC:-third_party/protobuf/protoc-linux-x86_32.exe} + fi fi ;; diff --git a/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java b/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java index b2e9f1a4dd..8b526ff75d 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java @@ -405,6 +405,8 @@ public final class BuildConfiguration { return "piii"; case X86_64: return "k8"; + case ARM: + return "arm"; } } return "unknown"; diff --git a/src/main/java/com/google/devtools/build/lib/util/CPU.java b/src/main/java/com/google/devtools/build/lib/util/CPU.java index fd54ddd69f..0bfce8a6ba 100644 --- a/src/main/java/com/google/devtools/build/lib/util/CPU.java +++ b/src/main/java/com/google/devtools/build/lib/util/CPU.java @@ -23,6 +23,7 @@ import java.util.Set; public enum CPU { X86_32("x86_32", ImmutableSet.of("i386", "i486", "i586", "i686", "i786", "x86")), X86_64("x86_64", ImmutableSet.of("amd64", "x86_64", "x64")), + ARM("arm", ImmutableSet.of("arm", "armv7l")), UNKNOWN("unknown", ImmutableSet.<String>of()); private final String canonicalName; diff --git a/third_party/BUILD b/third_party/BUILD index fd44a9cc1a..5c5928777f 100644 --- a/third_party/BUILD +++ b/third_party/BUILD @@ -14,6 +14,7 @@ filegroup( ":darwin": ["protobuf/protoc-osx-x86_32.exe"], ":k8": ["protobuf/protoc-linux-x86_64.exe"], ":piii": ["protobuf/protoc-linux-x86_32.exe"], + ":arm": ["protobuf/protoc-linux-arm32.exe"], }), ) @@ -369,3 +370,8 @@ config_setting( name = "piii", values = {"host_cpu": "piii"}, ) + +config_setting( + name = "arm", + values = {"host_cpu": "arm"}, +) diff --git a/third_party/protobuf/README.md b/third_party/protobuf/README.md index c46cf4a548..8e200e7da7 100644 --- a/third_party/protobuf/README.md +++ b/third_party/protobuf/README.md @@ -9,3 +9,14 @@ How to update these files: 7. Update third_party/BUILD to point to the new jar file. 8. Done. + +Because maven.org doesn't have a prebuilt binary for linux on ARM, you need to build the binary +yourself on the target system. Follow the build steps of protocol buffer to create the binary, +copy it to this directory and rename it to "protoc-linux-arm32.exe". + +For example: + +$ cp /usr/bin/protoc $BAZEL/third_party/protobuf/protoc-linux-arm32.exe + +This should be done before you run ./compile.sh. + diff --git a/tools/cpp/CROSSTOOL b/tools/cpp/CROSSTOOL index 25368e9057..86442c9ec0 100644 --- a/tools/cpp/CROSSTOOL +++ b/tools/cpp/CROSSTOOL @@ -18,6 +18,44 @@ default_toolchain { cpu: "armeabi-v7a" toolchain_identifier: "stub_armeabi-v7a" } +default_toolchain { + cpu: "arm" + toolchain_identifier: "local_linux" +} + +toolchain { + abi_version: "arm" + abi_libc_version: "armeabi-v7a" + builtin_sysroot: "" + compiler: "compiler" + host_system_name: "armeabi-v7a" + needsPic: true + supports_gold_linker: false + supports_incremental_linker: false + supports_fission: false + supports_interface_shared_objects: false + supports_normalizing_ar: false + supports_start_end_lib: false + supports_thin_archives: false + target_libc: "armeabi-v7a" + target_cpu: "armeabi-v7a" + target_system_name: "armeabi-v7a" + toolchain_identifier: "stub_armeabi-v7a" + + tool_path { name: "ar" path: "/bin/false" } + tool_path { name: "compat-ld" path: "/bin/false" } + tool_path { name: "cpp" path: "/bin/false" } + tool_path { name: "dwp" path: "/bin/false" } + tool_path { name: "gcc" path: "/bin/false" } + tool_path { name: "gcov" path: "/bin/false" } + tool_path { name: "ld" path: "/bin/false" } + + tool_path { name: "nm" path: "/bin/false" } + tool_path { name: "objcopy" path: "/bin/false" } + tool_path { name: "objdump" path: "/bin/false" } + tool_path { name: "strip" path: "/bin/false" } +} + toolchain { abi_version: "armeabi-v7a" |