在mac 10.6雪豹上编译时libsndfile链接错误与libvorbis和libogg

时间:2014-02-23 20:01:35

标签: libsndfile

您好我正在尝试在Mac OSX 10.6上编译libsndfile 1.0.25

我已经使用brew

安装了libvorbis-1.3.4和libogg-1.3.1

1 - 我尝试使用brew

安装libsndfile

2 - 我尝试使用./configure和make

手动安装libsndfile

./configure步骤确实找到了libvorbis和libogg,我已经确认了这些 x86_64库。我希望输出中有一个暗示我不明白怎么做 实施,有人可以很快发现它。谢谢你的期待!

BREW ERROR OUTPUT:

==> Downloading http://www.mega-nerd.com/libsndfile/files/libsndfile-1.0.25.tar.gz
Already downloaded: /Library/Caches/Homebrew/libsndfile-1.0.25.tar.gz
==> Downloading patches
######################################################################## 100.0%
######################################################################## 100.0%
==> Patching
patching file programs/sndfile-play.c
patching file M4/clang.m4
patching file M4/really_gcc.m4
patching file configure.ac
==> autoreconf -i

If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.ac:207: error: possibly undefined macro: AC_SYS_EXTRA_LARGEFILE
configure.ac:295: error: possibly undefined macro: AC_OCTAVE_BUILD
autoreconf: /usr/bin/autoconf failed with exit status: 1

手册使错误输出:

  CCLD   libsndfile.la
Undefined symbols for architecture x86_64:
  "_vorbis_comment_clear", referenced from:
      _vorbis_end in ogg_vorbis.o
      _vorbis_read_header in ogg_vorbis.o
      _vorbis_close in ogg_vorbis.o
  "_vorbis_info_clear", referenced from:
      _vorbis_end in ogg_vorbis.o
      _vorbis_read_header in ogg_vorbis.o
      _vorbis_close in ogg_vorbis.o
  "_ogg_stream_reset", referenced from:
      _vorbis_read_header in ogg_vorbis.o
      _ogg_open in libcommon.a(ogg.o)
  "_ogg_sync_reset", referenced from:
      _vorbis_read_header in ogg_vorbis.o
      _ogg_open in libcommon.a(ogg.o)
  "_ogg_sync_buffer", referenced from:
      _vorbis_read_header in ogg_vorbis.o
      _ogg_vorbis_open in ogg_vorbis.o
      _vorbis_read_sample in ogg_vorbis.o
      _ogg_open in libcommon.a(ogg.o)
  "_ogg_sync_wrote", referenced from:
      _vorbis_read_header in ogg_vorbis.o
      _ogg_vorbis_open in ogg_vorbis.o
      _vorbis_read_sample in ogg_vorbis.o
      _ogg_open in libcommon.a(ogg.o)
  "_ogg_sync_pageout", referenced from:
      _vorbis_read_header in ogg_vorbis.o
      _ogg_vorbis_open in ogg_vorbis.o
      _vorbis_read_sample in ogg_vorbis.o
      _ogg_open in libcommon.a(ogg.o)
  "_ogg_stream_clear", referenced from:
      _vorbis_read_header in ogg_vorbis.o
      _ogg_vorbis_open in ogg_vorbis.o
      _ogg_close in libcommon.a(ogg.o)
      _ogg_open in libcommon.a(ogg.o)
  "_ogg_page_serialno", referenced from:
      _vorbis_read_header in ogg_vorbis.o
      _ogg_vorbis_open in ogg_vorbis.o
      _ogg_open in libcommon.a(ogg.o)
  "_ogg_stream_init", referenced from:
      _vorbis_read_header in ogg_vorbis.o
      _ogg_vorbis_open in ogg_vorbis.o
      _vorbis_write_header in ogg_vorbis.o
      _ogg_open in libcommon.a(ogg.o)
  "_ogg_stream_pagein", referenced from:
      _vorbis_read_header in ogg_vorbis.o
      _ogg_vorbis_open in ogg_vorbis.o
      _vorbis_read_sample in ogg_vorbis.o
      _ogg_open in libcommon.a(ogg.o)
  "_ogg_stream_packetout", referenced from:
      _vorbis_read_header in ogg_vorbis.o
      _ogg_vorbis_open in ogg_vorbis.o
      _vorbis_read_sample in ogg_vorbis.o
      _ogg_open in libcommon.a(ogg.o)
  "_vorbis_block_clear", referenced from:
      _vorbis_read_header in ogg_vorbis.o
      _vorbis_close in ogg_vorbis.o
  "_vorbis_dsp_clear", referenced from:
      _vorbis_read_header in ogg_vorbis.o
      _vorbis_close in ogg_vorbis.o
  "_vorbis_info_init", referenced from:
      _vorbis_read_header in ogg_vorbis.o
      _ogg_vorbis_open in ogg_vorbis.o
      _vorbis_write_header in ogg_vorbis.o
  "_vorbis_comment_init", referenced from:
      _vorbis_read_header in ogg_vorbis.o
      _ogg_vorbis_open in ogg_vorbis.o
      _vorbis_write_header in ogg_vorbis.o
  "_vorbis_synthesis_headerin", referenced from:
      _vorbis_read_header in ogg_vorbis.o
      _ogg_vorbis_open in ogg_vorbis.o
  "_vorbis_synthesis_init", referenced from:
      _vorbis_read_header in ogg_vorbis.o
  "_vorbis_block_init", referenced from:
      _vorbis_read_header in ogg_vorbis.o
      _vorbis_write_header in ogg_vorbis.o
  "_vorbis_comment_query", referenced from:
      _vorbis_read_header in ogg_vorbis.o
  "_vorbis_version_string", referenced from:
      _ogg_vorbis_open in ogg_vorbis.o
  "_ogg_sync_init", referenced from:
      _ogg_vorbis_open in ogg_vorbis.o
      _ogg_open in libcommon.a(ogg.o)
  "_ogg_page_eos", referenced from:
      _ogg_vorbis_open in ogg_vorbis.o
      _vorbis_read_sample in ogg_vorbis.o
      _vorbis_write_samples in ogg_vorbis.o
      _vorbis_close in ogg_vorbis.o
  "_ogg_sync_clear", referenced from:
      _ogg_vorbis_open in ogg_vorbis.o
      _ogg_close in libcommon.a(ogg.o)
      _ogg_open in libcommon.a(ogg.o)
  "_ogg_page_granulepos", referenced from:
      _ogg_vorbis_open in ogg_vorbis.o
  "_vorbis_synthesis_pcmout", referenced from:
      _vorbis_read_sample in ogg_vorbis.o
  "_vorbis_synthesis_read", referenced from:
      _vorbis_read_sample in ogg_vorbis.o
  "_vorbis_synthesis", referenced from:
      _vorbis_read_sample in ogg_vorbis.o
  "_vorbis_synthesis_blockin", referenced from:
      _vorbis_read_sample in ogg_vorbis.o
  "_vorbis_analysis_wrote", referenced from:
      _vorbis_write_samples in ogg_vorbis.o
      _vorbis_close in ogg_vorbis.o
  "_vorbis_analysis_blockout", referenced from:
      _vorbis_write_samples in ogg_vorbis.o
      _vorbis_close in ogg_vorbis.o
  "_vorbis_analysis", referenced from:
      _vorbis_write_samples in ogg_vorbis.o
      _vorbis_close in ogg_vorbis.o
  "_vorbis_bitrate_addblock", referenced from:
      _vorbis_write_samples in ogg_vorbis.o
      _vorbis_close in ogg_vorbis.o
  "_vorbis_bitrate_flushpacket", referenced from:
      _vorbis_write_samples in ogg_vorbis.o
      _vorbis_close in ogg_vorbis.o
  "_ogg_stream_packetin", referenced from:
      _vorbis_write_samples in ogg_vorbis.o
      _vorbis_write_header in ogg_vorbis.o
      _vorbis_close in ogg_vorbis.o
  "_ogg_stream_pageout", referenced from:
      _vorbis_write_samples in ogg_vorbis.o
      _vorbis_close in ogg_vorbis.o
  "_vorbis_analysis_buffer", referenced from:
      _vorbis_write_d in ogg_vorbis.o
      _vorbis_write_f in ogg_vorbis.o
      _vorbis_write_i in ogg_vorbis.o
      _vorbis_write_s in ogg_vorbis.o
  "_vorbis_comment_add_tag", referenced from:
      _vorbis_write_header in ogg_vorbis.o
  "_vorbis_analysis_init", referenced from:
      _vorbis_write_header in ogg_vorbis.o
  "_vorbis_analysis_headerout", referenced from:
      _vorbis_write_header in ogg_vorbis.o
  "_ogg_stream_flush", referenced from:
      _vorbis_write_header in ogg_vorbis.o
ld: symbol(s) not found for architecture x86_64

1 个答案:

答案 0 :(得分:0)

一个解决方案:

我遇到了类似但不相同的libsndfile链接器错误。

问题似乎存在于libsndfile tar.gz本身提供的configure脚本中。

这是个好消息。这意味着libvorbis二进制文件和libogg二进制文件没有任何问题。没有基本的ABI问题阻止了libsndfile与自制软件提供的libvorbis和libogg的链接。

我将这些行放在libsndfile的configure脚本中:

    EXTERNAL_CFLAGS="$FLAC_CFLAGS $OGG_CFLAGS $VORBISENC_CFLAGS"
        EXTERNAL_LIBS="$FLAC_LIBS $VORBISENC_LIBS"

(这些行是逐字复制的。缩进在原始脚本中是不可靠的。)

你注意到不一致吗?

EXTERNAL_CFLAGS是通过连接3组标志形成的,但EXTERNAL_LIBS是通过连接2组成的。

如下更新这些行允许我构建并链接所有内容:

    EXTERNAL_CFLAGS="$FLAC_CFLAGS $OGG_CFLAGS $VORBIS_CFLAGS $VORBISENC_CFLAGS"
        EXTERNAL_LIBS="$FLAC_LIBS $OGG_LIBS $VORBIS_LIBS $VORBISENC_LIBS"

这就是解决问题所需的一切。

我的背景故事:

在原始帖子中(通过@ubob),尝试2被描述为:“使用./configure手动安装libsndfile并生成”

在不知道哪些选项(如果有)被传递给./configure的情况下,我无法确定我的答案是否适用于@ ubob的情况。

我的操作系统:Mac OS X 10.8.1

libsndfile源代码分发版本:libsndfile-1.0.24 (但我也尝试了libsndfile-1.0.25并发现与EXTERNAL_LIBS

相同的情况

从自制程序获得的依赖关系: flac/1.3.1/lib/libFLAC.8.dylib libogg/1.3.2/lib/libogg.0.dylib libvorbis/1.3.5/lib/libvorbis.0.dylib libvorbis/1.3.5/lib/libvorbisenc.2.dylib libvorbis/1.3.5/lib/libvorbisfile.3.dylib

我的构建命令:

export CC="clang -v"
export FLAC_CFLAGS="-I/whichever/path/leads/to/flac/1.3.1/include"
export FLAC_LIBS="-L/whichever/path/leads/toflac/1.3.1/lib -lFLAC.8"
export OGG_CFLAGS="-I/whichever/path/leads/tolibogg/1.3.2/include"
export OGG_LIBS="-L/whichever/path/leads/tolibogg/1.3.2/lib -logg.0"
export VORBIS_CFLAGS="-I/whichever/path/leads/tolibvorbis/1.3.5/include"
export VORBIS_LIBS="-L/whichever/path/leads/tolibvorbis/1.3.5/lib -lvorbis.0"
export VORBISENC_CFLAGS="-I/whichever/path/leads/tolibvorbis/1.3.5/include"
export VORBISENC_LIBS="-L/whichever/path/leads/tolibvorbis/1.3.5/lib -lvorbisenc.2 -lvorbisfile.3"

./configure --enable-external-libs --disable-static --enable-shared  --disable-sqlite --disable-dependency-tracking

make

如上所述,我对EXTERNAL_CFLAGSEXTERNAL_LIBS进行了调整后,我能够成功构建一个合适的libsndfile.1.dylib,现在我的应用程序已经很好地使用了并且工作正常。

作为参考,我的链接器错误如下:

  CCLD   libsndfile.la
Undefined symbols for architecture x86_64:
  "_ogg_page_eos", referenced from:
      _ogg_open in ogg.o
      _ogg_close in ogg.o
      _ogg_read_sample in ogg.o
      _ogg_write_samples in ogg.o
  "_ogg_page_granulepos", referenced from:
      _ogg_open in ogg.o
  "_ogg_page_serialno", referenced from:
      _ogg_open in ogg.o
      _ogg_read_header in ogg.o

[OMITTED FOR BREVITY]

  "_ogg_stream_reset", referenced from:
      _ogg_read_header in ogg.o
  "_ogg_sync_buffer", referenced from:
      _ogg_open in ogg.o
      _ogg_read_header in ogg.o
      _ogg_read_sample in ogg.o
  "_ogg_sync_clear", referenced from:
      _ogg_open in ogg.o
      _ogg_close in ogg.o
  "_ogg_sync_init", referenced from:
      _ogg_open in ogg.o
  "_ogg_sync_pageout", referenced from:
      _ogg_open in ogg.o
      _ogg_read_header in ogg.o
      _ogg_read_sample in ogg.o
  "_ogg_sync_reset", referenced from:
      _ogg_read_header in ogg.o

[OMITTED FOR BREVITY]

  "_vorbis_comment_clear", referenced from:
      _ogg_open in ogg.o
      _ogg_read_header in ogg.o
      _ogg_close in ogg.o
  "_vorbis_comment_init", referenced from:
      _ogg_open in ogg.o
      _ogg_read_header in ogg.o
      _ogg_write_header in ogg.o
  "_vorbis_comment_query", referenced from:
      _ogg_read_header in ogg.o
  "_vorbis_dsp_clear", referenced from:
      _ogg_read_header in ogg.o
      _ogg_close in ogg.o
  "_vorbis_info_clear", referenced from:
      _ogg_open in ogg.o
      _ogg_read_header in ogg.o
      _ogg_close in ogg.o

[OMITTED FOR BREVITY]

ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)