Skip to content

multiple definition of `llvm:: cl ::Option::anchor()' when running x.py build #94275

@wangbyby

Description

@wangbyby

Hi,I am working for huawei. And I am trying to build rustc with bisheng, a custom version of llvm12.
But I get some errors in running command ./x.py build. The log is very long, so I split it into two files: error_1.txt, error_2.txt.
Some of them looks like this:

/usr/bin/ld: /home/byw/rust_bisheng/bisheng/build/aarch64-unknown-linux-gnu/stage0-rustc/aarch64-unknown-linux-gnu/release/deps/librustc_llvm-ef22ef6f00ab31b7.rlib(CommandLine.cpp.o): in function `llvm::cl::GenericOptionValue::anchor()':
          CommandLine.cpp:(.text._ZN4llvm2cl6Option6anchorEv+0x0): multiple definition of `llvm::cl::Option::anchor()'; /home/byw/rust_bisheng/bisheng/build/aarch64-unknown-linux-gnu/stage0-rustc/aarch64-unknown-linux-gnu/release/deps/librustc_llvm-ef22ef6f00ab31b7.rlib(CommandLine.cpp.o):CommandLine.cpp:(.text._ZN4llvm2cl6Option6anchorEv+0x0): first defined here
  • Version of rust code: in branch master, the latest commit is 930fc4f.
  • And the version of some system compoents:
[byw@llvm-tool-chain rust]$ cc -v
Using built-in specs.
COLLECT_GCC=cc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/aarch64-linux-gnu/7.3.0/lto-wrapper
Target: aarch64-linux-gnu
[wangboyang@llvm-tool-chain rust]$ uname -a
Linux 4.19.36-vhulk1905.1.0.h273.eulerosv2r8.aarch64 #1 SMP Mon Apr 1 00:00:00 UTC 2019 aarch64 aarch64 aarch64 GNU/Linux
[wangboyang@llvm-tool-chain rust]$ ldd --version
ldd (GNU libc) 2.28
  • version of llvm
    Because it's a custom version of llvm12, I can't get the version num.
    But I compare the config between bisheng with llvmorg-12.0.0, no difference.

  • config.toml: config.txt
    github not support .toml, so I rename .toml to .txt.

I can't provide the source code of bisheng.
So, Can I fix this error? And why this error occurs?

Thanks a lot!

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleT-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions