Bug 237575 - libsndfile should be rebuilt with flac support
Summary: libsndfile should be rebuilt with flac support
Alias: None
Product: Fedora
Classification: Fedora
Component: libsndfile
Version: 7
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Andreas Thienemann
QA Contact:
Depends On:
Blocks: 275831
TreeView+ depends on / blocked
Reported: 2007-04-23 20:55 UTC by stanl
Modified: 2008-06-17 01:18 UTC (History)
2 users (show)

Fixed In Version: 1.0.17-2.fc7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2008-06-17 01:18:20 UTC
Type: ---

Attachments (Terms of Use)
Patches libsndfile-1.0.17 to use flac 1.1.4 (18.79 KB, patch)
2007-09-13 17:25 UTC, stanl
no flags Details | Diff
patch for configure.ac of libsndfile-1.0.17 to update FLAC to 1.2.1 (915 bytes, patch)
2007-09-26 02:31 UTC, stanl
no flags Details | Diff
Patch for flac.c of libsndfile-1.0.17 to update to FLAC 1.2.1 (22.66 KB, patch)
2007-09-26 02:32 UTC, stanl
no flags Details | Diff

Description stanl 2007-04-23 20:55:25 UTC
Description of problem:
Application linked with libsndfile 1.0.17 on FC6 is not able to write flac
files.  libsndfile is not available as a component above, yet it is available in
the bugzilla search. :-o

Version-Release number of selected component (if applicable):

How reproducible:
Try to open a flac file using libsndfile sf_open.

Steps to Reproduce:
Actual results:
Returns a null pointer with no indication of what is wrong

Expected results:
File open and ready to write.

Additional info:
I am developing an app that writes sound files.  When I link it with
the FC6 libsndfile libraries, either statically or dynamically, it gives
me an error that it cannot open the file.  It is able to create the
file, because I see it there empty.  When I compile the libsndfile
1.0.17 source myself, and link statically to it, the application is
able to create and write the file
> And mystery solved.  At configuration, libsndfile checks
> for flac.  It it isn't there, it puts in a stub that returns an error.
> Libsndfile just returns a null pointer in this case so there is no
> indication of what is wrong. The maintainer of the
> libsndfile package doesn't have flac installed on the machine they
> compile on. That's why it worked when I compiled on my machine where
> flac is installed.  

Then that is a missing "BuildRequires: flac-devel" in the Fedora
Extras 6 package. Can you please submit a bug report about your
problem at http://bugzilla.redhat.com

Comment 1 Anthony Green 2007-07-27 16:05:16 UTC
This is a problem in F7 as well.

Comment 2 Anthony Green 2007-07-27 16:12:05 UTC
I think this bug was filed against the wrong component originally.  I've
corrected this and am changing the assignment of this bug to the libsndfile
package maintainer.  I hope you guys don't mind!  Thanks!

Comment 3 stanl 2007-07-27 17:43:23 UTC
Yeah, when I was opening the bug, the initial list had FLAC in it but the second
one didn't so I picked a close one (ogg if I recall).  Now that I have more
experience I see that I should have selected libsndfile.

Comment 4 Andreas Thienemann 2007-07-27 18:33:32 UTC
Thx for the bug reassignment.

I'm gonna push an update with flac support then. Might be a few days though.

Comment 5 stanl 2007-08-25 18:01:04 UTC
I tried compiling libsndfile with the latest version of flac, 1.1.4 and it fails
as the API changed between 1.1.2 and 1.1.4.  I modified libsndfile module flac.c
and submitted a patch to the creator of libsndfile.  

Perhaps a new version of libsndfile will be coming out with these changes.  So I
suggest you hold off for now.

Comment 6 stanl 2007-08-27 00:27:52 UTC
Erik de Castro Lopo responded to my submission.  He already had a pre release
version with the FLAC changes in it already.  So it should not be that long till
a new and improved version of libsndfile is available.

Comment 7 Andreas Thienemann 2007-09-12 05:19:12 UTC
(In reply to comment #6)
> Erik de Castro Lopo responded to my submission.  He already had a pre release
> version with the FLAC changes in it already.  So it should not be that long till
> a new and improved version of libsndfile is available.

Stan? How far is the flac support? We have another package in fedora which needs
flac support in libsndfile.

Do you want me to add your patch to the rpm? I'm willing to push a sndfile with
flac for rawhide and probably f7 as well.

Comment 8 stanl 2007-09-13 17:13:24 UTC
I used the beta version successfully for flac.  You could add my patch to the
RPM, but when I contacted Erik his response was to point me to the beta.

Here is the link.  I suspect that this is ready for prime time, it just needs
Erik to sign off. erikd@mega-nerd.com

Here is part of his response to me.  You could mention that you are pulling it
for production use and get his feedback.
I hope you didn't put too much work into this, because I have a number
or pre-releases here:


that already fixed this. Basically I pulled the bits of the FLAC sources
I needed into the libsndfile tree. This insulates libsndfile from 
upstream changes like the one you mention, but alis makes it far easier
to compile libsndfile with FLAC support on windows and MacOSX.

If you are uncomfortable with this or it doesn't work for some reason, you can
use my patch for libsndfile-1.0.17.  Let me know as I'll have to dig around to
find it.  The new libsndfile has a  dependency on Octave.

Comment 9 stanl 2007-09-13 17:25:30 UTC
Created attachment 194801 [details]
Patches libsndfile-1.0.17 to use flac 1.1.4

Not extensively tested, but passed the internal libsndfile tests.

Comment 10 stanl 2007-09-13 17:26:51 UTC
I found the patch and have attached it.  

The Octave dependency is for version 2.9.9.  The dependency on Octave doesn't
appear new as there is an Octave subdirectory in libsndfile-1.0.17.

Comment 11 Andreas Thienemann 2007-09-13 21:04:09 UTC
Great. Taking a quick look at the pre release ruins my day. It seems upstream is
statically linking against a packaged copy of the flac library.
This cannot be packaged as it's against fedora policy. Keeping your own library
copy around just asks for trouble in the case of a security update.

So I guess, this needs some patching...

Comment 12 Fedora Update System 2007-09-24 18:00:25 UTC
libsndfile-1.0.17-2.fc7 has been pushed to the Fedora 7 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 13 stanl 2007-09-25 16:42:07 UTC
I tried this on rawhide today.  It fails with the same error as it did with 
libsndfile-1.0.17-1.fc7.  I took a look at the configure file and there is a lot
of validation that flac is present.  It is using some calls that are no longer
present in version 1.1.4 and greater.  They are part of the API change that the
patch was for.  It would be possible to change the configure file but seems more
complete to change the acinclude.m4 and aclocal.m4 files.  Rawhide has flac
version flac-1.2.1-1.fc8

I must have configured with libFLAC 1.1.2 present and then used that configure
to make the library after my patch.  I'll check the autoconf macro for libFLAC
and see if I can get it working properly for autoreconf to generate a valid
configure file on rawhide with libFLAC 1.2.1 present.

Feel free to do this too if you want.  There is no guarantee that I will be
successful. :-)

In addition I'll try this on Fedora 7 as soon as this newer version of
libsndfile is available (wasn't as of yesterday).

Comment 14 stanl 2007-09-25 17:59:07 UTC
It appears that all of the changes between libFLAC 1.1.4 and libFLAC 1.2.1 were
added functionality for the API (no modifications to existing functions), so it
should be enough to check for the 1.1.4 functionality to satisfy libsndfile.

    *  Interface changes (see also the porting guide for specific instructions
on porting to FLAC 1.2.1):
          o libFLAC:
                + Added FLAC__metadata_simple_iterator_is_last()
                + Added FLAC__metadata_simple_iterator_get_block_offset()
                + Added FLAC__metadata_simple_iterator_get_block_length()
                + Added FLAC__metadata_simple_iterator_get_application_id()
          o libFLAC++:
                + Added FLAC::Metadata::SimpleIterator::is_last()
                + Added FLAC::Metadata::SimpleIterator::get_block_offset()
                + Added FLAC::Metadata::SimpleIterator::get_block_length()
                + Added FLAC::Metadata::SimpleIterator::get_application_id()

    *  Interface changes (see also the porting guide for specific instructions
on porting to FLAC 1.2.0):
          o libFLAC:
                + Added FLAC__format_sample_rate_is_subset()
          o libFLAC++:
                + Added FLAC::Decoder::Stream::get_decode_position()

I will therefore look at the libtool version numbers in libflac 1.2.1 and see
which are suitable for libsndfile with the new version flac API calls.  The
autoconf macro should only accept those when configuring libsndfile with the
patch applied (version libflac 1.1.4 or greater).  To do this correctly, (if I
was maintaining libsndfile), I would use the method defined in the porting guide
http://flac.sourceforge.net/api/group__porting.html for libFLAC to do version
specific compilation of libsndfile.

Comment 15 stanl 2007-09-25 18:10:49 UTC
What are your thoughts?  Is it necessary to support legacy libFLAC with
libsndfile under Fedora?  It probably wouldn't be too hard to do so if necessary.

Comment 16 stanl 2007-09-26 02:29:20 UTC
I've attached two patch files for libsndfile-1.0.17 to convert it for use with
libFLAC versions 1.1.1, 1.1.2, and >= 1.1.3.  One is for the configure.ac in the
top level directory, the other is for the flac.c file in src.  Once you have
applied the patches, run autoreconf in the top level directory to regenerate the
configure file.  Then use the standard ./configure, make to compile it.  This
compiled cleanly on rawhide with libFLAC 1.2.1 installed.  It should work with
earlier versions as I put in conditional code to adjust for version of libFLAC.

The internal tests work fine, and I was able to successfully link with the
library and encode and decode flac files on rawhide with libFLAC 1.2.1.

Comment 17 stanl 2007-09-26 02:31:30 UTC
Created attachment 206341 [details]
patch for configure.ac of libsndfile-1.0.17 to update FLAC to 1.2.1

Comment 18 stanl 2007-09-26 02:32:30 UTC
Created attachment 206351 [details]
Patch for flac.c of libsndfile-1.0.17 to update to FLAC 1.2.1

Comment 19 stanl 2007-09-26 16:39:56 UTC
libsndfile-1.0.17-2.fc7 arrived on my Fedora 7 with the latest updates.  I
recompiled and the problem is still there, the same as on rawhide.  I will now
put in place the modifications I used in rawhide above and see if they generate
a library that works for flac with the version of libflac on Fedora 7 (1.1.4).

Comment 20 stanl 2007-09-26 17:51:47 UTC
Downloaded the tar.gz file for libsndfile-1.0.17 and unpacked.  Put the above
patches into the package.  autoreconf complained about the AM_CC_C_O macro (it
asked for this to be put in on rawhide) and a missing file called mkinstalldirs.
 Removed the missing macro and ran again.  Still complained about the missing
file.  Ran configure and make, the flac library was found and identified
correctly.  Set up the resulting libsndfile library as the default and
recompiled my app.  Was able to create and play flac file using the libsndfile I
had installed.  So the changes to flac.c are valid, but there is some difference
between the GNU autotools on Fedora 7 and rawhide that introduces problems. 
I'll see if I can find out which component it is;  difficult as they are
interdependent.  mkinstalldirs is not in the package libsndfile and appears not
to be necessary for compilation.

There is a large difference in size between the libsndfile with flac support and
the one without, 1095398 vs 371124.

Comment 21 Bug Zapper 2008-05-14 12:13:06 UTC
This message is a reminder that Fedora 7 is nearing the end of life. Approximately 30 (thirty) days from now Fedora will stop maintaining and issuing updates for Fedora 7. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as WONTFIX if it remains open with a Fedora 'version' of '7'.

Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version prior to Fedora 7's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 7 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora please change the 'version' of this bug. If you are unable to change the version, please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. If possible, it is recommended that you try the newest available Fedora distribution to see if your bug still exists.

Please read the Release Notes for the newest Fedora distribution to make sure it will meet your needs:

The process we are following is described here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 22 Bug Zapper 2008-06-17 01:18:18 UTC
Fedora 7 changed to end-of-life (EOL) status on June 13, 2008. 
Fedora 7 is no longer maintained, which means that it will not 
receive any further security or bug fix updates. As a result we 
are closing this bug. 

If you can reproduce this bug against a currently maintained version 
of Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.