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

Can't build on linux/aarch64 #112

Open
riordan opened this issue Jun 22, 2022 · 7 comments
Open

Can't build on linux/aarch64 #112

riordan opened this issue Jun 22, 2022 · 7 comments

Comments

@riordan
Copy link

riordan commented Jun 22, 2022

I'm one of those horrible M1 Mac users screwing up the buildchain for every open source projects. So let me begin by thanking you for abstracting macos/darwin builds so they're architecture independent. It would be great if we could do the same for Linux.

Things work fine in MacOS. It gets interesting when we involve Docker.

Containers can be built for multiple architectures (e.g. x86_64 & aarch64). Docker can run either architecture, though it prefers the native architecture of the host machine. So if an ARM/aarch64 mac tries to build zetasql inside a (local default) aarch64 container, it'll fail, as linux-specific builds are tied to:

"@bazel_tools//src/conditions:linux_x86_64"

While mac/darwin builds are configured to use:

"@bazel_tools//src/conditions:darwin" or "@platforms//os:macos"

It would be nice if linux builds could be configured independent of cpu architecture, or at least could select for linux_aarch64.

@pgrivachev
Copy link

I also tried to build it in docker on M1 Mac and the build failed with the following error:

#7 75.81 ERROR: /zetasql/zetasql/jdk/BUILD:22:11: Configurable attribute "includes" doesn't match this configuration (would a default condition help?).
#7 75.81 Conditions checked:
#7 75.81  @bazel_tools//src/conditions:darwin
#7 75.81  @bazel_tools//src/conditions:linux_x86_64
#7 75.82 INFO: Repository remotejdk11_linux_aarch64 instantiated at:
#7 75.82   /DEFAULT.WORKSPACE.SUFFIX:64:6: in <toplevel>
#7 75.82   /root/.cache/bazel/_bazel_root/6dfaba79244706669db31964876895d7/external/bazel_tools/tools/build_defs/repo/utils.bzl:201:18: in maybe
#7 75.82 Repository rule http_archive defined at:
#7 75.82   /root/.cache/bazel/_bazel_root/6dfaba79244706669db31964876895d7/external/bazel_tools/tools/build_defs/repo/http.bzl:336:31: in <toplevel>
#7 75.82 INFO: Repository boringssl instantiated at:
#7 75.82   /zetasql/WORKSPACE:81:20: in <toplevel>
#7 75.82   /root/.cache/bazel/_bazel_root/6dfaba79244706669db31964876895d7/external/com_google_zetasql/bazel/zetasql_deps_step_2.bzl:217:25: in zetasql_deps_step_2
#7 75.82 Repository rule http_archive defined at:
#7 75.82   /root/.cache/bazel/_bazel_root/6dfaba79244706669db31964876895d7/external/bazel_tools/tools/build_defs/repo/http.bzl:336:31: in <toplevel>
#7 75.95 ERROR: Analysis of target '//zetasql/jdk:jni' failed; build aborted: /zetasql/zetasql/jdk/BUILD:22:11: Configurable attribute "includes" doesn't match this configuration (would a default condition help?).
#7 75.95 Conditions checked:
#7 75.95  @bazel_tools//src/conditions:darwin
#7 75.95  @bazel_tools//src/conditions:linux_x86_64

@riordan
Copy link
Author

riordan commented Jun 29, 2022

I should mention @pgrivachev is the author of zetasql-npm, a fantastically useful FFI binding for zetasql.

The existence of that library has me incredibly excited at the potential of Zetasql's build process targeting not only x86_64, and arm, but also WASM so that Zetasql could be executed client-side and in-browser. Just planting that seed 🌱 .

@leoch20
Copy link

leoch20 commented Oct 5, 2022

@riordan you mentioned

Things work fine in MacOS

Was that on a M1 mac?
I'm getting an error due to no support for aarch64

if (!("x86_64".equals(arch) || "amd64".equals(arch))) {
throw new RuntimeException("Unsupported os.arch");
}

It would be awesome to get aarch64 support

@laughedelic
Copy link

@leoch20 if you are just trying to use ZetaSQL on an M1 mac, you need to make sure you're using the right x86_64 JVM (and you'll need Rosetta installed for that)

@leoch20
Copy link

leoch20 commented Oct 11, 2022

Thanks @laughedelic that did it for me

@billstark
Copy link

Hello @pgrivachev! Currently I am trying to build zetasql-snowflake on my local machine with MBP M1 chip. I got this error but have zero idea about how to solve this. Have you encountered this before? Thanks!

Target '//zetasql/parser:ast_node_util' depends on toolchain '@local_config_cc//:cc-compiler-darwin_arm64', which cannot be found: no such target '@local_config_cc//:cc-compiler-darwin_arm64': target 'cc-compiler-darwin_arm64' not declared in package '' defined by /private/var/tmp/_bazel_xxxxxxx/cae2a4c9d01ba6e33628c063444874a9/external/local_config_cc/BUILD'

@pgrivachev
Copy link

Hey @billstark! I don't remember such issue. I can only suggest using an environment that works for me:

Xcode 14.0
Command Line Tools for Xcode 14.0
Bazel 4.2.4

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

5 participants