Warning about missing symbol when building with LTO and the mold linker
- Dominant language
- C
- Stars
- 784
- Forks
- 314
- PR merge metrics
- No merged PRs in 30d
Description
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 984dfee4177021c400367f5dffc0776a6dd745dc
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](https://github.com/intel/libva/files/11935971/libva-github.log)
Contributor guide
Assessment
This issue has not been assessed yet.