eclipse-score / eclipse-score/bazel_cpp_toolchains

Broken --sysroot path generation for aarch64 cross-builds

Đã đóng
#142 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Starlark
Star
2
Fork
11
Merge trung bình
2 ngày 8 giờ
Pull request đã merge (30 ngày)
10

Mô tả

### Description

Looking closely at the generated compiler command invocation for an aarch64 build, the `--sysroot` flag is pointing to a single `.so` file instead of the SDK root directory:

`--sysroot=external/score_bazel_cpp_toolchains++gcc+score_cc_autosd10_aarch64_pkg/lib64/CP1252.so`

The template logic generating the sysroot path variable appears to grab the wrong file path from the resolved target package.

This is the output that is generated

> external/score_bazel_cpp_toolchains++gcc+score_cc_autosd10_aarch64_pkg/usr/bin/g++ -U_FORTIFY_SOURCE '-D_XOPEN_SOURCE=700' -fstack-protector '-fdiagnostics-color=always' -fno-omit-frame-pointer -ffunction-sections -fdata-sections -fno-canonical-system-headers -no-canonical-prefixes '-z noexecstack' '-std=c++17' -MD -MF bazel-out/k8-fastbuild/bin/external/score_baselibs+/score/result/_objs/error/error_domain.pic.d '-frandom-seed=bazel-out/k8-fastbuild/bin/external/score_baselibs+/score/result/_objs/error/error_domain.pic.o' -fPIC -iquote external/score_baselibs+ -iquote bazel-out/k8-fastbuild/bin/external/score_baselibs+ '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -Wno-builtin-macro-redefined -Wall -Wcast-align -Wcast-qual -Wformat-nonliteral -Wformat-signedness '-Wformat=2' -Wmissing-format-attribute -Wpointer-arith -Wredundant-decls -Wreturn-local-addr -Wsizeof-array-argument -Wundef -Wwrite-strings -Wodr -Wreorder -Wbool-compare -Wconversion -Wdouble-promotion -Wextra -Winvalid-pch -Wlogical-not-parentheses -Wlogical-op -Wpedantic -Wswitch-bool -Wunused-but-set-parameter -Wvla -Wnarrowing -nostdinc++ -isystem external/score_bazel_cpp_toolchains++gcc+score_cc_autosd10_aarch64_pkg/usr/include/c++/14 -isystem external/score_bazel_cpp_toolchains++gcc+score_cc_autosd10_aarch64_pkg/usr/include/c++/14/aarch64-redhat-linux -isystem external/score_bazel_cpp_toolchains++gcc+score_cc_autosd10_aarch64_pkg/usr/include/c++/14/backward -nostdinc -isystem external/score_bazel_cpp_toolchains++gcc+score_cc_autosd10_aarch64_pkg/usr/lib/gcc/aarch64-redhat-linux/14/include -isystem external/score_bazel_cpp_toolchains++gcc+score_cc_autosd10_aarch64_pkg/usr/include '--**sysroot=external/score_bazel_cpp_toolchains++gcc+score_cc_autosd10_aarch64_pkg/lib64/CP1252.so**' -c external/score_baselibs+/score/result/error_domain.cpp -o bazel-out/k8-fastbuild/bin/external/score_baselibs+/score/result/_objs/error/error_domain.pic.o)
> aarch64-binfmt-P: Could not open '/lib/ld-linux-aarch64.so.1': No such file or directory

### Analysis results

_No response_

### Solution

_No response_

### Error Occurrence Rate

Reproducible

### How to reproduce

- Use score_bazel_cpp_toolchains version 1.0.3.
- use autosd toolchain:

> gcc = use_extension("@score_bazel_cpp_toolchains//extensions:gcc.bzl", "gcc")
> gcc.toolchain(
> name = "score_cc_autosd10_aarch64",
> runtime_ecosystem = "autosd10",
> sdp_to_link = "score_cc_autosd10_aarch64_pkg",
> target_cpu = "aarch64",
> target_os = "linux",
> use_default_package = True,
> )

Build any cc target

### Supporting Information

_No response_

### Classification

Major

### First Affected Release

0.5

### Last Affected Release

1.0

### Expected Fixed Release

before release (main)

### Category

- [ ] Safety Relevant
- [ ] Security Relevant

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Start with the gcc.toolchain entry point in extensions:gcc.bzl and reproduce a cc target build using score_bazel_cpp_toolchains 1.0.3 and the autosd10 aarch64 configuration shown. Trace how the resolved target package supplies the sysroot path, then verify that the generated compiler command uses the SDK root rather than CP1252.so and that the build no longer reports the missing aarch64 loader.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
cpp, linux
Lĩnh vực
build-system, compilers
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
65/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.