[FFmpeg-user] configure error with enabling libmodplug
Kimio Miyamura
xanadu at apost.plala.or.jp
Thu Sep 11 13:58:31 CEST 2014
> 2014/09/11 4:07PM Clément Bœsch wrote:
>
> On Thu, Sep 11, 2014 at 12:23:35PM +0900, Kimio Miyamura wrote:
>>
>>> 2014/09/01 4:05PM Clément Bœsch <u at pkh.me> wrote:
>>>
>>> On Mon, Sep 01, 2014 at 03:39:08PM +0900, Kimio Miyamura wrote:
>>>>
>>>>> On 2014/09/01, at 2:11PM, Clément Bœsch <u at pkh.me> wrote:
>>>>>
>>>>>> On Mon, Sep 01, 2014 at 10:02:58AM +0900, Kimio Miyamura wrote:
>>>>>>
>>>>>> I searched web and found that modification of ffmpeg configure script is required:
>>>>
>>>>>> -enabled libmodplug && require libmodplug libmodplug/modplug.h ModPlug_Load -lmodplug
>>>>>> +enabled libmodplug && require libmodplug libmodplug/modplug.h ModPlug_Load -lmodplug -lstdc++
>>>>>>
>>>>>> or
>>>>>>
>>>>>> -enabled libmodplug && require libmodplug libmodplug/modplug.h ModPlug_Load -lmodplug
>>>>>> +enabled libmodplug && require libmodplug libmodplug/modplug.h ModPlug_Load -lmodplug -lc++
>>>>
>>>>>> I think either of them should be added to ffmpeg compile script. How do you think?
>>>>
>>>>> Does -lstdc++ or -lc++ appears in pkg-config --libs libmodplug?
>>>>
>>>> $ pkg-config --libs libmodplug
>>>> -L/Volumes/ffmpeg_compile/lib -lmodplug
>>>>
>>>> So either -lstdc++ or -lc++ don't appear in the command output.
>>>>
>>>> I checked libmodplug.pc.
>>>>
>>>> $ cat /Volumes/ffmpeg_compile/lib/pkgconfig/libmodplug.pc
>>>> prefix=/Volumes/ffmpeg_compile
>>>> exec_prefix=${prefix}
>>>> libdir=${exec_prefix}/lib
>>>> includedir=${prefix}/include
>>>>
>>>> Name: libmodplug
>>>> Description: The ModPlug mod file playing library.
>>>> Version: 0.8.8.5
>>>> Requires:
>>>> Libs: -L${libdir} -lmodplug
>>>> Libs.private: -lstdc++ -lm
>>>> Cflags: -I${includedir}
>>>>
>>>> -lstdc++ appears in Libs.private: line. But even though configure with "./configure --pkg-config-flags=--static --enable-libmodplug", the result is same error.
>>>>
>>>
>>> Right, that's because libmodplug wasn't detected through pkg-config, which
>>> I just fixed in git/master. Can you git pull and retry that latest command
>>> with --pkg-config-flags=--static?
>>
>> A information for Windows (MinGW?) user.
>>
>> With above ffmpeg change, Windows (MinGW?) user encounters libmodplug not found error when configuring ffmpeg with libmodplug-0.8.8.5.
>> This is because of mod plug.h's MODPLUG_EXPORT macro. The macro is defined as __declspec(dllimport) would be added, without defining MODPLUG_STATIC.
>
> Can you explain how this is different from before the pkg-config patch?
There are no difference in mod plug.h between pkg-config patch and before.
To build ffmpeg (Before pkg-config patch) with libmodplug support, Windows user modified ffmpeg configure script as my first message. They added -lstdc++ to enabled libmodplug line as workaround.
-enabled libmodplug && require libmodplug libmodplug/modplug.h ModPlug_Load -lmodplug
+enabled libmodplug && require libmodplug libmodplug/modplug.h ModPlug_Load -lmodplug -lstdc++
>> Then, called as `_imp__ModPlug_Load' from ffmpeg configure, and then result in libmodplug not found error. (I'm not Windows user. I'm writing the error mechanism based on one of my friend's comment who using Windows)
>
>> The countermeasure is either of bellow 3.
>> 1.Define MODPLUG_STATIC in modplug.h.
>
> What is the consequence of this when it's not static?
Yes it's a workaround for ffmpeg static building. If build ffmpeg as shared, this workaround is not needed.
>> 2.Add "-DMODPLUG_STATIC" to Cflags: -I${includedir} line in libmodplug.pc.
>
> Sounds like you have to add this to Cflags.private or something so it's
> raised with --static. You need to see this with mod plug itself
You are right, but this is a workaround for ffmpeg static building too. It does not mean that libmodplug.pc should be changed in it's source code.
>> 3.Configure ffmpeg with adding "--extra-cflags=-DMODPLUG_STATIC" option.
>
> We indeed currently do #define MODPLUG_STATIC in the
> libavformat/libmodplug.c itself, so it should probably be in the configure
> test as well. Unfortunately, I'm not sure how this actually affects the
> linking when only a shared version of the library is available. Also, I
> don't understand how this previously worked, because the configure test
> never had it.
In fact, the error in Windows is not related with ffmpeg. It is derived from macro in modplug.h. Here , I pickup central of this issue:
01 #if defined(_WIN32) || defined(__CYGWIN__)
02 # if defined(MODPLUG_BUILD) && defined(DLL_EXPORT) /* building libmodplug as a dll for windows */
03 # define MODPLUG_EXPORT __declspec(dllexport)
04 # elif defined(MODPLUG_BUILD) || defined(MODPLUG_STATIC) /* building or using static libmodplug for windows */
05 # define MODPLUG_EXPORT
06 # else
07 # define MODPLUG_EXPORT __declspec(dllimport) /* using libmodplug dll for windows */
08 # endif
09 /* FIXME: USE VISIBILITY ATTRIBUTES HERE */
10 #elif defined(MODPLUG_BUILD)
11 #define MODPLUG_EXPORT
12 #else
13 #define MODPLUG_EXPORT
14 #endif
You may see that without MODPLUG_STATIC definition, "_imp__" prefix is added to function name. All 3 countermeasure are workaround to avoid "_imp__" prefix addition.
// Miya
More information about the ffmpeg-user
mailing list