Skip to content

1.65.0 fails to build on powerpc #104220

Closed
Closed

Description

@pkubaj

1.64.0 built fine.
On powerpc-unknown-freebsd:

  = note: /usr/local/bin/ld.bfd: /wrkdirs/usr/ports/lang/rust/work/_build/powerpc-unknown-freebsd/stage0-rustc/powerpc-unknown-freebsd/release/deps/librustc_driver-95f1e4ba1a525000.so: undefined reference to `__atomic_load_8'
          /usr/local/bin/ld.bfd: /wrkdirs/usr/ports/lang/rust/work/_build/powerpc-unknown-freebsd/stage0-rustc/powerpc-unknown-freebsd/release/deps/librustc_driver-95f1e4ba1a525000.so: undefined reference to `__atomic_store_8'
          cc: error: linker command failed with exit code 1 (use -v to see invocation)

Probably related to LLVM upgrade.

Activity

  1. added
    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.
    O-PowerPCTarget: PowerPC processors
    on Nov 11, 2022
  2. added
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Nov 11, 2022
  3. apiraino commented on Nov 11, 2022

    @apiraino
    Contributor

    probably related to #103949 (different compile target but seemingly same symptoms).

    Assigning same priority for the time being (Zulip discussion).

    @rustbot label -I-prioritize +P-low

  4. added
    P-lowLow priority
    and removed
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Nov 11, 2022
  5. nikic commented on Nov 11, 2022

    @nikic
    Contributor

    What does llvm-config --system-libs report? For cross-compiled builds we link libatomic here:

    || target.starts_with("powerpc-")
    But I assume you're using a native build?

  6. pkubaj commented on Nov 12, 2022

    @pkubaj
    ContributorAuthor
    root@powerpc-131-rust:/wrkdirs/usr/ports/lang/rust/work/_build/powerpc-unknown-freebsd/llvm/build/bin # ./llvm-config --system-libs
    -lrt -lexecinfo -lpthread -lm -lz
    

    FreeBSD doesn't have libatomic. LLVM is used in the base system, libatomic is GCC's component.

  7. pkubaj commented on Nov 12, 2022

    @pkubaj
    ContributorAuthor

    And yes, I build natively.

  8. nikic commented on Nov 12, 2022

    @nikic
    Contributor

    FreeBSD doesn't have libatomic. LLVM is used in the base system, libatomic is GCC's component.

    If FreeBSD doesn't have libatomic, what library provides atomic libcalls instead? I found https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230888 which makes it sound like these are supposed to be provided by compiler-rt (which is super suspicious, because __atomic builtins must be provided by a shared object with a globally shared mutex, not a static library).

    In any case, this sounds like an issue in FreeBSD, not something that can/should be addressed on the Rust/LLVM side.

  9. pkubaj commented on Nov 12, 2022

    @pkubaj
    ContributorAuthor

    Yes, compiler_rt is used. Is it possible to disable generating those atomic calls?

  10. pkubaj commented on Nov 15, 2022

    @pkubaj
    ContributorAuthor

    I succeeded to build after installing gcc, adding appriopriate -L flag to RUSTFLAGS and modifying compiler/rustc_llvm/build.rs to always add -latomic and -lz (that was also necessary) on powerpc (not just for crosscompiling).

  11. apiraino commented on Nov 15, 2022

    @apiraino
    Contributor

    @pkubaj do you consider this issue as resolved? If yes, can you close it? I understand you had to manually patch rustc to compile the target. Do you think that your patch would be useful for a PR upstream in rustc?

    thanks @nikic for the support

  12. pkubaj commented on Nov 17, 2022

    @pkubaj
    ContributorAuthor

    Not really fixed, since I needed to patch build.rs. I'll send a PR.

  13. added a commit that references this issue on Nov 24, 2022
  14. added a commit that references this issue on Nov 27, 2022
  15. added a commit that references this issue on Dec 9, 2022
  16. added a commit that references this issue on May 11, 2026
  17. added a commit that references this issue on May 14, 2026
  18. added a commit that references this issue on Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.O-PowerPCTarget: PowerPC processorsP-lowLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions