Skip to content

Buld for target powerpc-unknown-netbsd fails in 1.31.1; other powerpc targets also fail in the same way in later versions #57037

Closed as not planned
@he32

Description

@he32

While release 1.31.1 of rust fixes the build issue reported in #55465, a new issue arises instead: the rls part of the build now uses AtomicU64, which is not natively supported on 32-bit powerpc, so the build fails with

no 'AtomicU64' in 'sync::atomic'. Did you mean to use 'AtomicU8'?

The following rather crude pair of patches makes the build complete for the target again, but obviously something is lost along the way -- whether that is crucial I am not able to tell myself.

--- src/tools/rls/src/cmd.rs.orig       2018-12-18 23:12:41.000000000 +0000
+++ src/tools/rls/src/cmd.rs
@@ -17,7 +17,7 @@ use crate::config::Config;
 use crate::server::{self, LsService, Notification, Request, RequestId};
 use rls_analysis::{AnalysisHost, Target};
 use rls_vfs::Vfs;
-use std::sync::atomic::{AtomicU64, Ordering};
+use std::sync::atomic::{AtomicU32, Ordering};
 
 use languageserver_types::{
     ClientCapabilities, CodeActionContext, CodeActionParams, CompletionItem,
@@ -424,8 +424,8 @@ fn url(file_name: &str) -> Url {
 }
 
 fn next_id() -> RequestId {
-    static ID: AtomicU64 = AtomicU64::new(1);
-    RequestId::Num(ID.fetch_add(1, Ordering::SeqCst))
+    static ID: AtomicU32 = AtomicU32::new(1);
+    RequestId::Num(ID.fetch_add(1, Ordering::SeqCst) as u64)
 }
 
 // Custom reader and output for the RLS server.
--- src/tools/rls/src/server/io.rs.orig 2018-12-18 23:12:41.000000000 +0000
+++ src/tools/rls/src/server/io.rs
@@ -17,7 +17,7 @@ use crate::lsp_data::{LSPNotification, L
 
 use std::fmt;
 use std::io::{self, BufRead, Write};
-use std::sync::atomic::{AtomicU64, Ordering};
+use std::sync::atomic::{AtomicU32, Ordering};
 use std::sync::Arc;
 
 use jsonrpc_core::{self as jsonrpc, response, version, Id};
@@ -190,14 +190,14 @@ pub trait Output: Sync + Send + Clone + 
 /// An output that sends notifications and responses on `stdout`.
 #[derive(Clone)]
 pub(super) struct StdioOutput {
-    next_id: Arc<AtomicU64>,
+    next_id: Arc<AtomicU32>,
 }
 
 impl StdioOutput {
     /// Construct a new `stdout` output.
     crate fn new() -> StdioOutput {
         StdioOutput {
-            next_id: Arc::new(AtomicU64::new(1)),
+            next_id: Arc::new(AtomicU32::new(1)),
         }
     }
 }
@@ -215,7 +215,7 @@ impl Output for StdioOutput {
     }
 
     fn provide_id(&self) -> RequestId {
-        RequestId::Num(self.next_id.fetch_add(1, Ordering::SeqCst))
+        RequestId::Num(self.next_id.fetch_add(1, Ordering::SeqCst) as u64)
     }
 }
 

This is also probably related to issue #56753.

Metadata

Metadata

Assignees

No one assigned

    Labels

    O-PowerPCTarget: PowerPC processorsO-netbsdOperating system: NetBSDT-dev-toolsRelevant to the dev-tools subteam, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions