Skip to main content
AI
  • Get started with AI

    • Red Hat AI

      Accelerate the development and deployment of enterprise AI solutions.

    • AI learning hub

      Explore learning materials and tools, organized by task.

    • AI interactive demos

      Click through scenarios with Red Hat AI, including training LLMs and more.

    • AI/ML learning paths

      Expand your Red Hat OpenShift AI knowledge using these learning resources.

    • AI quickstarts

      Focused AI use cases designed for fast deployment on Red Hat AI platforms.

    • No-cost AI training

      Foundational Red Hat AI training.

  • Featured resources

    • Red Hat OpenShift AI
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

Red Hat AI Factory with NVIDIA

Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.

Learn
  • Self-guided

    • Documentation

      Find answers, get step-by-step guidance, and learn how to use Red Hat products.

    • Learning paths

      Explore curated walkthroughs for common development tasks.

    • Guided learning

      Receive custom learning paths powered by our AI assistant.

    • See all learning
  • Hands-on

    • Developer Sandbox

      Spin up Red Hat's products and technologies without setup or configuration.

    • Interactive labs

      Learn by doing in these hands-on, browser-based experiences.

    • Interactive demos

      Click through product features in these guided tours.

  • Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics
  • Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
Build
  • Get started

    • Red Hat build of Podman Desktop

      A downloadable, local development hub to experiment with our products and builds.

    • Developer Sandbox

      Spin up Red Hat's products and technologies without setup or configuration.

  • Download products

    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products
  • Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset
  • References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
Community
  • Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions
  • Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github
  • Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

Join the Red Hat Developer program

Download Red Hat products and project builds, access support documentation, learning content, and more.

ConsoleDocsSupport Search
New For you

Recommended

We'll recommend resources you may like as you browse. Try these suggestions for now.

  • Product downloads
  • Cheat sheets
  • Red Hat Developer learning portal
  • Developer blog
  • E-books
  • Developer Sandbox
Log in

Get more with a Red Hat Developer account

  • Product downloads
  • Console access
  • Event registration
  • Training & trials
Explore more account benefitsLog in or register

A subscription may be required for some services.

Contact us

Building and running Bazel applications on AutoSD: Toolchains, containers, and recommended practices

June 10, 2026
Bilal Elmoussaoui
Related topics:
Application development and deliveryDeveloper tools
Related products:
Red Hat Enterprise Linux

    Bazel is an open source build system that automates software builds and tests. Supported build tasks include running compilers and linkers to produce executable programs and libraries, and assembling deployable packages. Similar to tools like Make, Ant, Gradle, and Maven, Bazel supports multiple languages, repositories, and platforms in an industry-leading ecosystem. Reproducibility, scalability, and cross-platform consistency are key design goals of Bazel's hermetic and declarative build model, which has driven its adoption among original equipment manufacturers (OEMs). This article explores practical approaches for building and running Bazel applications on Automotive Stream Distribution (AutoSD), focusing on toolchain integration and reproducible environments.

    Integrating platform-specific environments like AutoSD with Bazel is challenging because Bazel requires explicit configuration of toolchains, including compilers and system dependencies. This complexity is particularly acute when targeting embedded or specialized runtime ecosystems.

    There are three practical approaches to building and running Bazel applications on AutoSD: A native AutoSD GCC toolchain, an abstracted S-CORE toolchain, and a container-based environment.

    Approach 1: Native AutoSD GCC toolchain

    This approach uses a GCC toolchain configured for AutoSD. It integrates directly with Bazel by registering a platform-specific toolchain and explicitly defining compilation flags.

    When to use

    Use this method when:

    • You are targeting AutoSD exclusively
    • You want minimal abstraction and direct control over compiler behavior
    • Your setup does not require multi-platform portability

    Setup

    Start by declaring the AutoSD dependency and configuring the toolchain in MODULE.bazel:

    bazel_dep(name = "os_autosd", version = "1.0.0")
    git_override(
        module_name = "os_autosd",
        remote = "https://github.com/eclipse-score/inc_os_autosd",
        commit = "a78e559cf81754c199c926229dc6b4443e1ff149",
     )
    
    autosd_10_gcc = use_extension("@os_autosd//toolchain/autosd_10_gcc:extensions.bzl", "autosd_10_gcc_extension")
    autosd_10_gcc.configure(
        c_flags = ["-fPIC"],
        cxx_flags = ["-fPIC"],
    )
    
    use_repo(autosd_10_gcc, "autosd_10_gcc_repo")

    This configuration registers the AutoSD GCC toolchain and applies the required compilation flags for C and C++ targets.

    Build execution

    You can invoke the build using the toolchain with the bazel command:

    bazel build //... --extra_toolchains=@autosd_10_gcc_repo//:gcc_toolchain_linux_x86_64

    Alternatively, define it in a .bazelrc file:

    build --extra_toolchains=@autosd_10_gcc_repo//:gcc_toolchain_linux_x86_64

    Then run:

    bazel build //...

    Advantages

    • Simple and explicit configuration
    • Minimal abstraction

    Limitations

    • Tightly coupled to AutoSD
    • Not suitable for multi-platform builds
    • Requires duplication if additional platforms are introduced
    • Potential runtime incompatibilities (for example, glibc version mismatches) if the build environment diverges from the target AutoSD runtime
    • Requires host dependencies (rpm2cpio and cpio) to extract RPM packages used for toolchain setup

    Approach 2: S-Core abstracted GCC toolchain

    The S-Core toolchain provides an abstraction layer over multiple supported platforms, such as AutoSD and QNX. Instead of binding builds to a single environment, this approach defines a unified toolchain interface that Bazel can use to target different runtime ecosystems through platform configuration.

    When to use

    Use this method when:

    • You need to support multiple target platforms (for example, AutoSD, QNX)
    • You want a standardized toolchain strategy for CI/CD pipelines
    • You aim to minimize platform-specific build logic in application code

    Setup

    Begin by declaring the S-Core toolchain dependency and configuring the GCC toolchain extension in MODULE.bazel:

    
    bazel_dep(name = "score_bazel_cpp_toolchains", version = "0.4.0")
    
    git_override(
        module_name = "score_bazel_cpp_toolchains",
        remote = "https://github.com/eclipse-score/bazel_cpp_toolchains.git",
        commit = "e3383755e166262b7d647608d26dfb0ae9895c93",
    )
    
    bazel_dep(name = "score_bazel_platforms", version = "0.1.0")
    
    gcc = use_extension("@score_bazel_cpp_toolchains//extensions:gcc.bzl", "gcc")
    
    gcc.toolchain(
        name = "score_autosd_10_toolchain",
        target_cpu = "x86_64",
        target_os = "linux",
        runtime_ecosystem = "autosd10",
        use_default_package = True,
    )
    
    use_repo(gcc, "score_autosd_10_toolchain")
    
    register_toolchains("@score_autosd_10_toolchain//:x86_64-linux-autosd10")

    This configuration defines a reusable toolchain that abstracts the underlying AutoSD-specific details while remaining compatible with other supported platforms.

    Build execution

    To build using this toolchain, specify the corresponding platform:

    bazel build //... --platforms=@score_bazel_platforms//:x86_64-linux-autosd10

    Alternatively, define it in .bazelrc:

    build --platforms=@score_bazel_platforms//:x86_64-linux-autosd10

    Then run:

    bazel build //... 

    Advantages

    • Enables multi-platform builds with a single configuration
    • Well-suited for CI/CD environments and automated testing
    • Reduces duplication of toolchain definitions

    Limitations

    • Adds an abstraction layer that might obscure low-level configuration
    • Requires alignment with S-Core conventions and ecosystem
    • Potential runtime incompatibilities (such as glibc version mismatches) if the build environment diverges from the target AutoSD runtime

    Approach 3: Containerized AutoSD build environment

    This approach encapsulates the AutoSD build environment inside a container image with all required dependencies pre-installed, including GCC and Bazel. Instead of configuring a Bazel toolchain explicitly, Bazel uses the toolchain available within the container's runtime environment. You might need to double check whether you have a local .bazelrc file forcing any particular toolchain for your project.

    This method emphasizes reproducibility and isolation by standardizing the build environment across developers and CI systems.

    When to use

    Use this method when:

    • You need fully consistent development builds and CI environments across machines. You want to avoid complex Bazel toolchain configuration
    • You are already using container-based workflows (for example, CI pipelines)

    Setup

    Create a container image with the required build dependencies. Below is a minimal example:

    FROM quay.io/centos/centos:stream10
    
    RUN dnf update -y && \
        dnf install -y \
            wget \
            ca-certificates \
            unzip \
            which \
            gcc \
            gcc-c++ \
            libstdc++ \
            libstdc++-devel \
            rpm \
            cpio \
            java-21-openjdk-devel \
            git \
            rpm-build
    
    RUN wget https://github.com/bazelbuild/bazel/releases/download/8.6.0/bazel-8.6.0-installer-linux-x86_64.sh
    
    RUN chmod +x ./bazel-8.6.0-installer-linux-x86_64.sh && ./bazel-8.6.0-installer-linux-x86_64.sh
    
    RUN rm -f ./bazel-8.6.0-installer-linux-x86_64.sh
    
    # Verify installation
    RUN bazel --help
    
    CMD ["/bin/bash"]

    Note: Some projects may require a specific Bazel version, so in that case the installed version in the container here would need to be adjusted.

    Build the container image:

    podman build -t localhost/bazel_autosd10:latest .

    Build execution

    Run Bazel inside the container while mounting your workspace and cache:

    podman run --rm \-v "$(pwd)":/workspace:Z \-v "$HOME/.cache/bazel:/root/.cache/bazel:Z" \-w /workspace \localhost/bazel_autosd10:latest \bash -c "bazel build //..."

    Advantages

    • Strong environment consistency
    • Minimal Bazel-specific configuration required
    • Easy integration into CI/CD platforms
    • Simplifies onboarding for new developers
    • Controlled and consistent runtime environment, reducing the risk of glibc or system library mismatches

    Limitations

    • Less explicit control over Bazel toolchain resolution
    • Potential mismatch between container and target runtime (if not carefully managed)
    • Might introduce overhead in build startup time

    Conclusion

    Each approach offers different tradeoffs for building applications with Bazel on AutoSD. The project GitHub repository contains all three implementations, providing a practical starting point for exploring and adopting these setups.

    Related Posts

    • New features in GCC 16: Improved error messages and SARIF output

    • GCC and gcc-toolset versions in RHEL: An explainer

    • 6 usability improvements in GCC 15

    • Package and run your Java Maven application on OpenShift in seconds

    Recent Posts

    • A day in the life of an NVIDIA H100 on Red Hat OpenShift 5

    • Migrate BuildConfigs to builds for Red Hat OpenShift with one plug-in install

    • Run Red Hat Enterprise Linux CoreOS on NVIDIA BlueField DPUs

    • Agent harness engineering: Separating model capabilities from enforcement

    • What's new for developers in Red Hat Enterprise Linux 10.3 and 9.9

    What’s up next?

    Share graphics_advanced Linux commands

    Advanced Linux commands cheat sheet

    Bob Reselman
    Red Hat Developers logo

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    Red Hat Developer

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility
    Ask AI