bazelbuild / bazelbuild/rules_cc

When cross compiling: as: unrecognized option '-EL'

Open
#401 4 comments 0 reactions 0 assignees View on GitHub
category: toolchains untriaged
Dominant language
Starlark
Stars
247
Forks
196
PR merge metrics
No merged PRs in 30d

Description

https://bazel-info.kekxv.com/fuse/blobs/sha256/historical_execute_response/731e23b360b2d6866c1af66e00af8e4a8c60d3acd348d1b13e44154682952c74-721/

```shell
 based_toolchain git:(main) ✗ bazel build example:hello_world --sandbox_debug
INFO: Invocation ID: bab03f01-c3fb-4ddd-be24-25ed9f613669
INFO: Analyzed target //example:hello_world (1 packages loaded, 18 targets configured).
ERROR: /Volumes/work/learn/based_toolchain/example/BUILD:3:10: Compiling example/main.cc failed: (Exit 1): aarch64-buildroot-linux-musl-g++.br_real failed: error executing CppCompile command (from target //example:hello_world) external/+_repo_rules+musl-linux-aarch64/bin/aarch64-buildroot-linux-musl-g++.br_real '-std=c++17' -lstdc++ -fno-canonical-system-headers -no-canonical-prefixes ... (remaining 24 arguments skipped)
Remote server execution message: Action details (uncached result): https://bazel-info.kekxv.com/fuse/blobs/sha256/historical_execute_response/731e23b360b2d6866c1af66e00af8e4a8c60d3acd348d1b13e44154682952c74-721/
as: unrecognized option '-EL'
Target //example:hello_world failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0.987s, Critical Path: 0.82s
INFO: 2 processes: 3 action cache hit, 2 internal.
ERROR: Build did NOT complete successfully
```

BUILD.bazel :
```bazel
load("@rules_cc//cc/toolchains:toolchain.bzl", "cc_toolchain")

exports_files([
"toolchains.MODULE.bazel",
"gcc.BUILD.bazel",
])

cc_toolchain(
name = "gcc",
args = [
"//toolchains/musl-linux-aarch64/args:default_cpp_compile",
"//toolchains/musl-linux-aarch64/args:default_c_compile",
"//toolchains/musl-linux-aarch64/args:default_link",
"//toolchains/musl-linux-aarch64/args:linux_sysroot",
"//toolchains/args:no_absolute_paths_for_builtins",
"//toolchains/args:warnings",
],
enabled_features = [
"@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features",
],
known_features = ["@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features"],
tool_map = "//toolchains/musl-linux-aarch64/tools:all_tools",
)

toolchain(
name = "toolchain",
exec_compatible_with = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
],
target_compatible_with = [
"@platforms//os:linux",
"@platforms//cpu:aarch64",
],
toolchain = ":gcc",
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
visibility = ["//visibility:public"],
)

```

Contributor guide

Open the contributing guide

Research direction

Start with the BUILD.bazel cc_toolchain declaration and inspect the referenced toolchains/musl-linux-aarch64/args entries and tool_map for where the -EL option enters the compile command. Reproduce the failure with bazel build example:hello_world --sandbox_debug and then --verbose_failures; done means the aarch64 target builds without the assembler rejecting -EL.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system, compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.