Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

{
"name": "eclipse-s-core",
"image": "ghcr.io/eclipse-score/devcontainer:v1.2.0"
}
7 changes: 7 additions & 0 deletions examples/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,10 @@ build:target_config_3 --extra_toolchains=@score_aarch64_gcc_toolchain//:aarch64-
build:target_config_4 --config=host_config_1
build:target_config_4 --platforms=@score_bazel_platforms//:x86_64-linux-autosd10
build:target_config_4 --extra_toolchains=@score_autosd_10_toolchain//:x86_64-linux-autosd10

# -------------------------------------------------------------------------------
# Config dedicated to target platform CPU:aarch64 and OS:ebclfsa
# -------------------------------------------------------------------------------
build:aarch64-ebclfsa --config=shared
build:aarch64-ebclfsa --platforms=@score_bazel_platforms//:aarch64-linux-sdk_0.1.0-ebclfsa
build:aarch64-ebclfsa --extra_toolchains=@score_ebclfsa_toolchain//:aarch64-linux-sdk_0.1.0-ebclfsa
13 changes: 13 additions & 0 deletions examples/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,18 @@ gcc.toolchain(
use_default_package = True,
)

# *******************************************************************************
# Setting EBcLfSA 0.1.0 GCC (CPU:aarch64|OS:Linux|V:ebclfsa-0.1.0|ES:ebclfsa)
# *******************************************************************************
gcc.toolchain(
name = "score_ebclfsa_toolchain",
target_os = "linux",
target_cpu = "aarch64",
runtime_ecosystem = "ebclfsa",
sdk_version = "0.1.0",
use_default_package = True,
)

use_repo(
gcc,
"my_toolchain",
Expand All @@ -153,6 +165,7 @@ use_repo(
"score_gcc_toolchain",
"score_qcc_arm_toolchain",
"score_qcc_toolchain",
"score_ebclfsa_toolchain",
)

# register_toolchains(
Expand Down
7 changes: 7 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ bazel build --config=target_config_3 //:main_cpp
bazel build --config=target_config_3 //:main_pthread_cpp
```

**Build for EB corbos Linux for Safety Applications (ARM64):**
```bash
bazel build --config=aarch64-ebclfsa //:main_cpp
bazel build --config=aarch64-ebclfsa //:main_pthread_cpp
bazel test --config=aarch64-ebclfsa //:math_lib_test # this works if you have qemu-user-static installed and configured correctly
```

### QNX Target Builds

> **Note:** Take care of license requirements when using these toolchains and dependencies in your projects.
Expand Down
5 changes: 4 additions & 1 deletion examples/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@ bazel build --config target_config_3 //:main_cpp
bazel clean --expunge
echo -e "Testing 'target_config_4' ..."
bazel build --config target_config_4 //:main_cpp
bazel clean --expunge
bazel clean --expunge
echo -e "Testing 'aarch64-ebclfsa' ..."
bazel build --config aarch64-ebclfsa //:main_cpp
bazel clean --expunge
6 changes: 5 additions & 1 deletion extensions/gcc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ _attrs_tc = {
mandatory = False,
doc = "Version of the GCC toolchain.",
),

"ld_library_paths": attr.string_list(
mandatory = False,
default = [],
doc = "List of paths relative to the sysroot which should build up the runtime linker path of the tools of this toolchain.",
),
}

def _get_packages(tags):
Expand Down
5 changes: 5 additions & 0 deletions packages/linux/aarch64/autosd/10.0/autosd.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ filegroup(
srcs = ["usr/bin/strip"],
)

filegroup(
name = "ld_library_paths",
srcs = [],
)

# The sysroot for AutoSD is the entire extracted directory
# since it contains usr/ and lib64/ at the root
filegroup(
Expand Down
16 changes: 16 additions & 0 deletions packages/linux/aarch64/ebclfsa/0.1.0/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# *******************************************************************************
# Copyright (c) 2025 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************

exports_files([
"ebclfsa.BUILD",
])
67 changes: 67 additions & 0 deletions packages/linux/aarch64/ebclfsa/0.1.0/ebclfsa.BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# *******************************************************************************
# Copyright (c) 2025 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************

"""Build file for EBcLfSA 0.1.0 toolchain package"""

package(default_visibility = ["//visibility:public"])

filegroup(
name = "all_files",
srcs = glob(["*/**/*"], exclude = ["usr/share/ca-certificates/**","usr/lib/ssl/certs/**", "lib/ssl/certs/**", "etc/ssl/certs/**", "usr/share/man/**", "usr/share/perl/**", "var/lib/**"]),
)

filegroup(
name = "bin",
srcs = ["usr/bin"],
)

filegroup(
name = "ar",
srcs = ["usr/bin/aarch64-linux-gnu-ar"],
)

filegroup(
name = "cc",
srcs = ["usr/bin/aarch64-linux-gnu-gcc-13.bin"],
)

filegroup(
name = "gcov",
srcs = ["usr/bin/aarch64-linux-gnu-gcov-13"],
)

filegroup(
name = "cxx",
srcs = ["usr/bin/aarch64-linux-gnu-g++-13.bin"],
)

filegroup(
name = "strip",
srcs = ["usr/bin/aarch64-linux-gnu-strip"],
)

filegroup(
name = "elf-enabler",
srcs = ["usr/bin/lisa-elf-enabler"],
)

filegroup(
name = "ld_library_paths",
srcs = ["usr/lib/x86_64-linux-gnu", "lib/x86_64-linux-gnu"],
)

# The sysroot for EBcLfSA is the entire extracted directory
filegroup(
name = "sysroot_dir",
srcs = ["."],
)
5 changes: 5 additions & 0 deletions packages/linux/aarch64/gcc/12.2.0/gcc.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ filegroup(
srcs = ["bin/aarch64-unknown-linux-gnu-strip"],
)

filegroup(
name = "ld_library_paths",
srcs = [],
)

filegroup(
name = "sysroot_dir",
srcs = ["aarch64-unknown-linux-gnu/sysroot"],
Expand Down
5 changes: 5 additions & 0 deletions packages/linux/x86_64/autosd/10.0/autosd.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ filegroup(
srcs = ["usr/bin/strip"],
)

filegroup(
name = "ld_library_paths",
srcs = [],
)

# The sysroot for AutoSD is the entire extracted directory
# since it contains usr/ and lib64/ at the root
filegroup(
Expand Down
5 changes: 5 additions & 0 deletions packages/linux/x86_64/gcc/12.2.0/gcc.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ filegroup(
srcs = ["bin/x86_64-unknown-linux-gnu-strip"],
)

filegroup(
name = "ld_library_paths",
srcs = [],
)

filegroup(
name = "sysroot_dir",
srcs = ["x86_64-unknown-linux-gnu/sysroot"],
Expand Down
58 changes: 58 additions & 0 deletions packages/version_matrix.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,64 @@ VERSION_MATRIX = {
"strip_prefix": "sysroot",
"url": "https://github.com/eclipse-score/inc_os_autosd/releases/download/continuous/autosd-toolchain-x86_64.tar.gz",
},
"aarch64-linux-sdk_0.1.0-ebclfsa": {
"build_file": "@score_bazel_cpp_toolchains//packages/linux/aarch64/ebclfsa/0.1.0:ebclfsa.BUILD",
"extra_c_compile_flags": [
"-nostdinc",
"-isystem",
"external/%{toolchain_pkg}%/usr/lib/gcc-cross/aarch64-linux-gnu/13/include",
"-isystem",
"external/%{toolchain_pkg}%/usr/aarch64-linux-gnu/include",
"-L",
"external/%{toolchain_pkg}%/lib/aarch64-linux-gnu",
"-L",
"external/%{toolchain_pkg}%/usr/aarch64-linux-gnu/lib",
"-L",
"external/%{toolchain_pkg}%/usr/lib/x86_64-linux-gnu",
"--no-canonical-prefixes",
],
"extra_cxx_compile_flags": [
"-nostdinc++",
"-isystem",
"external/%{toolchain_pkg}%/usr/aarch64-linux-gnu/include/c++/13",
"-isystem",
"external/%{toolchain_pkg}%/usr/aarch64-linux-gnu/include/c++/13/aarch64-linux-gnu",
"-isystem",
"external/%{toolchain_pkg}%/usr/aarch64-linux-gnu/include/c++/13/backward",
"-nostdinc",
"-isystem",
"external/%{toolchain_pkg}%/usr/lib/gcc-cross/aarch64-linux-gnu/13/include",
"-isystem",
"external/%{toolchain_pkg}%/usr/aarch64-linux-gnu/include",
"-L",
"external/%{toolchain_pkg}%/lib/aarch64-linux-gnu",
"-L",
"external/%{toolchain_pkg}%/usr/aarch64-linux-gnu/lib",
"-L",
"external/%{toolchain_pkg}%/usr/lib/x86_64-linux-gnu",
"--no-canonical-prefixes",
],
"extra_link_flags": [
"-B",
"external/%{toolchain_pkg}%/usr/aarch64-linux-gnu/bin",
"-L",
"external/%{toolchain_pkg}%/lib/aarch64-linux-gnu",
"-L",
"external/%{toolchain_pkg}%/usr/aarch64-linux-gnu/lib",
"-L",
"external/%{toolchain_pkg}%/usr/lib/x86_64-linux-gnu",
"-lm",
"-ldl",
"-lrt",
"-static-libstdc++",
"-static-libgcc",
"-static",
"--no-canonical-prefixes",
],
"strip_prefix": "fastdev-sdk-ubuntu-ebclfsa-ebcl-qemuarm64",
"sha256": "56ebcf0476d1cb7651304a42a7ac40b23a93655d075926ddb32fed316c22d811",
"url": "https://github.com/elektrobit-contrib/eclipse-score_toolchains_gcc/releases/download/0.6.0-beta/fastdev-sdk-ubuntu-ebclfsa-ebcl-qemuarm64.tar.gz",
},
"x86_64-qnx-sdp_8.0.0": {
"build_file": "@score_bazel_cpp_toolchains//packages/qnx/x86_64/sdp/8.0.0:sdp.BUILD",
"sha256": "f2e0cb21c6baddbcb65f6a70610ce498e7685de8ea2e0f1648f01b327f6bac63",
Expand Down
2 changes: 2 additions & 0 deletions rules/gcc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ cc_toolchain_config(
cxx_binary = "@{tc_pkg_repo}//:cxx",
gcov_binary = "@{tc_pkg_repo}//:gcov",
strip_binary = "@{tc_pkg_repo}//:strip",
ld_library_path_dirs = "@{tc_pkg_repo}//:ld_library_paths",
sysroot = "@{tc_pkg_repo}//:sysroot_dir",
target_cpu = "{tc_cpu}",
target_os = "{tc_os}",
Expand Down Expand Up @@ -81,6 +82,7 @@ cc_toolchain_config(
host_dir = "@{tc_pkg_repo}//:host_dir",
target_dir = "@{tc_pkg_repo}//:target_dir",
cxx_builtin_include_directories = "@{tc_pkg_repo}//:cxx_builtin_include_directories",
ld_library_path_dirs = "@{tc_pkg_repo}//:ld_library_path_dirs",
target_cpu = "{tc_cpu}",
target_os = "{tc_os}",
visibility = ["//visibility:public"],
Expand Down
23 changes: 23 additions & 0 deletions templates/linux/cc_toolchain_config.bzl.template
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES")
load("@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl",
"action_config",
"env_entry",
"env_set",
"feature",
"feature_set",
"flag_group",
Expand Down Expand Up @@ -654,7 +656,27 @@ def _impl(ctx):
sysroot = None
if ctx.attr.sysroot != None:
sysroot = ctx.attr.sysroot[DefaultInfo].files.to_list()[0].path

# Get ld_library_paths from attribute if provided and set LD_LIBRARY_PATH environment variable for actions
if hasattr(ctx.attr, "ld_library_path_dirs") and ctx.attr.ld_library_path_dirs and ctx.attr.ld_library_path_dirs[DefaultInfo].files.to_list():
values = ["/proc/self/cwd/" + entry.path for entry in ctx.attr.ld_library_path_dirs[DefaultInfo].files.to_list()]
ld_library_path = ":".join(values)

sdk_env_feature = feature(
name = "sdk_env",
enabled = True,
env_sets = [
env_set(
actions = all_actions,
env_entries = [
env_entry(key = "LD_LIBRARY_PATH", value = ld_library_path),
],
),
],
)

features.append(sdk_env_feature)

return cc_common.create_cc_toolchain_config_info(
ctx = ctx,
abi_version = "%{tc_abi_version}",
Expand Down Expand Up @@ -687,5 +709,6 @@ cc_toolchain_config = rule(
"host_dir": attr.label(default = None),
"target_dir": attr.label(default = None),
"cxx_builtin_include_directories": attr.label(allow_files = True, default = None),
"ld_library_path_dirs": attr.label(allow_files = True, default = None),
},
)