Skip to content

error adding symbols: file format not recognized #8239

Closed
@toku-sa-n

Description

@toku-sa-n

Problem

The file format of the output binary of cargo build -Zbuild-std=core,alloc is not recognized.

Steps

  1. Clone https://github.com/toku-sa-n/cargo_bug
  2. git checkout with_rlibc
  3. make

This causes the error: ld: target/cargo_settings/debug/librust_bug.a: error adding symbols: file format not recognized

Possible Solution(s)

Sorry, but I have no idea.

Notes

Output of cargo version:cargo 1.45.0-nightly (cb06cb2 2020-05-08)

rlibc is deprecated, but with compiler_builtins (which is the replacement of rlibc) , cargo build -Zbuild-std=core,alloc itself fails with the error: multiple rlib candidates for compiler_builtins found. rust-lang/wg-cargo-std-aware#53 seems to be related.

Building without compiler_builtins will cause another linker error: undefined reference to 'memcpy'.

Related issue: rust-osdev/cargo-xbuild#69

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-linkageArea: linker issues, dylib, cdylib, shared libraries, soC-bugCategory: bugZ-build-stdNightly: build-std

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions