Skip to content

linking failed: undefined reference to STATIC #60184

Closed
@cuviper

Description

@cuviper

ref: https://bugzilla.redhat.com/show_bug.cgi?id=1701339

BUILDSTDERR: error: linking with `cc` failed: exit code: 1
BUILDSTDERR:   |
BUILDSTDERR:   = note: "cc" [...trimmed arguments...]
BUILDSTDERR:   = note: /usr/bin/ld: /builddir/build/BUILD/tokei-9.1.1/target/release/deps/libhandlebars-cbf3fa5b112da913.rlib(handlebars-cbf3fa5b112da913.handlebars.8lxzppfs-cgu.8.rcgu.o): in function `handlebars::registry::Registry::setup_builtins':
BUILDSTDERR:           /usr/share/cargo/registry/handlebars-1.2.0/src/registry.rs:116: undefined reference to `handlebars::helpers::helper_if::IF_HELPER'
BUILDSTDERR:           /usr/bin/ld: /usr/share/cargo/registry/handlebars-1.2.0/src/registry.rs:117: undefined reference to `handlebars::helpers::helper_if::UNLESS_HELPER'
BUILDSTDERR:           /usr/bin/ld: /builddir/build/BUILD/tokei-9.1.1/target/release/build/tokei-b80c0fc585eb7773/build_script_build-b80c0fc585eb7773: hidden symbol `_ZN10handlebars7helpers9helper_if9IF_HELPER17h94bc0b06c1b1df67E' isn't defined
BUILDSTDERR:           /usr/bin/ld: final link failed: bad value
BUILDSTDERR:           collect2: error: ld returned 1 exit status
BUILDSTDERR:           
BUILDSTDERR: error: aborting due to previous error
BUILDSTDERR: error: Could not compile `tokei`.

We ran into this linking failure only on i686 Fedora 30+, with LLVM 8. Other arches are fine with LLVM 8, and all arches are fine with LLVM 7 on Fedora 29.

I can reproduce this building stock tokei with normal crates.io dependencies, so that takes Fedora's crate packaging out of the picture. I also reproduced similar errors with ffsend, but different symbols: colored::style::CLEAR and time::NSEC_PER_SEC.

I can't reproduce this with official stable-1.34, 1.35-beta, nor 1.36-nightly compiler builds. However, I can reproduce it when I build those locally myself, even with a minimal config so I'm using rust's llvm-project. I have no idea what is the difference in my build at this point.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.O-x86_32Target: x86 processors, 32 bit (like i686-*) (IA-32)T-compilerRelevant to the compiler team, 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