[Libav-user] Linker error libswresample

Davide Caresia caresia.davide at gmail.com
Sat Aug 8 16:23:41 CEST 2015

Ok, I made a clean install of ffmpeg from the last 2.7.2 tar file.
I noticed that the problem does not regard the allocation call swr_alloc(),
but just the option setting calls.
I tryed to change the function to use swr_alloc_set_opts instead of setting
single options,
like this:

     /* create resampling context setting the options */
    struct SwrContext *resampleContext;
    resampleContext = swr_alloc_set_opts(resampleContext,
                                      AV_CH_LAYOUT_MONO, AV_SAMPLE_FMT_U8,
*(codec->sample_fmts), frame->sample_rate,
                                      0, NULL);
    if (!resampleContext) {
fprintf(stderr, "Could not allocate resampler context\n");
return NULL;

    /* initialize the resampling context */
    if (swr_init(resampleContext) < 0) {
fprintf(stderr, "Failed to initialize the resampling context\n");
return NULL;

but i get the same av_callog undefined reference error, for the functions
swri_rematrix_init andh resample_init. Here is the new linker error i get.

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS=
make[1]: ingresso nella directory
"/usr/bin/make"  -f nbproject/Makefile-Debug.mk
make[2]: ingresso nella directory
mkdir -p build/Debug/GNU-Linux-x86
rm -f "build/Debug/GNU-Linux-x86/dataReader.o.d"
g++    -c -g -MMD -MP -MF "build/Debug/GNU-Linux-x86/dataReader.o.d" -o
build/Debug/GNU-Linux-x86/dataReader.o dataReader.cpp
mkdir -p dist/Debug/GNU-Linux-x86
g++ -o dist/Debug/GNU-Linux-x86/audiosync
build/Debug/GNU-Linux-x86/dataReader.o build/Debug/GNU-Linux-x86/main.o
build/Debug/GNU-Linux-x86/tansforms.o build/Debug/GNU-Linux-x86/tognuplot.o
 -lavformat -lavcodec -lavutil -lswresample -lz -lm -llzma -lfftw3
/usr/local/lib/libswresample.a(rematrix.o): nella funzione
riferimento non definito a "av_calloc"
riferimento non definito a "av_calloc"
riferimento non definito a "av_calloc"
/usr/local/lib/libswresample.a(resample.o): nella funzione "resample_init":
riferimento non definito a "av_calloc"
collect2: error: ld returned 1 exit status
nbproject/Makefile-Debug.mk:65: set di istruzioni per l'obiettivo
"dist/Debug/GNU-Linux-x86/audiosync" non riuscito
make[2]: *** [dist/Debug/GNU-Linux-x86/audiosync] Errore 1
make[2]: uscita dalla directory
nbproject/Makefile-Debug.mk:62: set di istruzioni per l'obiettivo
".build-conf" non riuscito
make[1]: *** [.build-conf] Errore 2
make[1]: uscita dalla directory
nbproject/Makefile-impl.mk:39: set di istruzioni per l'obiettivo
".build-impl" non riuscito
make: *** [.build-impl] Errore 2

BUILD FAILED (exit value 2, total time: 451ms)

2015-08-08 13:59 GMT+02:00 Davide Caresia <caresia.davide at gmail.com>:

> No luck with this linking order, still get the same errors
> 2015-08-07 0:11 GMT+02:00 Mohamed Moanis <mohamed_moanis at outlook.com>:
>> >Date: Thu, 6 Aug 2015 16:41:33 +0200
>> >From: caresia.davide at gmail.com
>> >To: libav-user at ffmpeg.org
>> >Subject: [Libav-user] Linker error libswresample
>> >And here is the error I get, compiling with netbeans 8.0.2, g++
>> 4.9.2-10ubuntu13
>> >(additional g++ commands: -lavcodec -lavformat -lavutil -lswresample
>> -lfftw3 -lm)
>> I used to link ffmpeg on Ubuntu in this order,
>> try it
>> -lavformat -lavcodec -lavutil -lswresample -lz -lm -llzma
>> _______________________________________________
>> Libav-user mailing list
>> Libav-user at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/libav-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20150808/7aa6ad53/attachment.html>

More information about the Libav-user mailing list