bazelbuild / bazelbuild/platforms

[question] bazel platforms for c/c++ how to distinguish the toolchain while they are same cpu and os

Open
#88 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Starlark
Stars
124
Forks
94
PR merge metrics
No merged PRs in 30d

Description

HI ALL:
I have encountered a problem: our c/c++ project need to cross compile to different arm boards, and they are all aarch64 & linxu, but with three different toolchains.
The platforms has only os and cpu two options to decide a toolchain。Arm I right?
So how do I add another option to approach this ? Such as board_type?
platform(
name = "platfomr_board_A",
constraint_values = [
"@platforms//os:linux",
"@platforms//cpu:aarch64",
":board_type_A",
],
)

platform(
name = "platfomr_board_B",
constraint_values = [
"@platforms//os:linux",
"@platforms//cpu:aarch64",
":board_type_B",
],
)

platform(
name = "platfomr_board_C",
constraint_values = [
"@platforms//os:linux",
"@platforms//cpu:aarch64",
":board_type_C",
],
)

and the run in the cmd line: bazel build --platfomrs=//:platfomr_board_B //...

Contributor guide

Open the contributing guide

Research direction

Start with the platform() definitions and the proposed bazel build command in the issue, then review how the three aarch64/Linux toolchains are selected. Done would mean documenting or demonstrating an agreed way to distinguish board-specific toolchains using platform constraints.

Written by the indexing model from the issue text.

Assessment

Domain
build-system, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.