DVB media addon: Fix debug build.
- Compiling dvb.media_addon with DEBUG on fails with error message:
generated/objects/haiku/x86/debug_1/add-ons/media/media-add-ons/dvb/
MediaFormat.o: In function `av_log2_c': /boot/home/Development/haiku-a4/
generated/build_packages/ffmpeg-0.10.2-r1a4-x86-gcc2-2012-08-30/common/
include/libavutil/common.h:80: undefined reference to `ff_log2_tab'
collect2: ld returned 1 exit status"
- Research done to narrow down the solution space:
- ff_log2_tab is a array that is nowhere needed in the dvb.media_addon
- ff_log2_tab is defined as an extern array in the ffmpeg header file
libavutil/common.h
- ff_log2_tab is used in the inline function av_log2_c (libavutil/common.h)
which doesn't get optimized away when compiling with debug information
- MediaFormat.cpp needs only some Codec-IDs from the ffmpeg header file
avcodec.h
- The following fixes were tried:
- Trying to eliminate unused debug symbols with compilation
flag -feliminate-unused-debug-types (see gcc documentation
http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Debugging-Options.html#Debugging-Options)
by adding the following lines to UserBuildConfig
AppendToConfigVar C++FLAGS : HAIKU_TOP src : -feliminate-unused-debug-types : global ;
AppendToConfigVar CCFLAGS : HAIKU_TOP src : -feliminate-unused-debug-types : global ;
-> Failed, because flag -feliminate-unused-debug-types is not supported by GCC 2.95.3
- Trying to eliminate unused debug symbols in the linker stage
-> This worked, by removing the LINKFLAG "-Xlinker --no-undefined" when
linking all objects into the dvb.media_addon we are getting our addon
with debug symbols.
- Final solution:
- Instead of adding/removing flags, we just add the missing implementation
for the ff_log2_tab array in MediaFormat.cpp. This -feels- the seems to
be the cleanest solution as it is more obvious what's goin' on compared
to hiding the solution in the Jamfile.
Signed-off-by: Colin Günther <[email protected]>
This commit is contained in:
@@ -30,7 +30,14 @@
|
||||
#define UINT64_C(c) (c ## ULL)
|
||||
extern "C" {
|
||||
#include "avcodec.h"
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
// Needed to fix debug build, otherwise the linker complains about
|
||||
// "undefined reference to `ff_log2_tab'"
|
||||
const uint8_t ff_log2_tab[256] = {0};
|
||||
#endif
|
||||
|
||||
} // extern "C"
|
||||
|
||||
void
|
||||
PrintFormat(const media_format &format)
|
||||
|
||||
Reference in New Issue
Block a user