[FFmpeg-devel] [PATCH] configure: add libm ldflags globally

Jörn Heusipp osmanx at problemloesungsmaschine.de
Tue Oct 17 11:01:38 EEST 2017


On 10/17/2017 12:13 AM, Jan Ekstrom wrote:
> On Tue, Oct 17, 2017 at 12:38 AM, Hendrik Leppkes <h.leppkes at gmail.com> wrote:
>> Perhaps such libraries shouldn't hardcode -lstdc++ in there, but
>> dynamically put whichever C++ library they built against in there
>> instead?
>> Its not like you can actually use a static library build with another
>> C++ library, that *may* randomly work, but its not something anyone
>> should be doing.
>>
>> - Hendrik
> 
> Yup,
> 
> The project should know which C++ runtime it is built against and put
> that into the .pc file's Libs.private. If the project doesn't have an
> idea on how to automate this, a solution like the one utilized by zimg
> is valid as well:
> 
> * Check for an environment variable during configuration and set the
> default to `-lstdc++`
> (https://github.com/sekrit-twc/zimg/blob/ae673e02c8e934915e05daeb120c7cb1b500a0a4/configure.ac#L55..L56)
> * Set that value in your pkg-config template
> (https://github.com/sekrit-twc/zimg/blob/ae673e02c8e934915e05daeb120c7cb1b500a0a4/zimg.pc.in#L13)

As already explained in another mail, I actually have no idea how to 
reliably determine the name of the C++ standard library. (see 
https://lists.freedesktop.org/archives/pkg-config/2016-August/001055.html 
on the pkg-config mailing list for a similar discussion).

Do you happen to know of any other libraries that do exactly that (use 
of STL_LIBS variable)? If this is somewhat common practice I could add 
support for that variable to libopenmpt.
If it is not, I am considering adding a configure option to libopenmpt, 
something like "--pkgconfig-static-cxxstdlib=-lstdc++" (and also add 
proper documentation about this issue with static linking).
However I do not like defaulting it to some guess (libstdc++), as a 
wrong value here is worse than no value (additional libs can be added 
easily by libraries or programs that use libopenmpt, removing/ignoring 
wrong libs from the .pc file is harder and will cause even more trouble).

For reference: https://bugs.openmpt.org/view.php?id=1045 (libopenmpt issue)

Regards,
Jörn (libopenmpt maintainer)


More information about the ffmpeg-devel mailing list