[FFmpeg-devel] [PATCH] configure: Fix DEF file post-processing with LTO enabled.

Kacper Michajlow kasper93 at gmail.com
Sat Sep 23 12:41:00 EEST 2017


2017-09-08 2:52 GMT+02:00 Michael Niedermayer <michael at niedermayer.cc>:

> On Wed, Sep 06, 2017 at 08:03:18PM +0200, Kacper Michajlow wrote:
> > 2017-08-22 21:26 GMT+02:00 Kacper Michajłow <kasper93 at gmail.com>:
> >
> > > With LTO enabled exported symbol entry looks like:
> > > av_audio_convert @3 DATA
> > >
> > > In order to maintain valid format we need to strip everything after @.
> > >
> > > This patch fixes linking libraries compiled with MinGW toolchain with
> LTO
> > > enabled.
> > >
> > > Signed-off-by: Kacper Michajłow <kasper93 at gmail.com>
> > > ---
> > >  configure | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > >
> > Bump after two weeks.
>
> in absence of anyone else applying this.
>
> can you provide a testcase / command line to reproduce the issue
> this fixes
> maybe if its easy to reproduce it will get a reply sooner
>
> thxs
>


Tested with latest nevcairiel's mingw build from files.1f0.de/mingw and
VS2017

Setup env for lib.exe and link.exe (adjust for your VS instalation):
"C:\Program Files (x86)\Microsoft Visual
Studio\2017\Community\Common7\Tools\VsDevCmd.bat"

configure (let's disable everything for this cruel example):
sh configure --enable-lto --enable-shared --disable-static
--disable-everything --disable-avdevice --disable-avcodec
--disable-swresample --disable-swscale --disable-postproc

compile:
make

And now try to link something like

ver.c:
int main()
{
    return avfilter_version();
}

cl ver.c libavfilter\avfilter.lib -link

It will fail without the patch, because of trailing DATA in .def file
avfilter.lib was not correctly created by lib.exe and is not usable as it
doesn't have those symbols listed.

If you need real project to reproduce you can add --enable-lto to LAV
Filters configure options and built it. Without this patch it will fail.

Regards,
Kacper


More information about the ffmpeg-devel mailing list