4

Hi I'm trying to compile libsndfile 1.0.25 on Mac OSX 10.6

I've installed libvorbis-1.3.4 and libogg-1.3.1 with brew

1 - I tried installing libsndfile with brew

2 - I tried installing libsndfile manually with ./configure and make

The ./configure step does seem to find libvorbis and libogg, and I've confirmed these are x86_64 libraries. I hope there is a hint in the output that I do not understand how to implement and that somebody can quickly spot it. Thanks for looking!

THE 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

THE MANUAL MAKE ERROR OUTPUT:

  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
Jared
  • 1,449
  • 2
  • 19
  • 40
ubob
  • 41
  • 1

1 Answers1

0

One Solution:

I encountered libsndfile linker errors that are similar, but not identical.

The problem seemed to reside in the configure script provided in the libsndfile tar.gz itself.

That is good news. It means that nothing is wrong with the libvorbis binary nor the libogg binary. There is no fundamental ABI issue preventing linkage of libsndfile against the libvorbis and libogg provided by homebrew.

I located these lines in the configure script of libsndfile:

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

(Those lines are copied verbatim. The indentation is wonky in the original script.)

Do you notice the inconsistency?

EXTERNAL_CFLAGS is being formed by concatenating 3 sets of flags, but EXTERNAL_LIBS is formed by concatenating only 2.

Updating those lines as follows allowed me to build and link everything:

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

That is all it took to fix things.


My Backstory:

In the original post (by @ubob), attempt 2 is described as: "installing libsndfile manually with ./configure and make"

Without knowing what options (if any) were passed to ./configure, I cannot know for certain whether my answer applies to @ubob's scenario or not.

my operating system: Mac OS X 10.8.1

libsndfile source distribution version: libsndfile-1.0.24 (but I also tried libsndfile-1.0.25 and found the same situation with EXTERNAL_LIBS)

dependencies obtained from homebrew: 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

my build commands:

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

Once I had made the adjustments to EXTERNAL_CFLAGS and EXTERNAL_LIBS as described above, I was able to successfully build a proper libsndfile.1.dylib, which is now being put to good use in my application and working fine.


For reference, my linker errors were as follows:

  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)
pestophagous
  • 4,069
  • 3
  • 33
  • 42
  • further supporting evidence has been found. after i documented the solution above, i discovered that Axel Roebel patched the MacPorts libsndfile in a similar way: https://trac.macports.org/attachment/ticket/42846/configure.patch – pestophagous Aug 22 '15 at 00:31