Fails to build with link time optimization enabled (b_lto=true)
dav1d fails to build when enabling link time optimizations (LTO) in meson, giving the following output:
/usr/bin/ld: /tmp/ccLCuoDw.ltrans1.ltrans.o: in function `dav1d_decode_frame':
<artificial>:(.text+0x15276): undefined reference to `__wrap_malloc'
/usr/bin/ld: <artificial>:(.text+0x15499): undefined reference to `__wrap_malloc'
/usr/bin/ld: <artificial>:(.text+0x154fa): undefined reference to `__wrap_posix_memalign'
/usr/bin/ld: <artificial>:(.text+0x155ff): undefined reference to `__wrap_posix_memalign'
/usr/bin/ld: <artificial>:(.text+0x156dd): undefined reference to `__wrap_malloc'
/usr/bin/ld: <artificial>:(.text+0x156f8): undefined reference to `__wrap_malloc'
/usr/bin/ld: <artificial>:(.text+0x157ae): undefined reference to `__wrap_malloc'
/usr/bin/ld: <artificial>:(.text+0x157c2): undefined reference to `__wrap_malloc'
/usr/bin/ld: <artificial>:(.text+0x157d9): undefined reference to `__wrap_posix_memalign'
/usr/bin/ld: <artificial>:(.text+0x1580f): undefined reference to `__wrap_malloc'
/usr/bin/ld: <artificial>:(.text+0x1582b): undefined reference to `__wrap_posix_memalign'
/usr/bin/ld: <artificial>:(.text+0x1590e): undefined reference to `__wrap_malloc'
/usr/bin/ld: <artificial>:(.text+0x159ec): undefined reference to `__wrap_posix_memalign'
/usr/bin/ld: <artificial>:(.text+0x15a9b): undefined reference to `__wrap_malloc'
/usr/bin/ld: <artificial>:(.text+0x15bc5): undefined reference to `__wrap_malloc'
/usr/bin/ld: <artificial>:(.text+0x1806d): undefined reference to `__wrap_malloc'
...
When disabling LTO (-Db_lto=false
), it builds fine.
This is "caused" by commit 8bc73da3. Before this commit (or when reverting it on the current git master branch), dav1d builds fine with and without LTO.
I'm not sure if this is a real concern for the developers, but I'm reporting it anyway for the knowledge.
Steps used to build:
$ git clone https://code.videolan.org/videolan/dav1d.git
$ cd dav1d
$ meson build --buildtype release --prefix /usr -Db_lto='true'
$ ninja -j1 -C build
System Information:
- OS: Arch Linux x86_64
- Compiler: gcc 8.2.1
- NASM: 2.14
- meson: 0.49.0
- ninja: 1.8.2