Skip to content

Commit 98a78ee

Browse files
committed
Refactor inclusion of compiler libraries
1 parent d49d68d commit 98a78ee

File tree

11 files changed

+99
-54
lines changed

11 files changed

+99
-54
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2026 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
13+
name: Bazel Build (Aarch64-Linux)(ebclfsa)
14+
on:
15+
pull_request:
16+
types: [opened, reopened, synchronize]
17+
push:
18+
branches:
19+
- main
20+
merge_group:
21+
types: [checks_requested]
22+
workflow_call:
23+
jobs:
24+
aarch64-ebclfsa:
25+
runs-on: ubuntu-latest
26+
defaults:
27+
run:
28+
working-directory: ./examples
29+
steps:
30+
- name: Checkout Repository
31+
uses: actions/checkout@v6
32+
- name: Setup Bazel
33+
uses: bazel-contrib/setup-bazel@0.18.0
34+
with:
35+
bazelisk-cache: true
36+
disk-cache: ${{ github.job }}
37+
repository-cache: true
38+
cache-save: ${{ github.event_name == 'push' }}
39+
- name: Bazel Build (basic)
40+
run: |
41+
bazel build --config aarch64-ebclfsa -- //:main_cpp
42+

examples/MODULE.bazel.lock

Lines changed: 13 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extensions/gcc.bzl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ def _get_toolchains(tags):
187187
"sdk_version": tag.sdk_version,
188188
"sdp_to_link": tag.sdp_to_link,
189189
"sdp_version": tag.sdp_version,
190+
"tc_compiler_library_search_paths": [],
190191
"tc_cpu": tag.target_cpu,
191192
"tc_extra_c_compile_flags": tag.extra_c_compile_flags,
192193
"tc_extra_compile_flags": tag.extra_compile_flags,
@@ -232,6 +233,8 @@ def _create_and_link_sdp(toolchain_info):
232233
toolchain_info["tc_extra_link_flags"] = matrix["extra_link_flags"]
233234
if "gcc_version" in matrix and not toolchain_info["gcc_version"]:
234235
toolchain_info["gcc_version"] = matrix["gcc_version"]
236+
if "compiler_library_search_paths" in matrix:
237+
toolchain_info["tc_compiler_library_search_paths"] = matrix["compiler_library_search_paths"]
235238

236239
return {
237240
"build_file": matrix["build_file"],
@@ -324,6 +327,7 @@ def _impl(mctx):
324327
license_path = toolchain_info["tc_license_path"],
325328
sdk_version = toolchain_info["sdk_version"],
326329
sdp_version = toolchain_info["sdp_version"],
330+
tc_compiler_library_search_paths = toolchain_info["tc_compiler_library_search_paths"],
327331
tc_cpu = toolchain_info["tc_cpu"],
328332
tc_identifier = toolchain_info["tc_identifier"],
329333
tc_os = toolchain_info["tc_os"],

packages/linux/aarch64/autosd/10.0/autosd.BUILD

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,6 @@ filegroup(
5050
srcs = ["usr/bin/strip"],
5151
)
5252

53-
filegroup(
54-
name = "ld_library_paths",
55-
srcs = [],
56-
)
57-
5853
# The sysroot for AutoSD is the entire extracted directory
5954
# since it contains usr/ and lib64/ at the root
6055
filegroup(

packages/linux/aarch64/ebclfsa/0.1.0/ebclfsa.BUILD

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,18 @@ package(default_visibility = ["//visibility:public"])
1717

1818
filegroup(
1919
name = "all_files",
20-
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/**"]),
20+
srcs = glob(
21+
["*/**/*"],
22+
exclude = [
23+
"usr/share/ca-certificates/**",
24+
"usr/lib/ssl/certs/**",
25+
"lib/ssl/certs/**",
26+
"etc/ssl/certs/**",
27+
"usr/share/man/**",
28+
"usr/share/perl/**",
29+
"var/lib/**",
30+
],
31+
),
2132
)
2233

2334
filegroup(
@@ -55,11 +66,6 @@ filegroup(
5566
srcs = ["usr/bin/lisa-elf-enabler"],
5667
)
5768

58-
filegroup(
59-
name = "ld_library_paths",
60-
srcs = ["usr/lib/x86_64-linux-gnu", "lib/x86_64-linux-gnu"],
61-
)
62-
6369
# The sysroot for EBcLfSA is the entire extracted directory
6470
filegroup(
6571
name = "sysroot_dir",

packages/linux/aarch64/gcc/12.2.0/gcc.BUILD

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,7 @@ filegroup(
5050
srcs = ["bin/aarch64-unknown-linux-gnu-strip"],
5151
)
5252

53-
filegroup(
54-
name = "ld_library_paths",
55-
srcs = [],
56-
)
57-
5853
filegroup(
5954
name = "sysroot_dir",
6055
srcs = ["aarch64-unknown-linux-gnu/sysroot"],
61-
)
56+
)

packages/linux/x86_64/autosd/10.0/autosd.BUILD

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,6 @@ filegroup(
5050
srcs = ["usr/bin/strip"],
5151
)
5252

53-
filegroup(
54-
name = "ld_library_paths",
55-
srcs = [],
56-
)
57-
5853
# The sysroot for AutoSD is the entire extracted directory
5954
# since it contains usr/ and lib64/ at the root
6055
filegroup(
@@ -67,10 +62,10 @@ filegroup(
6762
filegroup(
6863
name = "cxx_builtin_include_directories",
6964
srcs = [
70-
"usr/lib/gcc/x86_64-redhat-linux/14/include",
7165
"usr/include",
7266
"usr/include/c++/14",
73-
"usr/include/c++/14/x86_64-redhat-linux",
7467
"usr/include/c++/14/backward",
68+
"usr/include/c++/14/x86_64-redhat-linux",
69+
"usr/lib/gcc/x86_64-redhat-linux/14/include",
7570
],
7671
)

packages/linux/x86_64/gcc/12.2.0/gcc.BUILD

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,7 @@ filegroup(
5050
srcs = ["bin/x86_64-unknown-linux-gnu-strip"],
5151
)
5252

53-
filegroup(
54-
name = "ld_library_paths",
55-
srcs = [],
56-
)
57-
5853
filegroup(
5954
name = "sysroot_dir",
6055
srcs = ["x86_64-unknown-linux-gnu/sysroot"],
61-
)
56+
)

packages/version_matrix.bzl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,10 @@ VERSION_MATRIX = {
178178
"-static",
179179
"--no-canonical-prefixes",
180180
],
181+
"compiler_library_search_paths": [
182+
"external/%{toolchain_pkg}%/usr/lib/x86_64-linux-gnu",
183+
"external/%{toolchain_pkg}%/lib/x86_64-linux-gnu",
184+
],
181185
"strip_prefix": "fastdev-sdk-ubuntu-ebclfsa-ebcl-qemuarm64",
182186
"sha256": "f44286c28d831dc40acdac08ef49f38a2e9cbb057bea38c25834964693785287",
183187
"url": "https://github.com/Elektrobit/eb_corbos_toolkit/releases/download/v2.0.0-beta1/fastdev-sdk-ubuntu-ebclfsa-ebcl-qemuarm64.tar.gz",

rules/gcc.bzl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ cc_toolchain_config(
5050
cxx_binary = "@{tc_pkg_repo}//:cxx",
5151
gcov_binary = "@{tc_pkg_repo}//:gcov",
5252
strip_binary = "@{tc_pkg_repo}//:strip",
53-
ld_library_path_dirs = "@{tc_pkg_repo}//:ld_library_paths",
5453
sysroot = "@{tc_pkg_repo}//:sysroot_dir",
5554
target_cpu = "{tc_cpu}",
5655
target_os = "{tc_os}",
@@ -157,8 +156,11 @@ def _impl(rctx):
157156
extra_c_compile_flags = get_flag_groups(replace_placeholder(rctx.attr.extra_c_compile_flags))
158157
extra_cxx_compile_flags = get_flag_groups(replace_placeholder(rctx.attr.extra_cxx_compile_flags))
159158
extra_link_flags = get_flag_groups(replace_placeholder(rctx.attr.extra_link_flags))
159+
compiler_library_search_paths = replace_placeholder(rctx.attr.tc_compiler_library_search_paths)
160160

161161
template_dict = {
162+
"%{compiler_library_search_paths_switch}": "True" if len(rctx.attr.tc_compiler_library_search_paths) else "False",
163+
"%{compiler_library_search_paths}": ":".join(["/proc/self/cwd/" + entry for entry in compiler_library_search_paths]),
162164
"%{extra_c_compile_flags_switch}": "True" if len(rctx.attr.extra_c_compile_flags) else "False",
163165
"%{extra_c_compile_flags}": extra_c_compile_flags,
164166
"%{extra_compile_flags_switch}": "True" if len(rctx.attr.extra_compile_flags) else "False",
@@ -230,6 +232,7 @@ gcc_toolchain = repository_rule(
230232
"license_path": attr.string(doc = "Lincese path"),
231233
"sdk_version": attr.string(doc = "SDK version string"),
232234
"sdp_version": attr.string(doc = "SDP version string"),
235+
"tc_compiler_library_search_paths": attr.string_list(doc = "Additional search path which compiler needs."),
233236
"tc_cpu": attr.string(doc = "Target platform CPU."),
234237
"tc_identifier": attr.string(doc = "Constraint to be used for toolchain definition (e.g. gcc_12.2.0)."),
235238
"tc_os": attr.string(doc = "Target platform OS."),

0 commit comments

Comments
 (0)