【问题标题】:libsndfile linking error with libvorbis and libogg when compiling on mac 10.6 snow leopard在 mac 10.6 雪豹上编译时,libsndfile 与 libvorbis 和 libogg 的链接错误
【发布时间】:2014-03-25 06:55:23
【问题描述】:

您好,我正在尝试在 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 库。我希望输出中有一个我不明白的提示 实施并且有人可以快速发现它。感谢收看!

冲泡错误输出:

==> 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

【问题讨论】:

    标签: libsndfile


    【解决方案1】:

    一个解决方案:

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

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

    这是个好消息。这意味着 libvorbis 二进制文件和 libogg 二进制文件都没有问题。不存在阻止 libsndfile 与 homebrew 提供的 libvorbis 和 libogg 链接的基本 ABI 问题。

    我在 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 和 make 手动安装 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
    架构 x86_64 的未定义符号:
      “_ogg_page_eos”,引用自:
          _ogg_open 在 ogg.o
          _ogg_close 在 ogg.o
          ogg.o 中的 _ogg_read_sample
          ogg.o 中的 _ogg_write_samples
      “_ogg_page_granulepos”,引用自:
          _ogg_open 在 ogg.o
      “_ogg_page_serialno”,引用自:
          _ogg_open 在 ogg.o
          ogg.o 中的 _ogg_read_header
    
    [为简洁起见省略]
    
      “_ogg_stream_reset”,引用自:
          ogg.o 中的 _ogg_read_header
      “_ogg_sync_buffer”,引用自:
          _ogg_open 在 ogg.o
          ogg.o 中的 _ogg_read_header
          ogg.o 中的 _ogg_read_sample
      “_ogg_sync_clear”,引用自:
          _ogg_open 在 ogg.o
          _ogg_close 在 ogg.o
      “_ogg_sync_init”,引用自:
          _ogg_open 在 ogg.o
      “_ogg_sync_pageout”,引用自:
          _ogg_open 在 ogg.o
          ogg.o 中的 _ogg_read_header
          ogg.o 中的 _ogg_read_sample
      “_ogg_sync_reset”,引用自:
          ogg.o 中的 _ogg_read_header
    
    [为简洁起见省略]
    
      “_vorbis_comment_clear”,引用自:
          _ogg_open 在 ogg.o
          ogg.o 中的 _ogg_read_header
          _ogg_close 在 ogg.o
      “_vorbis_comment_init”,引用自:
          _ogg_open 在 ogg.o
          ogg.o 中的 _ogg_read_header
          ogg.o 中的 _ogg_write_header
      “_vorbis_comment_query”,引用自:
          ogg.o 中的 _ogg_read_header
      “_vorbis_dsp_clear”,引用自:
          ogg.o 中的 _ogg_read_header
          _ogg_close 在 ogg.o
      “_vorbis_info_clear”,引用自:
          _ogg_open 在 ogg.o
          ogg.o 中的 _ogg_read_header
          _ogg_close 在 ogg.o
    
    [为简洁起见省略]
    
    ld:未找到架构 x86_64 的符号
    clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)
    

    【讨论】:

    猜你喜欢
    • 2011-11-11
    • 2019-04-04
    • 2011-12-01
    • 2014-01-04
    • 2010-12-25
    • 1970-01-01
    • 2011-01-01
    • 2011-02-14
    • 1970-01-01
    相关资源
    最近更新 更多