Skip to content

Fix cargo build faliure#45

Open
dcleoliu wants to merge 13 commits intoeclipse-score:mainfrom
dcleoliu:fix/cargo-build
Open

Fix cargo build faliure#45
dcleoliu wants to merge 13 commits intoeclipse-score:mainfrom
dcleoliu:fix/cargo-build

Conversation

@dcleoliu
Copy link
Contributor

@dcleoliu dcleoliu commented Mar 1, 2026

Fix cargo build failure. Verified with both cargo and bazel building.

@github-actions
Copy link

github-actions bot commented Mar 1, 2026

License Check Results

🚀 The license check job ran with the Bazel command:

bazel run //:license-check

Status: ⚠️ Needs Review

Click to expand output
[License Check Output]
Starting local Bazel server (8.3.0) and connecting to it...
INFO: Invocation ID: c66d442a-9f63-4faa-b32a-9fdcd1bcb3a1
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Loading: 
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
    currently loading: 
Loading: 0 packages loaded
    currently loading: 
Analyzing: target //:license-check (1 packages loaded, 0 targets configured)
Analyzing: target //:license-check (1 packages loaded, 0 targets configured)

Analyzing: target //:license-check (13 packages loaded, 9 targets configured)

Analyzing: target //:license-check (74 packages loaded, 9 targets configured)

Analyzing: target //:license-check (85 packages loaded, 9 targets configured)

Analyzing: target //:license-check (89 packages loaded, 9 targets configured)

Analyzing: target //:license-check (89 packages loaded, 9 targets configured)

Analyzing: target //:license-check (145 packages loaded, 1083 targets configured)

Analyzing: target //:license-check (145 packages loaded, 1083 targets configured)

Analyzing: target //:license-check (145 packages loaded, 1083 targets configured)

Analyzing: target //:license-check (155 packages loaded, 2708 targets configured)

Analyzing: target //:license-check (162 packages loaded, 3172 targets configured)

Analyzing: target //:license-check (162 packages loaded, 3172 targets configured)

Analyzing: target //:license-check (162 packages loaded, 3172 targets configured)

Analyzing: target //:license-check (163 packages loaded, 3172 targets configured)

Analyzing: target //:license-check (170 packages loaded, 5110 targets configured)

Analyzing: target //:license-check (171 packages loaded, 5234 targets configured)

Analyzing: target //:license-check (177 packages loaded, 5444 targets configured)
[10 / 17] Creating runfiles tree bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/score_tooling+/dash/tool/formatters/dash_format_converter.runfiles [for tool]; 0s local ... (2 actions running)
Analyzing: target //:license-check (199 packages loaded, 5537 targets configured)
[13 / 17] JavaToolchainCompileClasses external/rules_java+/toolchains/platformclasspath_classes; 0s disk-cache, processwrapper-sandbox ... (2 actions running)
INFO: From Generating Dash formatted dependency file ...:
INFO: Successfully converted 248 packages from Cargo.lock to bazel-out/k8-fastbuild/bin/formatted.txt
Analyzing: target //:license-check (199 packages loaded, 5537 targets configured)
[16 / 17] [Prepa] Building license.check.license_check.jar ()
Analyzing: target //:license-check (199 packages loaded, 5537 targets configured)
[17 / 17] no actions running
Analyzing: target //:license-check (199 packages loaded, 5537 targets configured)
[17 / 17] no actions running
INFO: Analyzed target //:license-check (200 packages loaded, 9871 targets configured).
INFO: Found 1 target...
Target //:license.check.license_check up-to-date:
  bazel-bin/license.check.license_check
  bazel-bin/license.check.license_check.jar
INFO: Elapsed time: 34.170s, Critical Path: 3.54s
INFO: 17 processes: 12 internal, 4 processwrapper-sandbox, 1 worker.
INFO: Build completed successfully, 17 total actions
INFO: Running command line: bazel-bin/license.check.license_check ./formatted.txt <args omitted>
usage: org.eclipse.dash.licenses.cli.Main [-batch <int>] [-cd <url>]
       [-confidence <int>] [-ef <url>] [-excludeSources <sources>] [-help] [-lic
       <url>] [-project <shortname>] [-repo <url>] [-review] [-summary <file>]
       [-timeout <seconds>] [-token <token>]

@github-actions
Copy link

github-actions bot commented Mar 1, 2026

The created documentation from the pull request is available at: docu-html

@masc2023
Copy link
Contributor

masc2023 commented Mar 2, 2026

@dcleoliu , thank you for the contribution. Please sign the eca first, before your contribution can be accepted

impl<const NUM_STEPS: usize> LoopDurationMeter<NUM_STEPS> {
pub fn track(&mut self, duration: &feo_time::Duration) {
self.duration_micros += duration.subsec_micros() as usize + 1000000 * duration.as_secs() as usize;
self.duration_micros += duration.0.subsec_micros() as usize + 1000000 * duration.as_secs() as usize;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duration should provide the subsec_micros method instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I have added a subsec_micros() method to feo_time::Duration and updated the call sites to use it.


// Calculate the startup time of the primary agent
let startup_time = std::time::SystemTime::UNIX_EPOCH + sync_info.since_epoch.into();
let startup_time = std::time::SystemTime::UNIX_EPOCH + sync_info.since_epoch.0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is wrong with into here? I think we should avoid using direct field access outside of feo_time crate

Copy link
Contributor Author

@dcleoliu dcleoliu Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that direct field access should be avoided.

I previously used .0 because using .into() here triggered a type inference ambiguity error. Since SystemTime implements Add for multiple duration types(e.g., from std and the time crate), the compiler couldn't resolve the target type for the generic Into<T>.

I've now refactored this to use an explicit core::time::Duration::from(...) conversion.

data = ["//tests/rust/feo_tests/test_agent"],
edition = "2024",
deps = [
"@feo_crates//:nix",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the dependencies must be from score_crates

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried switching back to @score_crates//:nix as requested, but the Bazel build for feo_tests failed with unresolved imports for nix::sys::signal::Signal and nix::unistd::Pid. It seems score_crates doesn't currently enable the signal and process features for nix.

Could you share any advice on how I should handle this according to project standards?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we need to add missing features directly into score_crates and update the dependency in MODULE.bazel when it's merged and the features are available.

Cargo.toml Outdated
tracing = { version = "0.1.41", features = [
"attributes",
], default-features = false }
rand = "0.8.5"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of the crates are downgraded, why is it necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The downgrades in the previous commit were accidental, likely introduced while I was troubleshooting environment-specific build issues. I have now restored all dependency versions to match main

The only intentional changes remaining are:

  1. Updating tokio to 1.47.1 (aligned with main) and explicitly enabling the rt-multi-thread feature to fix a cargo compilation error in feo-tracer.
  2. Enabling the process feature for nix to support feo_tests.

bazel_dep(name = "rules_rust_prost", version = "0.67.0")

# score_crates 0.0.6 only enables ["fs", "mman"] for nix, but feo_tests also needs
# ["signal", "process"]. Define a local crate repository with the full feature set.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be handled in score_crates, not in feo

use alloc::borrow::ToOwned as _;
use alloc::boxed::Box;
use feo_com::interface::ActivityInput;
use score_log::fmt::ScoreDebug;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it because of editor extension limitations?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the import because Clippy flagged it as an unused_import, causing the CI build to fail (this build). The ScoreDebug trait is referenced via score_log::fmt::ScoreDebug on line 55, making the top-level import redundant. I think this fits the style better here.

@johannes-esr
Copy link
Contributor

@dcleoliu, right now Cargo is not officially supported, because in S-CORE the goal was to use bazel. Maybe you can also split up the PR and raise PRs for the other functional changes/refactorings?

@dcleoliu
Copy link
Contributor Author

dcleoliu commented Mar 4, 2026

@johannes-esr, thanks for your advice. Yes, I agree that mixing Cargo support might introduce extra complexity and it's better to keep the focus on Bazel.
I'll extract the necessary functional changes and raise separate PRs for them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

4 participants