Bug 248533

Summary: audio/libsndfile: TEST=ON implies a static build (without shared library), which breaks consumers
Product: Ports & Packages Reporter: Ross McKelvie <ross>
Component: Individual Port(s)Assignee: Thomas Zander <riggs>
Status: Closed Works As Intended    
Severity: Affects Some People CC: koobs, riggs
Priority: --- Keywords: needs-qa
Version: LatestFlags: riggs: maintainer-feedback+
koobs: merge-quarterly?
Hardware: Any   
OS: Any   
Attachments:
Description Flags
poudirere testport log for audio/libsndfile with TEST=ON
none
poudriere testport log for dependent port audio/libsamplerate (failing)
none
libsndfile-shared-and-static.diff none

Description Ross McKelvie 2020-08-08 09:18:57 UTC
Created attachment 217085 [details]
poudirere testport log for audio/libsndfile with TEST=ON

Ports including audio/libsamplerate, audio/pulseaudio and audio/twolame depend on the shared library libsndfile.so, installed by audio/libsndfile.

However, with STATIC=ON, audio/libsndfile instead produces the static library libsndfile.a.

Setting TEST=ON also sets STATIC=ON, I believe due to the following line in the Makefile:
TEST_IMPLIES= STATIC

This means that libsndfile.so is not available for dependent ports.  I have attached poudriere testport logs for audio/libsndfile with TEST=ON and for an example dependent port audio/libsamplerate.

In my humble opinion, enabling testing during the port build should not break compatibility with dependent ports.  Can testing be achieved in a different way?

For now, the workaround is to build with TEST=OFF.
Comment 1 Ross McKelvie 2020-08-08 09:19:48 UTC
Created attachment 217086 [details]
poudriere testport log for dependent port audio/libsamplerate (failing)
Comment 2 Daniel Engberg freebsd_committer freebsd_triage 2020-08-08 22:31:34 UTC
Unfortunately the only supported variant is by using static compiles so there isn't much you can do at ports level. If you want to pursue upstream to fix this feel free to do so otherwise I'd consider this as a "won't fix" issue.
Comment 3 rkoberman 2020-08-08 23:39:17 UTC
As TEST is off by default, a warning that it will break dependent ports would be a reasonable thing to do. It's only a problem if TEST is explicitly turned on.
Comment 4 Daniel Engberg freebsd_committer freebsd_triage 2020-08-09 20:43:07 UTC
I don't see working around the ports framework viable and not doing unit tests is a bad idea in terms of stability and regression so we're basically down to a limited choice of "solutions":

1, List as "broken" unless STATIC is selected if you have TEST enabled 
2, Keep it as is, there's no way we can safeguard options for ports in general and we have a lot of ports containing options that would break dependent ports.
3, Submit a patch upstream fixing this issue

I opted for option 2 as it requires little interaction and TEST isn't enabled by default however if you have a better solution please attach a patch.
Comment 5 Kubilay Kocak freebsd_committer freebsd_triage 2020-08-15 07:01:43 UTC
(In reply to daniel.engberg.lists from comment #4)

A pkg-message in the TEST=on case to inform the user about the implications so as to improve UX and reduce support (such as this issue), is probably the btest bet until a more permanent solution/resolution can be identified, likely upstream
Comment 6 Daniel Engberg freebsd_committer freebsd_triage 2020-08-15 07:56:54 UTC
Addressed in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=248665
Comment 7 Kubilay Kocak freebsd_committer freebsd_triage 2020-08-17 04:17:33 UTC
Created attachment 217270 [details]
libsndfile-shared-and-static.diff

With the following diff, changing the build to use the recommended (by upstream) autotools build system, provides both static and shared libraries, and tests pass

During QA a number of other issues were identitied (for example, if sqlite is installed for unrelated reasons, its detected by the build and links against it, along with Makefile simpliciation and a number or ports compliance issues rectified
Comment 8 Daniel Engberg freebsd_committer freebsd_triage 2020-08-17 06:04:22 UTC
libsndfile doesn't recieve much development these days and for the last years pretty much everything has gone into cmake rather than autotools hence my decision to change it (and the documentation hasn't recieved updates in years). I can fix sqllite dep and seeing that many projects are moving away from cmake I also think its valuable to have the cmake config files available as many users appears to move away from autotools. This also seems to the trend looking at other package repos fwiw.
Comment 9 Thomas Zander freebsd_committer freebsd_triage 2021-01-09 08:00:28 UTC
I think we should not overcomplicate things here. It would be good to have the build-time tests, but switching to the legacy build system for it does not seem like the best tradeoff. I would like to get this addressed properly upstream, and created https://github.com/libsndfile/libsndfile/issues/684 to track it.
Closing this WAI for now.
Comment 10 Ross McKelvie 2021-01-11 15:09:20 UTC
Thanks, Thomas.  I agree that it makes sense to consider this is an upstream issue, even if looking at the initial reply to your report (at https://github.com/libsndfile/libsndfile/issues/684) it seems unlikely to changed.