mplayer build with address sanitizer (asan) - build

I am trying to build mplayer using clang with the address sanitizer flag. However, I keeps getting errors when I execute make. Here is the full output log including the commands I used. Any help will be much appreciated.
kt#kt-VirtualBox:~/mplayer$ ./configure --cc=clang --extra-ldflags="-fsanitize=address"
Updating FFmpeg, (re)move ffmpeg/mp_auto_pull to disable
Already on 'master'
Your branch is up-to-date with 'origin/master'.
Current branch master is up to date.
Checking for ffmpeg/libavcodec/allcodecs.c ... found
Checking for ffmpeg/libavformat/allformats.c ... found
Checking for ffmpeg/libavfilter/allfilters.c ... found
Checking for clang version ... clang 4.2.1 (experimental support only)
Checking for working compiler ... yes
Detected operating system: Linux
Detected host architecture: x86_64
Checking for cross compilation ... no
Checking for host cc ... clang
Checking for CPU vendor ... GenuineIntel (6:69:1)
Checking for CPU type ... Intel(R) Core(TM) i7-4558U CPU # 2.80GHz
Checking for kernel support of mmx ... yes
Checking for kernel support of mmxext ... yes
Checking for kernel support of sse ... yes
Checking for kernel support of sse2 ... yes
Checking for kernel support of sse3 ... yes
Checking for kernel support of ssse3 ... yes
Checking for kernel support of sse4_1 ... yes
Checking for kernel support of sse4_2 ... yes
Checking for kernel support of avx ... yes
Checking for kernel support of cmov ... yes
Checking for mtrr support ... yes
Checking for GCC & CPU optimization abilities ... corei7-avx
Checking for byte order ... little-endian
Checking for extern symbol prefix ... __asan_init_v3 U __asan_mapping_offset V 0000000000000000 0000000000000008 __asan_mapping_scale V 0000000000000000 0000000000000008
Checking for assembler support of -pipe option ... yes
Checking for relocatable binary ... yes (fast PIC)
Checking for PIC ... yes
Checking for .align is a power of two ... no
Checking for ebx availability ... yes
Checking for yasm ... yasm
Checking for bswap ... yes
Checking for xmm clobbers ... yes
Checking for langinfo ... yes
Checking for language ... messages: en - man pages: en - documentation: en
Checking for enable sighandler ... yes
Checking for runtime cpudetection ... no
Checking for restrict keyword ... restrict
Checking for __builtin_expect ... yes
Checking for kstat ... no
Checking for atanf ... yes
Checking for cbrt ... yes
Checking for cbrtf ... yes
Checking for cosf ... yes
Checking for expf ... yes
Checking for exp2 ... yes
Checking for exp2f ... yes
Checking for isnan ... yes
Checking for isinf ... yes
Checking for llrint ... yes
Checking for llrintf ... yes
Checking for log2 ... yes
Checking for log2f ... yes
Checking for log10f ... yes
Checking for lrint ... yes
Checking for lrintf ... yes
Checking for rint ... yes
Checking for round ... yes
Checking for roundf ... yes
Checking for sinf ... yes
Checking for trunc ... yes
Checking for truncf ... yes
Checking for atan2f ... yes
Checking for fminf ... yes
Checking for ldexpf ... yes
Checking for powf ... yes
Checking for mkstemp ... yes
Checking for gmtime_r ... yes
Checking for localtime_r ... yes
Checking for nanosleep ... yes
Checking for socklib ... yes
Checking for netdb.h, struct addrinfo ... yes
Checking for netdb.h, getaddrinfo() ... yes
Checking for sockaddr_storage ... yes
Checking for struct ipv6_mreq ... yes
Checking for struct sockaddr_in6 ... yes
Checking for struct sockaddr sa_len ... no
Checking for arpa/inet.h ... yes
Checking for inet_pton() ... yes
Checking for inet_aton() ... yes
Checking for socklen_t ... yes
Checking for closesocket() ... no
Checking for networking ... yes
Checking for inet6 ... yes
Checking for gethostbyname2 ... yes
Checking for SCTP ... no
Checking for sys/un.h ... yes
Checking for sys/poll.h ... yes
Checking for inttypes.h (required) ... yes
Checking for int_fastXY_t in inttypes.h ... yes
Checking for malloc.h ... yes
Checking for aligned malloc ... no
Checking for memalign() ... yes
Checking for posix_memalign() ... yes
Checking for alloca.h ... yes
Checking for fastmemcpy ... yes
Checking for hard-coded tables ... no
Checking for mman.h ... yes
Checking for mprotect ... yes
Checking for dynamic loader ... yes
Checking for dynamic a/v plugins support ... no
Checking for pthread ... yes
Checking for pthread_cancel ... yes
Checking for direct.h ... no
Checking for windows.h ... no
Checking for io.h ... no
Checking for rpath ... no
Checking for iconv ... yes
Checking for soundcard.h ... yes (sys/soundcard.h)
Checking for termcap ... no
Checking for termios ... yes (using termios.h)
Checking for shm ... yes
Checking for strsep() ... yes
Checking for vsscanf() ... yes
Checking for POSIX select() ... yes
Checking for audio select() ... yes
Checking for gettimeofday() ... yes
Checking for clock_gettime() ... yes
Checking for glob() ... yes
Checking for setenv() ... yes
Checking for setmode() ... no
Checking for sys/sysinfo.h ... yes
Checking for Apple IR ... yes
Checking for pkg-config ... yes
Checking for GnuTLS ... no
Checking for Samba support (libsmbclient) ... no
Checking for /dev/mga_vid ... no
Checking for tdfxfb ... no
Checking for s3fb ... no
Checking for wii ... no
Checking for tdfxvid ... no
Checking for xvr100 ... no
Checking for tga ... yes
Checking for md5sum support ... yes
Checking for yuv4mpeg support ... yes
Checking for bl ... no
Checking for DirectFB ... no
Checking for X11 headers presence ... yes
Checking for X11 ... no (check if the dev(el) packages are installed)
Checking for Xss screensaver extensions ... no
Checking for DPMS ... no
Checking for Xv ... auto
Checking for XvMC ... no
Checking for Video Decode Acceleration (VDA) ... no
Checking for VDPAU ... auto
Checking for Xinerama ... auto
Checking for Xxf86vm ... auto
Checking for XF86keysym ... auto
Checking for DGA ... no
Checking for xmga ... no
Checking for 3dfx ... no
Checking for VIDIX ... yes
Checking for VIDIX PCI device name database ... yes
Checking for VIDIX dhahelper support ... no
Checking for VIDIX svgalib_helper support ... no
Checking for GGI ... no
Checking for GGI extension: libggiwmh ... no
Checking for AA ... no
Checking for CACA ... no
Checking for SVGAlib ... no
Checking for FBDev ... yes
Checking for DVB ... yes
Checking for PNG support ... no
Checking for MNG support ... no
Checking for JPEG support ... no
Checking for OpenJPEG (JPEG 2000) support ... no
Checking for PNM support ... yes
Checking for GIF support ... no
Checking for VESA support ... no
Checking for SDL ... no
Checking for SDL image ... no
Checking for OpenGL ... no
Checking for MatrixView ... no
Checking for DXR2 ... no
Checking for DXR3/H+ ... no
Checking for IVTV TV-Out (pre linux-2.6.24) ... no
Checking for V4L2 MPEG Decoder ... yes
Checking for OSS Audio ... yes
Checking for aRts ... no
Checking for EsounD ... no
Checking for NAS ... no
Checking for pulse ... no
Checking for JACK ... yes
Checking for OpenAL ... no
Checking for ALSA audio ... no
Checking for Sun audio ... no
Checking for sndio audio ... no
Checking for VCD support ... yes
Checking for Blu-ray support ... no
Checking for dvdread ... no
Checking for libcdio ... no
Checking for cdparanoia ... no
Checking for bitmap font support ... yes
Checking for freetype >= 2.0.9 ... no
Checking for fontconfig ... no (FreeType support needed)
Checking for fribidi with charsets ... no
Checking for SSA/ASS support ... no (FreeType and FriBiDi support needed)
Checking for ENCA ... no
Checking for zlib ... yes
Checking for bzlib ... no
Checking for RTC ... yes
Checking for liblzo2 support ... no
Checking for mad support ... no
Checking for Twolame ... no
Checking for Toolame ... no
Checking for OggVorbis support ... yes (libvorbis)
Checking for libspeex (version >= 1.1 required) ... no
Checking for libgsm ... no
Checking for OggTheora support ... yes
Checking for mpg123 support ... no
Checking for liba52 support ... no
Checking for libmpeg2 support ... no
Checking for libdca support ... no
Checking for libmpcdec (musepack, version >= 1.2.1 required) ... no
Checking for FAAC support ... yes (in FFmpeg: yes)
Checking for FAAD2 support ... no
Checking for libilbc support ... no
Checking for libopus decoding support ... no
Checking for LADSPA plugin support ... no
Checking for libbs2b audio filter support ... no
Checking for Win32 codecs ... no
Checking for XAnim codecs ... yes (dynamic loader support needed)
Checking for RealPlayer codecs ... yes (dynamic loader support needed)
Checking for QuickTime codecs ... auto
Checking for Nemesi Streaming Media libraries ... no
Checking for LIVE555 Streaming Media libraries ... no
Checking for RTMPDump Streaming Media library ... no
Checking for FFmpeg ... yes
Checking for libpostproc ... yes
Checking for libopencore_amr narrowband ... yes
Checking for libopencore_amr wideband ... yes
Checking for libdv-0.9.5+ ... no
Checking for CrystalHD ... no
Checking for Xvid ... no
Checking for Xvid two pass plugin ... no
Checking for x264 ... no (in FFmpeg: no)
Checking for libdirac ... no
Checking for libschroedinger ... no
Checking for libvpx ... no
Checking for libnut ... no
Checking for zr ... no
Checking for libmp3lame ... yes (in FFmpeg: yes)
Checking for mencoder ... yes
Checking for UnRAR executable ... yes
Checking for TV interface ... yes
Checking for DirectShow TV interface ... no
Checking for Video 4 Linux TV interface ... no
Checking for Video 4 Linux 2 TV interface ... yes
Checking for Radio interface ... no
Checking for Capture for Radio interface ... no
Checking for Video 4 Linux 2 Radio interface ... no
Checking for Video 4 Linux Radio interface ... no
Checking for Video 4 Linux 2 MPEG PVR interface ... yes
Checking for ftp ... yes
Checking for vstream client ... no
Checking for OSD menu ... no
Checking for Subtitles sorting ... yes
Checking for XMMS inputplugin support ... no
Checking for GUI ... no
Checking for automatic gdb attach ... no
Checking for compiler support for noexecstack ... yes
Checking for linker support for --nxcompat --no-seh --dynamicbase ... no
Checking for linker support for --large-address-aware ... no
Checking for linker support for --version-script ... yes
Checking for joystick ... no
Checking for lirc ... no
Checking for lircc ... no
Checking for DVD support (libdvdnav) ... no
Checking for XML catalogs ... SGML catalog
Checking for XML chunked stylesheet ... not found, using default
Checking for XML monolithic stylesheet ... not found, using default
Checking for XML DTD ... not found, using default
Checking for valid XSLT processor ... xsltproc not found
Creating config.mak
Creating config.h
Config files successfully generated by ./configure --cc=clang --extra-ldflags=-fsanitize=address !
Install prefix: /usr/local
Data directory: /usr/local/share/mplayer
Config direct.: /usr/local/etc/mplayer
Byte order: little-endian
Optimizing for: corei7-avx
Languages:
Messages/GUI: en
Manual pages: en
Documentation: en
Enabled optional drivers:
Input: ftp pvr tv-v4l2 tv vcd dvb networking
Codecs: libopencore_amrwb libopencore_amrnb ffmpeg(internal) real xanim faac libtheora libvorbis
Audio output: jack oss v4l2 mpegpes(dvb)
Video output: v4l2 pnm mpegpes(dvb) fbdev cvidix yuv4mpeg md5sum tga
Disabled optional drivers:
Input: dvdnav vstream radio tv-v4l1 tv-dshow librtmp live555 nemesi cddb cdda dvdread bluray smb
Codecs: libvpx libschroedinger libdirac x264 xvid crystalhd libdv qtx win32 libopus ilbc faad2 musepack libdca libmpeg2 liba52 mpg123 libgsm speex toolame twolame libmad liblzo gif OpenJPEG
Audio output: sndio sun alsa openal pulse nas esd arts ivtv dxr2 sdl
Video output: zr zr2 ivtv dxr3 dxr2 matrixview opengl sdl vesa gif89a jpeg mng svga caca aa ggi xvidix winvidix 3dfx xmga dga vdpau xvmc xv x11 directfb dfbmga bl xvr100 tdfx_vid wii s3fb tdfxfb mga
'config.h' and 'config.mak' contain your configuration options.
Note: If you alter theses files (for instance CFLAGS) MPlayer may no longer
compile *** DO NOT REPORT BUGS if you tweak these files ***
'make' will now compile MPlayer and 'make install' will install it.
Note: On non-Linux systems you might need to use 'gmake' instead of 'make'.
Please check MTRR settings at /proc/mtrr (see DOCS/HTML/en/video.html#mtrr)
NOTE: Win32 codec DLLs are not supported on your CPU (x86_64) or your
operating system (Linux). You may encounter a few files that cannot
be played due to missing open source video/audio codec support.
Check config.log if you wonder why an autodetection failed (make sure
development headers/packages are installed).
NOTE: The --enable-* parameters unconditionally force options on, completely
skipping autodetection. This behavior is unlike what you may be used to from
autoconf-based configure scripts that can decide to override you. This greater
level of control comes at a price. You may have to provide the correct compiler
and linker flags yourself.
If you used one of these options (except --enable-menu and similar ones that
turn on internal features) and experience a compilation or linking failure,
make sure you have passed the necessary compiler/linker flags to configure.
If you suspect a bug, please read DOCS/HTML/en/bugreports.html.
MPlayer compilation will use the CPPFLAGS/CFLAGS/LDFLAGS/YASMFLAGS set by you,
but:
*** *** DO NOT REPORT BUGS IF IT DOES NOT COMPILE/WORK! *** ***
It is strongly recommended to let MPlayer choose the correct *FLAGS!
To do so, remove *FLAGS from the environment an re-run configure.
You can use --extra-*flags to add custom flags if necessary.
kt#t-VirtualBox:~/mplayer$ make
clang -MMD -MP -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ISOC99_SOURCE -I. -Iffmpeg -fsanitize=address -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -fpie -DPIC -D_REENTRANT -DZLIB_CONST -c -o command.o command.c
In file included from command.c:27:
./config.h:123:1: error: unknown type name '__asan_mapping_offset'
__asan_mapping_offset V 0000000000000000 0000000000000008
^
./config.h:123:24: error: expected ';' after top level declarator
__asan_mapping_offset V 0000000000000000 0000000000000008
^
;
./config.h:126:23: warning: missing terminating '"' character [-Winvalid-pp-token]
#define EXTERN_PREFIX "__asan_init_v3 U
^
./config.h:129:1: warning: missing terminating '"' character [-Winvalid-pp-token]
"
^
In file included from command.c:28:
./command.h:25:24: warning: declaration of 'struct MPContext' will not be visible outside of this function [-Wvisibility]
int run_command(struct MPContext *mpctx, struct mp_cmd *cmd);
^
./command.h:26:37: warning: declaration of 'struct MPContext' will not be visible outside of this function [-Wvisibility]
char *property_expand_string(struct MPContext *mpctx, char *str);
^
command.c:2262:7: error: conflicting types for 'property_expand_string'
char *property_expand_string(MPContext *mpctx, char *str)
^
./command.h:26:7: note: previous declaration is here
char *property_expand_string(struct MPContext *mpctx, char *str);
^
command.c:2590:5: error: conflicting types for 'run_command'
int run_command(MPContext *mpctx, mp_cmd_t *cmd)
^
./command.h:25:5: note: previous declaration is here
int run_command(struct MPContext *mpctx, struct mp_cmd *cmd);
^
command.c:3373:56: warning: incompatible pointer types passing 'MPContext *' (aka 'struct MPContext *') to parameter of type
'struct MPContext *' [-Wincompatible-pointer-types]
char *exp_cmd = property_expand_string(mpctx, cmd->args[0].v.s);
^~~~~
./command.h:26:48: note: passing argument to parameter 'mpctx' here
char *property_expand_string(struct MPContext *mpctx, char *str);
^
5 warnings and 4 errors generated.
make: *** [command.o] Error 1

It seems that configure script for mplayer breaks in presense of Asan:
Checking for extern symbol prefix ... __asan_init_v3 U __asan_mapping_offset V 0000000000000000 0000000000000008 __asan_mapping_scale V 0000000000000000 0000000000000008
and this later causes generation of invalid config.h.
BTW you seem to only add -fsanitize=address to LDFLAGS - you need it in CFLAGS/CXXFLAGS as well!

Related

Running AddressSanitizer with DPDK

I am trying to debug a potential memory corruption in my application that is using DPDK 21.11 using https://doc.dpdk.org/guides/prog_guide/asan.html
I have installed libasan as required. However, I am unable to compile DPDK 21.11 when I add -Db_sanitize=address to the meson option.
20:44:42 [root]: yum install libasan
Package libasan-8.5.0-10.el8.x86_64 is already installed.
meson -Db_sanitize=address -Dprefix=/ build
The Meson build system
Version: 0.61.2
Source dir: /root/repo/gNB_CU/ngp/thirdparty/dpdk/dpdk-21.11
Build dir: /root/repo/gNB_CU/ngp/thirdparty/dpdk/dpdk-21.11/build
Build type: native build
Program cat found: YES (/usr/bin/cat)
WARNING: You should add the boolean check kwarg to the run_command call.
It currently defaults to false,
but it will default to true in future releases of meson.
See also: https://github.com/mesonbuild/meson/issues/9300
Project name: DPDK
Project version: 21.11.0
C compiler for the host machine: cc (gcc 10.3.1 "cc (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1)")
C linker for the host machine: cc ld.bfd 2.35-8
Host machine cpu family: x86_64
Host machine cpu: x86_64
Program pkg-config found: YES (/usr/bin/pkg-config)
Program check-symbols.sh found: YES (/root/repo/gNB_CU/ngp/thirdparty/dpdk/dpdk-21.11/buildtools/check-symbols.sh)
Program options-ibverbs-static.sh found: YES (/root/repo/gNB_CU/ngp/thirdparty/dpdk/dpdk-21.11/buildtools/options-ibverbs-static.sh)
Program objdump found: YES (/opt/rh/gcc-toolset-10/root/usr/bin/objdump)
Program python3 found: YES (/usr/bin/python3.6)
WARNING: Python files installed by Meson might not be found by python interpreter.
This warning can be avoided by setting "python.platlibdir" option.
WARNING: Python files installed by Meson might not be found by python interpreter.
This warning can be avoided by setting "python.purelibdir" option.
Program cat found: YES (/usr/bin/cat)
Checking for size of "void *" : 8
Checking for size of "void *" : 8
Library m found: YES
Library numa found: YES
Has header "numaif.h" : YES
Library libfdt found: NO
Library libexecinfo found: NO
Found pkg-config: /usr/bin/pkg-config (1.4.2)
Run-time dependency libarchive found: NO (tried pkgconfig)
Run-time dependency libbsd found: NO (tried pkgconfig)
Run-time dependency jansson found: NO (tried pkgconfig)
Run-time dependency libpcap found: YES 1.9.1
Has header "pcap.h" with dependency libpcap: YES
Compiler for C supports arguments -Wextra: YES
config/meson.build:290: WARNING: Consider using the built-in warning_level option instead of using "-Wextra".
Compiler for C supports arguments -Wcast-qual: YES
Compiler for C supports arguments -Wdeprecated: YES
Compiler for C supports arguments -Wformat: YES
Compiler for C supports arguments -Wformat-nonliteral: YES
Compiler for C supports arguments -Wformat-security: YES
Compiler for C supports arguments -Wmissing-declarations: YES
Compiler for C supports arguments -Wmissing-prototypes: YES
Compiler for C supports arguments -Wnested-externs: YES
Compiler for C supports arguments -Wold-style-definition: YES
Compiler for C supports arguments -Wpointer-arith: YES
Compiler for C supports arguments -Wsign-compare: YES
Compiler for C supports arguments -Wstrict-prototypes: YES
Compiler for C supports arguments -Wundef: YES
Compiler for C supports arguments -Wwrite-strings: YES
Compiler for C supports arguments -Wno-address-of-packed-member: YES
Compiler for C supports arguments -Wno-packed-not-aligned: YES
Compiler for C supports arguments -Wno-missing-field-initializers: YES
Compiler for C supports arguments -Wno-zero-length-bounds: YES
Compiler for C supports arguments -mno-avx512f: YES
config/x86/meson.build:10: WARNING: Binutils error with AVX512 assembly, disabling AVX512 support
Compiler for C supports arguments -mavx512f: YES
Checking if "AVX512 checking" compiles: YES
Fetching value of define "__SSE4_2__" : 1
Fetching value of define "__AES__" : 1
Fetching value of define "__AVX__" : 1
Fetching value of define "__AVX2__" :
Fetching value of define "__AVX512BW__" :
Fetching value of define "__AVX512CD__" :
Fetching value of define "__AVX512DQ__" :
Fetching value of define "__AVX512F__" :
Fetching value of define "__AVX512VL__" :
Fetching value of define "__PCLMUL__" : 1
Fetching value of define "__RDRND__" :
Fetching value of define "__RDSEED__" :
Fetching value of define "__VPCLMULQDQ__" :
config/meson.build:427:8: ERROR: C shared or static library 'asan' not found
How do I link the asan library ?

FFMPEG: Why aren't all my codecs showing up when I call av_codec_next()

I'm trying to make a custom build of ffmpeg to use in my c++ application. The only codecs I need are encode/decode for h264 and aac. Because I cannot use GPL code, I'm trying to use openh264.
I successfully built openh264.
I am configuring my ffmpeg build thusly:
../../../configure\
--toolchain=msvc\
--arch=x86_64\
--enable-shared\
--prefix=../../../Build/Windows10/x64\
--disable-programs\
--disable-everything\
--enable-libopenh264\
--extra-ldflags=../../../../openh264/openh264.lib\
--enable-hwaccel=h264_d3d11va\
--enable-encoder=libopenh264\
--enable-encoder=aac\
--enable-decoder=h264\
--enable-decoder=aac\
--enable-muxer=mp4\
--enable-demuxer=mov\
--enable-parser=h264\
--enable-parser=aac\
--disable-dxva2\
--enable-protocol=file
Here is my configure output:
install prefix ../../../Build/Windows10/x64
source path /c/ffmpeg
C compiler cl
C library msvcrt
ARCH x86 (generic)
big-endian no
runtime cpu detection yes
yasm yes
MMX enabled yes
MMXEXT enabled yes
3DNow! enabled yes
3DNow! extended enabled yes
SSE enabled yes
SSSE3 enabled yes
AESNI enabled yes
AVX enabled yes
XOP enabled yes
FMA3 enabled yes
FMA4 enabled yes
i686 features enabled yes
CMOV is fast yes
EBX available no
EBP available no
debug symbols yes
strip symbols no
optimize for size no
optimizations yes
static no
shared yes
postprocessing support no
network support no
threading support w32threads
safe bitstream reader yes
texi2html enabled no
perl enabled yes
pod2man enabled no
makeinfo enabled yes
makeinfo supports HTML no
External libraries:
libopenh264 schannel xlib
External libraries providing hardware acceleration:
cuda cuvid d3d11va nvenc
Libraries:
avcodec avfilter avformat avutil swresample swscale
avdevice
Programs:
Enabled decoders:
aac h264
Enabled encoders:
aac libopenh264
Enabled hwaccels:
h264_d3d11va
Enabled parsers:
aac h264
Enabled demuxers:
mov
Enabled muxers:
mov mp4
Enabled protocols:
file
Enabled filters:
Enabled bsfs:
Enabled indevs:
Enabled outdevs:
License: LGPL version 2.1 or later
As you can see, it is listing two values each for encoders and decoders. HOWEVER, when I try to list the codecs available like so:
av_register_all();
AVCodec* current_codec = av_codec_next(nullptr);
while (current_codec != nullptr)
{
if (av_codec_is_encoder(current_codec))
{
cout << "Found encoder " << current_codec->long_name << endl;
}
current_codec = av_codec_next(current_codec);
}
Only the first call to av_codec_next returns non-null, and it is the h264 decoder. I don't see the aac decoder, and I don't see any encoders at all.
I've tried the same source code but linking to a prebuilt version of ffmpeg (from Zeroane), so I'm sure the code to iterate over the codecs is correct.
What do I need to do to get openh264 and aac to be listed as codecs?
Given that the av_register_all/av_codec_next APIs are deprecated you might want to try av_codec_iterate instead...
const AVCodec *current_codec = nullptr;
void *i = 0;
while ((current_codec = av_codec_iterate(&i))) {
if (av_codec_is_encoder(current_codec)) {
std::cout << "Found encoder " << current_codec->long_name << std::endl;
}
}
Seems to work as expected (Linux + libavcodec.so.58.19.104).

Check external package in Autotools

I would like to check the presence of the google sparsehash package in my C++ program with the Autotools.
Here is a minimal configure.ac:
AC_PREREQ([2.69])
AC_INIT([myprog], [1.0], [adress#email.com])
AC_CONFIG_SRCDIR([main.cpp])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([foreign -Wall -Werror])
AC_PROG_CXX
AC_PROG_CC
AC_CHECK_HEADERS([google/sparse_hash_map])
AC_CONFIG_FILES(Makefile)
AC_OUTPUT
I run autoreconf -vfi, then ./configure, and I get:
checking google/sparse_hash_map usability... no
checking google/sparse_hash_map presence... no
checking for google/sparse_hash_map... no
However, I can check the presence of /usr/include/google/sparse_hash_map, a C++ file, which is a thin wrapper around /usr/include/google/sparsehash/sparsehashtable.h. Moreover, the tiny code:
#include <google/sparse_hash_map>
int main() {return 1;}
compiles and executes fine using g++ test.cpp.
Any suggestion for a newbie?
The AC_CHECK_HEADER macro is using the C compiler by default. You can change the current language using: AC_LANG([C++]) or: AC_LANG_PUSH([C++]) / AC_LANG_POP - as described in the (single-page) manual. e.g.,
...
AC_LANG([C++])
AC_CHECK_HEADERS([google/sparse_hash_map])
# still in C++ 'mode'
or:
...
AC_LANG_PUSH([C++])
AC_CHECK_HEADERS([google/sparse_hash_map])
AC_LANG_POP([C++])
# restored previous language 'mode'

Building MongoDB C++ Driver in Cygwin: generate_error_codes.py not found

I am trying to build the MongoDB client library on Cygwin.
Administrator#dev /cygdrive/e/warez/dev-tools/cpp/mongodb-src-r2.4.8
$ scons mongoclient
scons: Reading SConscript files ...
scons version: 2.3.0
python version: 2 7 5 'final' 0
No special config for [cygwin] which probably means it won't work
Checking whether the C++ compiler works(cached) yes
Checking for C header file unistd.h... (cached) yes
Checking whether clock_gettime is declared... (cached) yes
Checking for C library rt... (cached) yes
Checking for C++ header file execinfo.h... (cached) no
Checking for C library pcap... (cached) no
Checking for C library wpcap... (cached) no
scons: done reading SConscript files.
scons: Building targets ...
scons: *** [build/cygwin/normal/mongo/base/error_codes.h] Source `src/mongo/base/generate_error_codes.py' not found, needed by target `build/cygwin/normal/mongo/base/error_codes.h'.
scons: building terminated because of errors.
Administrator#dev /cygdrive/e/warez/dev-tools/cpp/mongodb-src-r2.4.8
$ ls -l src/mongo/base/generate_error_codes.py
-rwx------+ 1 Administrators None 8736 Oct 31 22:15 src/mongo/base/generate_error_codes.py
There are two questions related to building MongoDB driver:
https://stackoverflow.com/questions/16060068/c-mongodb-driver-in-cygwin
Compiling MongoDB C++ driver on Cygwin
They didn't get the error:
No special config for [cygwin] which probably means it won't work
I've tried both mongodb-src-r2.4.8 and latest code from github (https://github.com/mongodb/mongo), with no luck.
How should I fix the issue? Thanks in advance.
Running scons to build MongoDB under Cygwin bash on Windows is not currently supported. The solution is to use a native Visual Studio Command Prompt.

Cannot link TopHat against libboost_thread.a

I am trying to analyze data generated from RNA-seq experiments. I am trying to align the RNA-Seq reads to the genome using TopHat. But, I have got struck while installing the TopHat!
To begin with I have downloaded the following packages:
tophat-2.1.0.tar.gz
samtools-0.1.19.tar.bz2
boost_1_54_0.zip
I have unpacked all the packages.
For samtools:
I have copied all C-header files in samtools-0.1.19/install/include/bam
Then I copied the libbam.a file in samtools-0.1.19/install/lib
For boost:
I have used the following commands
$./bootstrap.sh
$./b2 install --prefix=PREFIX
For TopHat:
I have used the command line:
$./configure \
--prefix=/path/to/tophat-2.1.0 \
--with-boost=/path/to/boost_1_54_0/PREFIX \
--with-bam=/path/to/samtools-0.1.19/install
But I am getting an error message. The last few lines of the error are as follows:
checking for boostlib >= 1.38.0... yes
checking for bamlib... yes
checking build system type... x86_64-unknown-linux-gnu
checking whether the Boost::Thread library is available... yes
checking for exit in -lboost_thread... no
checking for exit in -lboost_thread... (cached) no
checking for exit in -lboost_thread... (cached) no
checking for exit in -llibboost_thread.a... no
configure: error: Could not link against libboost_thread.a !
Now my question is why I am getting the error message and what can be done to overcome this. I have tried the same in both x86_64 Ubuntu systems, but got the same error all the time!