bbqscreen_client icon indicating copy to clipboard operation
bbqscreen_client copied to clipboard

undefined reference to `av_get_cpu_flags' on GNU/Linux distros

Open EXL opened this issue 10 years ago • 1 comments

I compiled ffmpeg with static versions of the libraries. On the linking step I received the following errors:

/usr/local/lib/libswscale.a(swscale.o): In function `emms_c':
/home/exl/Build/client_linux_x86_2.2.0/ffmpeg/./libavutil/x86/emms.h:37: undefined reference to `av_get_cpu_flags'
/usr/local/lib/libswresample.a(resample.o): In function `multiple_resample':
/home/exl/Build/client_linux_x86_2.2.0/ffmpeg/libswresample/resample.c:315: undefined reference to `av_get_cpu_flags'
/usr/local/lib/libswresample.a(resample.o): In function `emms_c':
/home/exl/Build/client_linux_x86_2.2.0/ffmpeg/./libavutil/x86/emms.h:37: undefined reference to `av_get_cpu_flags'
collect2: error: ld returned 1 exit status
make: *** [Linux/BBQScreenClient2] Error 1

Please fix gcc linker library order

In your BBQScreenClient2.linux.pro file:

LIBS += -lavutil \
    -lavcodec \
    -lavformat \
    -lswscale \
    -lswresample \
    -lz

But we need to (re-order):

LIBS += -lswresample \
    -lavcodec \
    -lavformat \
    -lavutil \
    -lswscale \
    -lz

Patch:

diff --git a/BBQScreenClient2.linux.pro b/BBQScreenClient2.linux.pro
index 225095f..ab034d0 100644
--- a/BBQScreenClient2.linux.pro
+++ b/BBQScreenClient2.linux.pro
@@ -26,11 +26,11 @@ include(BBQScreenClient2.pri)
 LIBS += -L/usr/local/lib

 # Set list of required FFmpeg libraries
-LIBS += -lavutil \
+LIBS += -lswresample \
     -lavcodec \
     -lavformat \
+    -lavutil \
     -lswscale \
-    -lswresample \
     -lz

 # Requied for some C99 defines

raw patch

EXL avatar Mar 10 '14 11:03 EXL

This fixed my compilation process after compiling ffmpeg from source. Thanks!

miguelcobain avatar Feb 23 '15 16:02 miguelcobain