Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#1539 closed defect (wontfix)

ModPlug compile bug

Reported by: chinshou Owned by:
Priority: normal Component: avcodec
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
when compile the ffmpeg with libmodplug --enable-libmodplug , gcc reported following error

operator new [] unresolved error

Fix: add stdc++ library to link parameters.

Patch attached.

Attachments (2)

modplug.patch (925 bytes ) - added by chinshou 12 years ago.
modplug2.patch (1.3 KB ) - added by chinshou 12 years ago.

Download all attachments as: .zip

Change History (13)

by chinshou, 12 years ago

Attachment: modplug.patch added

comment:1 by Clément Bœsch, 12 years ago

Can you check if pkg-config --libs libmodplug add -lstdc++ for you? And if so, use require_pkg_config instead for the check.

It might be better to use it; I don't need stdc++ here for example.

comment:2 by chinshou, 12 years ago

executing pkg-config --libs libmodplug add -L/usr/darwin32/lib -lmodplug for the link parameters but without -lstdc++

it seems -lstdc++ defined in the Libs.private section not in the Libs section of the libmodplug.pc

prefix=/usr/darwin32
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: libmodplug
Description: The ModPlug mod file playing library.
Version: 0.8.8.4
Requires:
Libs: -L${libdir} -lmodplug
Libs.private: -lstdc++ -lm
Cflags: -I${includedir} -I${includedir}/libmodplug

comment:3 by Clément Bœsch, 12 years ago

What is your full ./configure line?

pkg-config --static --libs libmodplug should raise the appropriate libs. I don't know if the configure will be able to do that according to your options, but it might be worth giving a try.

I'm not familiar with the build system, but requiring this lib when it's not looks wrong to me.

by chinshou, 12 years ago

Attachment: modplug2.patch added

comment:4 by chinshou, 12 years ago

I attach a new patch which change to use require_pkg_config macro to create the link parameters. But it requires that add --static parameter to the check_pkg_config macro

I do not know whether it will cause some side effect by adding --static to check_pkg_config macro although the compile is ok now.

comment:5 by Clément Bœsch, 12 years ago

AFAICT, the external libraries should not be linked statically (the default --enable-static switch enable static linking of libav* libraries), so libmodplug, as well as other external libraries will be linked dynamically.

Adding --static to the pkg-config call will add a lot of libraries dependencies where it is not required.

Are you trying to make a full static build? Again, what is your full configure line?

comment:6 by chinshou, 12 years ago

no, I am creating a shared build but without external dependency , following is the full configure line.

LDFLAGS="-arch i386 -L/usr/darwin32/lib" CPPFLAGS="-arch i386 -I/usr/darwin32/include" CFLAGS="-arch i386 -I/usr/darwin32/include" ../configure --enable-memalign-hack --arch=x86 --target-os=darwin --prefix=/usr/darwin32 --enable-gpl --disable-postproc --enable-shared --enable-cross-compile --enable-libx264 --enable-libvpx --disable-decoder=libvpx --enable-libgsm --enable-libmp3lame --disable-encoder=aac --enable-libvo-amrwbenc --enable-libfreetype --enable-version3 --enable-libvo-aacenc --enable-libtheora --enable-libspeex --enable-libvorbis --enable-runtime-cpudetect --enable-libsox --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libxavs --enable-openal --enable-librtmp --enable-libbluray --enable-libflite --enable-libcelt --enable-libxvid --enable-libopenjpeg --enable-libmodplug --enable-libschroedinger --enable-libcdio --enable-libilbc

comment:7 by Clément Bœsch, 12 years ago

Is the libmodplug build dynamically?

If libmodplug is only available statically this might be the cause of your issue. I'm not sure how to deal with this (except the workaround of building the shared libmodplug).

comment:8 by chinshou, 12 years ago

libmodplug was built as static only.

CFLAGS=" -arch i386" CPPFLAGS=" -arch i386" LDFLAGS=" -arch i386" ./configure --prefix=/usr/darwin32 --enable-static --disable-shared

Because I want to build the dynamic build but without external dependency except libav libraries selves like the shared build on http://ffmpeg.zeranoe.com/builds/ for windows.

comment:9 by Clément Bœsch, 12 years ago

Well then maybe you could add --extra-libs=-lstdc++.

Another solution might be to try to detect when the library is available only statically and enable the pkg-config --static flag for that library only.

comment:10 by Elon Musk, 12 years ago

Resolution: wontfix
Status: newclosed

I do not think this is ffmpeg fault.

comment:11 by Roger Pack, 11 years ago

Hmm. Even if I update the modplug.pc file like this:

Libs: -L${libdir} -lmodplug -lstdc++

It appears that configure is still just using "-lmodplug" here... (work around for now is to specify --extra-libs=-lstdc++ to FFmpeg's configure line but something seems awry).

Note: See TracTickets for help on using tickets.