build error: missing _av* symbols

bennykhoo

New Member
My build terminated with some missing symbols (see below log). Later I noticed that the FFMPEG libraries have been taken out from linking. The build complete to last after comment out the line (see patch). Still new to CMake. Do I miss something? Thx!

diff --git a/libobs/CMakeLists.txt b/libobs/CMakeLists.txt

index 2f5120f..dcdda94 100644

--- a/libobs/CMakeLists.txt

+++ b/libobs/CMakeLists.txt

@@ -7,7 +7,7 @@ find_package(FFMpeg REQUIRED

OPTIONAL_COMPONENTS avcodec)

include_directories(${FFMPEG_INCLUDE_DIRS})

----

-list(REMOVE_ITEM FFMPEG_LIBRARIES ${FFMPEG_AVCODEC_LIBRARIES})

+# list(REMOVE_ITEM FFMPEG_LIBRARIES ${FFMPEG_AVCODEC_LIBRARIES})



find_package(ImageMagick QUIET COMPONENTS MagickCore)


------------------------------

% cmake .. && make

-- Jansson >=2.5 not found, building bundled version

-- Found FFMpeg: /opt/local/lib/../lib/libavformat.dylib (found version "56.4.101") found components: avformat avutil swscale swresample avcodec

-- Using ImageMagick for image loading in libobs

-- Libfdk not found - obs-libfdk plugin disabled

-- Found FFMpeg: /opt/local/lib/../lib/libavcodec.dylib (found version "56.1.100") found components: avcodec avutil swscale avformat swresample

-- Configuring done

-- Generating done

-- Build files have been written to: /Users/bennykhoo/Sources/obs-studio/build

[ 0%] Built target glad

[ 6%] Built target jansson

Linking C shared library libobs.dylib

Undefined symbols for architecture x86_64:

"_av_free_packet", referenced from:

_media_remux_job_process in media-remux.c.o

"_avcodec_copy_context", referenced from:

_media_remux_job_create in media-remux.c.o

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

make[2]: *** [libobs/libobs.0.dylib] Error 1

make[1]: *** [libobs/CMakeFiles/libobs.dir/all] Error 2

make: *** [all] Error 2
 

Lain

Forum Admin
Lain
Forum Moderator
Developer
Not sure. Where are you getting your FFmpeg from? Personally, I manually compile it. Most people however tend to use macports/brew. Which method are you using?
 

bennykhoo

New Member
Hi Jim,

I am using macports to source out my FFmpeg installation e.g. sudo port install ffmpeg. Any idea what might be wrong with my ffmpeg installation? Thx
 

Lain

Forum Admin
Lain
Forum Moderator
Developer
Unfortunately, I'm not quite sure. I would say to just compile it manually, just my opinion.
 

Michael Forrest

New Member
Hi bennykhoo, did you have any luck compiling this? I'm getting the same compile error:

Undefined symbols for architecture x86_64:
"_av_free_packet", referenced from:
_media_remux_job_process in media-remux.c.o

Git blame on the ffmpeg source shows av_free_packet appearing in 2013 though.

6e1b1a27 (Michael Niedermayer 2013-08-30 20:57:55 +0200 219) av_free_packet(pkt);
6e1b1a27 (Michael Niedermayer 2013-08-30 20:57:55 +0200 244) av_free_packet(pkt);
ce1d9c85 (Ramiro Polla 2009-04-30 12:06:34 +0000 280) void av_free_packet(AVPacket *pkt)
94eadee7 (Michael Niedermayer 2011-04-20 03:25:48 +0200 373) av_free_packet(&old);


I've been having trouble compiling ffmpeg but I'm gonna persevere.

 

Lain

Forum Admin
Lain
Forum Moderator
Developer
Yea, some of the functions we use were added semi-recently to FFmpeg. I was unaware of it at the time when I implemented it though.
 
Top