无法建造;架构x86_64的未定义符号:

时间:2015-01-23 02:51:18

标签: objective-c xcode macos compilation ffmpeg

在尝试创建RTSP屏幕流媒体服务器的过程中,我尝试以CocoaSplit为例。

问题是,我无法编译。

我在https://trac.ffmpeg.org/wiki/CompilationGuide/MacOSX上的FFMpeg指南之后使用Homebrew在我的计算机上安装了FFMpeg。

但是在编译时,Xcode会抛出诸如

之类的错误
Undefined symbols for architecture x86_64:

"_cmnMemAlloc", referenced from:_aac_encode_init in libavcodec.a(libvo-aacenc.o)
"_cmnMemCheck", referenced from:_aac_encode_init in libavcodec.a(libvo-aacenc.o)
"_cmnMemCopy", referenced from:_aac_encode_init in libavcodec.a(libvo-aacenc.o)
"_cmnMemFree", referenced from:_aac_encode_init in libavcodec.a(libvo-aacenc.o)
"_cmnMemSet", referenced from:_aac_encode_init in libavcodec.a(libvo-aacenc.o)

等等。

项目设置中的标题搜索路径字段中包含/usr/local/include目录。

这里似乎有什么问题?

1 个答案:

答案 0 :(得分:0)

Waaaay迟到了我认识的派对,但我遇到了同样的问题,也许我的解决方案对未来的其他一些可怜的灵魂有用。

问题是您缺少一个名为lib-aacenc的库。我的位于这里(似乎是由Homebrew安装):

usr/local/Cellar/libvo-aacenc/0.1.3/lib/

我认为这是通过Homebrew安装ffmpeg的一部分。至少,如果我这样做:

brew info ffmpeg

我得到了这样的回报:

ffmpeg: stable 2.8, HEAD
Play, record, convert, and stream audio and video
https://ffmpeg.org/
/usr/local/Cellar/ffmpeg/2.8 (215 files, 47M) *
  Built from source with: --with-ffplay
From:     https://github.com/Homebrew/homebrew/blob/master/Library/Formula/ffmpeg.rb
==> Dependencies
Build: pkg-config ✔, texi2html ✔, yasm ✔
Recommended: x264 ✔, lame ✔, libvo-aacenc ✔, xvid ✔
Optional: faac ✘, fontconfig ✘, freetype ✔, theora ✘, libvorbis ✔, libvpx ✘, rtmpdump ✘, opencore-amr ✘, libass ✘, openjpeg ✘, speex ✘, schroedinger ✘, fdk-aac ✘, opus ✘, frei0r ✘, libcaca ✘, libbluray ✘, libsoxr ✘, libquvi ✘, libvidstab ✘, x265 ✘, openssl ✘, libssh ✘, webp ✘, zeromq ✘
==> Options
--with-faac
  Build with faac support
--with-fdk-aac
  Enable the Fraunhofer FDK AAC library
--with-ffplay
  Enable FFplay media player
--with-fontconfig
  Build with fontconfig support
--with-freetype
  Build with freetype support
--with-frei0r
  Build with frei0r support
--with-libass
  Enable ASS/SSA subtitle format
--with-libbluray
  Build with libbluray support
--with-libcaca
  Build with libcaca support
--with-libquvi
  Build with libquvi support
--with-libsoxr
  Enable the soxr resample library
--with-libssh
  Enable SFTP protocol via libssh
--with-libvidstab
  Enable vid.stab support for video stabilization
--with-libvorbis
  Build with libvorbis support
--with-libvpx
  Build with libvpx support
--with-opencore-amr
  Enable Opencore AMR NR/WB audio format
--with-openjpeg
  Enable JPEG 2000 image format
--with-openssl
  Enable SSL support
--with-opus
  Build with opus support
--with-rtmpdump
  Enable RTMP protocol
--with-schroedinger
  Enable Dirac video format
--with-speex
  Build with speex support
--with-theora
  Build with theora support
--with-tools
  Enable additional FFmpeg tools
--with-webp
  Enable using libwebp to encode WEBP images
--with-x265
  Enable x265 encoder
--with-zeromq
  Enable using libzeromq to receive commands sent through a libzeromq client
--without-lame
  Disable MP3 encoder
--without-libvo-aacenc
  Disable VisualOn AAC encoder
--without-qtkit
  Disable deprecated QuickTime framework
--without-x264
  Disable H.264 encoder
--without-xvid
  Disable Xvid MPEG-4 video encoder
--HEAD
  Install HEAD version
==> Caveats
FFmpeg has been built without libfaac for licensing reasons;
libvo-aacenc is used by default.
To install with libfaac, you can:
  brew reinstall ffmpeg --with-faac

You can also use the experimental FFmpeg encoder, libfdk-aac, or
libvo_aacenc to encode AAC audio:
  ffmpeg -i input.wav -c:a aac -strict experimental output.m4a
Or:
  brew reinstall ffmpeg --with-fdk-aac
  ffmpeg -i input.wav -c:a libfdk_aac output.m4a

正如您所看到的,您必须实际指定--without-libvo-aacenc才能安装它。

但是,是的,简而言之,如果您开始看到有关lib-aacenc的链接器错误,那么它可能位于此处附近的某处:

usr/local/Cellar/libvo-aacenc/0.1.3/lib/