package/sox: fix static build with libsndfile
authorFabrice Fontaine <fontaine.fabrice@gmail.com>
Wed, 4 Aug 2021 09:08:13 +0000 (11:08 +0200)
committerArnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Wed, 4 Aug 2021 21:15:06 +0000 (23:15 +0200)
Fix the following static build failure with libsndfile raised since
commit dbc6e9e9f385995eb10bbfb0bb08e7674100ce66:

configure:14720: checking for sf_open_virtual in -lsndfile
configure:14745: /tmp/instance-1/output-1/host/bin/xtensa-buildroot-linux-uclibc-gcc -o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -mlongcalls -mauto-litpools -Os -g0  -static -Wall -Wmissing-prototypes -Wstrict-prototypes  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -static -Wl,--as-needed conftest.c -lsndfile    >&5
conftest.c:73:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]
   73 | char sf_open_virtual ();
      | ^~~~
conftest.c:75:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]
   75 | main ()
      | ^~~~
/tmp/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/10.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: /tmp/instance-1/output-1/host/xtensa-buildroot-linux-uclibc/sysroot/usr/lib/libsndfile.a(libsndfile_la-flac.o): in function `flac_byterate':
flac.c:(.text+0xfc): undefined reference to `FLAC__StreamDecoderErrorStatusString'

Fixes:
 - http://autobuild.buildroot.org/results/4bc58ed68b29642876bb02710d0cd4f31540de86

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
package/sox/0005-configure.ac-fix-static-linking-with-sndfile.patch [new file with mode: 0644]

diff --git a/package/sox/0005-configure.ac-fix-static-linking-with-sndfile.patch b/package/sox/0005-configure.ac-fix-static-linking-with-sndfile.patch
new file mode 100644 (file)
index 0000000..2233459
--- /dev/null
@@ -0,0 +1,44 @@
+From 06109c84ab6930265287049c4bf9405e7ebc4986 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+Date: Wed, 4 Aug 2021 10:27:16 +0200
+Subject: [PATCH] configure.ac: fix static linking with sndfile
+
+Use SOX_FMT_PKG to retrieve sndfile dependencies (e.g. flac, opus or
+vorbis). This will fix the following static build failure:
+
+configure:14720: checking for sf_open_virtual in -lsndfile
+configure:14745: /tmp/instance-1/output-1/host/bin/xtensa-buildroot-linux-uclibc-gcc -o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -mlongcalls -mauto-litpools -Os -g0  -static -Wall -Wmissing-prototypes -Wstrict-prototypes  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -static -Wl,--as-needed conftest.c -lsndfile    >&5
+conftest.c:73:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]
+   73 | char sf_open_virtual ();
+      | ^~~~
+conftest.c:75:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]
+   75 | main ()
+      | ^~~~
+/tmp/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/10.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: /tmp/instance-1/output-1/host/xtensa-buildroot-linux-uclibc/sysroot/usr/lib/libsndfile.a(libsndfile_la-flac.o): in function `flac_byterate':
+flac.c:(.text+0xfc): undefined reference to `FLAC__StreamDecoderErrorStatusString'
+
+Fixes:
+ - http://autobuild.buildroot.org/results/4bc58ed68b29642876bb02710d0cd4f31540de86
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+[Upstream status: not sent yet (waiting for feedback on third patch)]
+---
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 8ae3202c..26510769 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -117,7 +117,7 @@ SOX_FMT_REQ([mp3], [MAD LAME TWOLAME])
+ SOX_FMT_PKG([oggvorbis], [ogg vorbis vorbisenc vorbisfile])
+ SOX_FMT_PKG([opus], [opusfile])
+-SOX_DL_LIB([libsndfile], [sndfile.h], [sndfile], [sf_open_virtual])
++SOX_FMT_PKG([libsndfile], [sndfile])
+ SOX_FMT_REQ([sndfile], [LIBSNDFILE])
+ SOX_FMT_LIB([wavpack], [wavpack/wavpack.h], [wavpack], [WavpackGetSampleRate])
+-- 
+2.30.2
+