4

您好我正在尝试在 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
4

1 回答 1

0

一种解决方案:

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

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

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

我在configurelibsndfile 的脚本中找到了这些行:

    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_CFLAGS,现在它在我的应用程序中得到了很好的使用并且工作正常。EXTERNAL_LIBSlibsndfile.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 查看调用)
于 2015-08-22T00:15:23.143 回答