undefined reference errors when calling avdevice_register_all()

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

undefined reference errors when calling avdevice_register_all()

Thanh-Nghi Le
When calling avdevice_register_all(), I got these errors:

/usr/local/lib/libavfilter.a(avf_showspectrum.o): In function `config_output':
/opt/install-ffmpeg/ffmpeg-2.1.4/libavfilter/avf_showspectrum.c:170: undefined reference to `av_rdft_end'
/opt/install-ffmpeg/ffmpeg-2.1.4/libavfilter/avf_showspectrum.c:171: undefined reference to `av_rdft_init'
/usr/local/lib/libavfilter.a(avf_showspectrum.o): In function `plot_spectrum_column':
/opt/install-ffmpeg/ffmpeg-2.1.4/libavfilter/avf_showspectrum.c:298: undefined reference to `av_rdft_calc'
/usr/local/lib/libavfilter.a(avf_showspectrum.o): In function `uninit':
/opt/install-ffmpeg/ffmpeg-2.1.4/libavfilter/avf_showspectrum.c:106: undefined reference to `av_rdft_end'
/usr/local/lib/libavfilter.a(vf_dctdnoiz.o): In function `dct_block':
/opt/install-ffmpeg/ffmpeg-2.1.4/libavfilter/vf_dctdnoiz.c:82: undefined reference to `av_dct_calc'
/opt/install-ffmpeg/ffmpeg-2.1.4/libavfilter/vf_dctdnoiz.c:95: undefined reference to `av_dct_calc'
/usr/local/lib/libavfilter.a(vf_dctdnoiz.o): In function `idct_block':
[......]

Here is my code:

#include <stdio.h>
#include <libavformat/avformat.h>

int main() {
        av_register_all();
        avdevice_register_all();

        return 0;
}

And I compile it as below:

gcc demo_capture.c -o demo_capture -pthread -lavformat -lavcodec -lavdevice -lavfilter -lavutil -lswscale -lswresample -lpostproc -lz -lrt -lm -lx264 -lmp3lame -lvpx -lasound -lSDL

If I remove the function avdevice_register_all(), it's OK, no errors appears then.
So what causes the above errors?
Reply | Threaded
Open this post in threaded view
|

Re: undefined reference errors when calling avdevice_register_all()

Clément Bœsch-2
On Tue, Apr 22, 2014 at 03:28:53AM -0700, Thanh-Nghi Le wrote:

> When calling avdevice_register_all(), I got these errors:
>
> /usr/local/lib/libavfilter.a(avf_showspectrum.o): In function
> `config_output':
> /opt/install-ffmpeg/ffmpeg-2.1.4/libavfilter/avf_showspectrum.c:170:
> undefined reference to `av_rdft_end'
> /opt/install-ffmpeg/ffmpeg-2.1.4/libavfilter/avf_showspectrum.c:171:
> undefined reference to `av_rdft_init'
> /usr/local/lib/libavfilter.a(avf_showspectrum.o): In function
> `plot_spectrum_column':
> /opt/install-ffmpeg/ffmpeg-2.1.4/libavfilter/avf_showspectrum.c:298:
> undefined reference to `av_rdft_calc'
> /usr/local/lib/libavfilter.a(avf_showspectrum.o): In function `uninit':
> /opt/install-ffmpeg/ffmpeg-2.1.4/libavfilter/avf_showspectrum.c:106:
> undefined reference to `av_rdft_end'
> /usr/local/lib/libavfilter.a(vf_dctdnoiz.o): In function `dct_block':
> /opt/install-ffmpeg/ffmpeg-2.1.4/libavfilter/vf_dctdnoiz.c:82: undefined
> reference to `av_dct_calc'
> /opt/install-ffmpeg/ffmpeg-2.1.4/libavfilter/vf_dctdnoiz.c:95: undefined
> reference to `av_dct_calc'
> /usr/local/lib/libavfilter.a(vf_dctdnoiz.o): In function `idct_block':
> [......]
>
> Here is my code:
>
> #include <stdio.h>
> #include <libavformat/avformat.h>
>
> int main() {
> av_register_all();
> avdevice_register_all();
>
> return 0;
> }
>
> And I compile it as below:
>
> gcc demo_capture.c -o demo_capture -pthread -lavformat -lavcodec -lavdevice
> -lavfilter -lavutil -lswscale -lswresample -lpostproc -lz -lrt -lm -lx264
> -lmp3lame -lvpx -lasound -lSDL
>
> If I remove the function avdevice_register_all(), it's OK, no errors appears
> then.
> So what causes the above errors?
>
Works for me here. This looks related to libavfilter dependencies to
libavcodec. How was FFmpeg built?

There was a dependency bug at some point but it was fixed and I checked
it's present in 2.1.4 so it should be fine...

--
Clément B.

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

attachment0 (501 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: undefined reference errors when calling avdevice_register_all()

Nicolas George
Le quartidi 4 floréal, an CCXXII, Clément Bœsch a écrit :
> > gcc demo_capture.c -o demo_capture -pthread -lavformat -lavcodec -lavdevice
> > -lavfilter -lavutil -lswscale -lswresample -lpostproc -lz -lrt -lm -lx264
> > -lmp3lame -lvpx -lasound -lSDL
> Works for me here. This looks related to libavfilter dependencies to
> libavcodec. How was FFmpeg built?

My guess is: it was built static. This an ultra-FAQ, and not related to
FFmpeg: static libraries must be in dependency order. In doubt, use
pkg-config.

Regards,

--
  Nicolas George

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: undefined reference errors when calling avdevice_register_all()

Thanh-Nghi Le
This post was updated on .
In reply to this post by Thanh-Nghi Le
Yes, I built FFmpeg as static library. The configuration:

$ ./configure --enable-gpl --enable-libmp3lame  --enable-libvpx --enable-libx264 --enable-nonfree --enable-postproc --enable-version3
$ make
$ sudo checkinstall --pkgname=ffmpeg --pkgversion="5-$(./version.sh)" --backup=no --deldoc=yes --default

I have added more headers into my code: demo_capture.c
I want to open /dev/video0 but it still throws some more diferrent errors: log.txt

I guess I included not enough headers or they are not in correct order.
Reply | Threaded
Open this post in threaded view
|

Re: undefined reference errors when calling avdevice_register_all()

Thanh-Nghi Le
In reply to this post by Nicolas George
Yes, I built FFmpeg as static library. The configuration:

$ ./configure --enable-gpl --enable-libmp3lame  --enable-libvpx --enable-libx264 --enable-nonfree --enable-postproc --enable-version3
$ make
$ sudo checkinstall --pkgname=ffmpeg --pkgversion="5-$(./version.sh)" --backup=no --deldoc=yes --default

I have added more headers into my code: demo_capture.c
I want to open /dev/video0 but it still throws some more diferrent errors: log.txt

I guess I included not enough headers or they are not in correct order.