Skip to content

Warning about missing symbol when building with LTO and the mold linker #725

@kostadinsh

Description

@kostadinsh

libva has an issue regarding a symbol not being found during the linking phase when using -flto and the mold linker.
I've turned mold's warnings into errors with -Wl,--fatal-warnings, so I can catch them more easily. Below is the last couple of lines from the build log, and I am also adding the complete log as an attachment.

libva source used is at 984dfee
mold used is at commit b04aba89d3a1931470983212925443e7aefca1e1
gcc (Gentoo 13.1.1_p20230527 p3) 13.1.1 20230527

Steps to reproduce:

  1. Clone this repo and cd into the libva folder
  2. run export CFLAGS="-O2 -flto=auto" and export LDFLAGS="-fuse-ld=mold -Wl,--fatal-warnings"
  3. run ./autogen.sh --prefix=/usr and make V=1
/bin/sh ../libtool  --tag=CC   --mode=link gcc -Wall  -fstack-protector-strong -O2 -flto=auto -fstack-protector-strong -version-info 1902:0:1900 -no-undefined -Wl,-version-script,./libva.syms  -fuse-ld=mold -Wl,--fatal-warnings -o libva.la -rpath /usr/lib libva_la-va.lo libva_la-va_compat.lo libva_la-va_str.lo libva_la-va_trace.lo  
libtool: link: gcc -shared  -fPIC -DPIC  .libs/libva_la-va.o .libs/libva_la-va_compat.o .libs/libva_la-va_str.o .libs/libva_la-va_trace.o    -fstack-protector-strong -O2 -flto=auto -fstack-protector-strong -Wl,-version-script -Wl,./libva.syms -fuse-ld=mold -Wl,--fatal-warnings   -Wl,-soname -Wl,libva.so.2 -o .libs/libva.so.2.1900.0
mold: error: ./libva.syms: cannot assign version `VA_API_0.32.0` to symbol `vaCreateSurfaces_0_32_0`: symbol not found
collect2: error: ld returned 1 exit status

libva-github.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions