Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kostadinsh opened this issue Jul 3, 2023 · 3 comments

Comments

@kostadinsh
Copy link

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

@kostadinsh
Copy link
Author

This is also reproducible with GNU's ld linker even if not using LTO if LDFLAGS="-Wl,--no-undefined-version" is set.

FAILED: va/libva.so.2.2000.0
cc -o va/libva.so.2.2000.0 va/libva.so.2.2000.0.p/va.c.o va/libva.so.2.2000.0.p/va_compat.c.o va/libva.so.2.2000.0.p/va_str.c.o va/libva.so.2.2000.0.p/va_trace.c.o -Wl,--as-needed -Wl,--no-undefined -shared -fPIC -Wl,--start-group -Wl,-soname,libva.so.2 -Wl,--no-undefined-version -ldl -Wl,--end-group
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: va/libva.so.2.2000.0: version node not found for symbol vaCreateSurfaces@VA_API_0.32.0
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: failed to set dynamic section sizes: bad value

@kostadinsh
Copy link
Author

Feel free to close this when 758 or 732 is merged.

@nvinson
Copy link

nvinson commented Jan 10, 2024

Feel free to close this when 758 or 732 is merged.

I ran into this error recently. I've reviewed both #758 and #732. I recommend merging #732. The test in that PR is independent of changes to libva.syms which guarantees changes to libva.syms won't risk breaking the test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants