Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Was the ARM support reverted? #164

Closed
abishekmuthian opened this issue Feb 16, 2020 · 4 comments
Closed

Was the ARM support reverted? #164

abishekmuthian opened this issue Feb 16, 2020 · 4 comments

Comments

@abishekmuthian
Copy link
Contributor

Hi, bazel is not able build boost in ARM (aarch64). I'm trying to build ray project.

Ubuntu 18.04, Linux Titan 4.9.140-tegra #1 SMP PREEMPT Sat Oct 19 15:54:06 PDT 2019 aarch64 aarch64 aarch64 GNU/Linux
bazel 2.1.0- (@non-git)
Python 3.6.9

Errors

ERROR: Analysis of target '//:ray_pkg' failed; build aborted:

/home/abishek/.cache/bazel/_bazel_root/f9684c56d3bfa17b4fade757272d3420/external/boost/BUILD.bazel:116:1: Configurable attribute "srcs" doesn't match this configuration (would a default condition help?).
Conditions checked:
 @boost//:linux_arm
 @boost//:linux_x86_64
 @boost//:osx_x86_64
 @boost//:windows_x86_64
INFO: Elapsed time: 1203.931s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (5 packages loaded, 2763 targets configur\
ed)
Traceback (most recent call last):
  File "setup.py", line 221, in <module>
    license="Apache 2.0")
  File "/home/abishek/.local/lib/python3.6/site-packages/setuptools/__init__.py", line 144, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.6/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/home/abishek/.local/lib/python3.6/site-packages/wheel/bdist_wheel.py", line 223, in run
    self.run_command('build')
  File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/usr/lib/python3.6/distutils/command/build.py", line 135, in run
    self.run_command(cmd_name)
  File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "setup.py", line 102, in run
    subprocess.check_call(command)
  File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['../build.sh', '-p', '/usr/bin/python3']' returned non-zero exit status 1.

If I manually add linux_arm to

boost_library(
    name = "context",
    srcs = BOOST_CTX_ASM_SOURCES + select({
        ":linux_arm": [
            "libs/context/src/posix/stack_traits.cpp",
        ],
        ":linux": [
            "libs/context/src/posix/stack_traits.cpp",
        ],
        ":osx_x86_64": [
            "libs/context/src/posix/stack_traits.cpp",
        ],
        ":windows_x86_64": [
            "libs/context/src/windows/stack_traits.cpp",
        ],
    }),

New error occurs at 1586:1,

+ /usr/local/bin/bazel build //:ray_pkg --verbose_failures
ERROR: /home/abishek/.cache/bazel/_bazel_root/f9684c56d3bfa17b4fade757272d3420/external/boost/BUILD.bazel:1586:1: Configurable attribute "defines" doesn't match this configuration (would a default condition help?).
Conditions checked:
 @boost//:linux_arm
 @boost//:linux_x86_64
 @boost//:osx_x86_64
 @boost//:windows_x86_64
ERROR: Analysis of target '//:ray_pkg' failed; build aborted:

/home/abishek/.cache/bazel/_bazel_root/f9684c56d3bfa17b4fade757272d3420/external/boost/BUILD.bazel:1586:1: Configurable attribute "defines" doesn't match this configuration (would a default condition help?).
Conditions checked:
 @boost//:linux_arm
 @boost//:linux_x86_64
 @boost//:osx_x86_64
 @boost//:windows_x86_64
INFO: Elapsed time: 627.317s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (2 packages loaded, 2546 targets configur\
ed)
    Fetching @boringssl; fetching
Traceback (most recent call last):
  File "setup.py", line 221, in <module>
    license="Apache 2.0")
  File "/home/abishek/.local/lib/python3.6/site-packages/setuptools/__init__.py", line 144, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.6/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/home/abishek/.local/lib/python3.6/site-packages/wheel/bdist_wheel.py", line 223, in run
    self.run_command('build')
  File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/usr/lib/python3.6/distutils/command/build.py", line 135, in run
    self.run_command(cmd_name)
  File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "setup.py", line 102, in run
    subprocess.check_call(command)
  File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['../build.sh', '-p', '/usr/bin/python3']' returned non-zero exit status 1.

If I add linux_arm there as well,

boost_library(
    name = "thread",
    srcs = select({
         ":linux_arm": [
            "libs/thread/src/pthread/once.cpp",
            "libs/thread/src/pthread/thread.cpp",
         ],
        ":linux": [
            "libs/thread/src/pthread/once.cpp",
            "libs/thread/src/pthread/thread.cpp",
        ],
        ":osx_x86_64": [
            "libs/thread/src/pthread/once.cpp",
            "libs/thread/src/pthread/thread.cpp",
        ],
        ":windows_x86_64": [
            "libs/thread/src/win32/thread.cpp",
            "libs/thread/src/win32/tss_dll.cpp",
            "libs/thread/src/win32/tss_pe.cpp",
        ],
    }),

Second error (1586:1) disappears, but first error reappears again (116:1).

I see that the ARM specific changes provided
here- #121 is not in the latest rules; have they become invalid?

@abishekmuthian
Copy link
Contributor Author

BUILD.boost points to assembly files at https://github.com/nelhage/rules_boost/blob/master/BUILD.boost#L103 which cannot be compiled for ARM64(aarch64), boost library already has requisite ARM64 files for the same.

Also, some default conditions are required to successfully compile on ARM64 platform as discussed here - ray-project/ray#7184.

I've made a patch to address this issue,

This patch fixes ARM (aarch64) bazel build rules for boost libraries when
building ray as discussed in this issue - https://github.com/ray-project/ray/issues/7184
This Patch may remove compatability for ARMv7.
Patch v1 by Abishek Muthian (@heavyinfo).
--- BUILD.boost	2020-02-23 09:03:02.937872389 +0530
+++ BUILD.boost	2020-02-25 08:37:04.755117788 +0530
@@ -92,9 +92,9 @@
 
 BOOST_CTX_ASM_SOURCES = select({
     ":linux_arm": [
-        "libs/context/src/asm/jump_arm_aapcs_elf_gas.S",
-        "libs/context/src/asm/make_arm_aapcs_elf_gas.S",
-        "libs/context/src/asm/ontop_arm_aapcs_elf_gas.S",
+        "libs/context/src/asm/jump_arm64_aapcs_elf_gas.S",
+        "libs/context/src/asm/make_arm64_aapcs_elf_gas.S",
+        "libs/context/src/asm/ontop_arm64_aapcs_elf_gas.S",
     ],
     ":linux_x86_64": [
         "libs/context/src/asm/jump_x86_64_sysv_elf_gas.S",
@@ -111,6 +111,7 @@
         "libs/context/src/asm/jump_x86_64_ms_pe_masm.S",
         "libs/context/src/asm/ontop_x86_64_ms_pe_masm.S",
     ],
+    "//conditions:default": [],
 })
 
 boost_library(
@@ -125,6 +126,7 @@
         ":windows_x86_64": [
             "libs/context/src/windows/stack_traits.cpp",
         ],
+        "//conditions:default": [],
     }),
     exclude_src = [
         "libs/context/src/fiber.cpp",
@@ -1616,6 +1618,7 @@
             "BOOST_THREAD_USE_LIB",
             "BOOST_WIN32_THREAD",
         ],
+        "//conditions:default": [],
     }),
     linkopts = select({
         ":linux": [

But this patch may break dependency for ARMv7 as I've not figured out how to include files for both ARM32 and ARM64 under linux_arm bazel build rule.

If anyone can advise me on how to achieve that, I will update the patch and submit a PR.

@nelhage
Copy link
Owner

nelhage commented Feb 25, 2020

I think you'll probably want to add some a config_setting around here for linux_aarch64, and add a clause for that to the relevant selects.

It looks like @bazel_tools//platforms:aarch64 is the platform for AARCH64, so you'll add something like

config_setting(
    name = "linux_aarch64",
    constraint_values = [
        "@bazel_tools//platforms:linux",
        "@bazel_tools//platforms:aarch64",
    ],
    visibility = ["//visibility:public"],
)

@abishekmuthian
Copy link
Contributor Author

That worked @nelhage, thanks for letting me know the proper config_setting. I've changed and tested the same.

Submitted a PR for your review - #168.

@abishekmuthian
Copy link
Contributor Author

Closing this issue, as the patch has been merged successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants