Packaging python-soundfile for use in MediaGoblin

  • Done
  • quality assurance status badge
Details
4 participants
  • Nicolò Balzarotti
  • Ben Sturmfels
  • Efraim Flashner
  • Léo Le Bouter
Owner
unassigned
Submitted by
Ben Sturmfels
Severity
normal
B
B
Ben Sturmfels wrote on 16 Mar 2021 04:50
(address . guix-patches@gnu.org)
87im5r21uy.fsf@sturm.com.au
Hi folks,

I'm working on adding MediaGoblin to Guix and we're actually getting
fairly close! I'm having some trouble packaging python-soundfile and
would love some help (patch attached).

When I run:

./pre-inst-env guix build python-soundfile

I get:

OSError: cannot load library 'libsndfile.so.1': libsndfile.so.1:
cannot open shared object file: No such file or directory

The libsndfile package is included as an input, but I guess there's
something I'm missing.

Regards,
Ben
From 44dd541cca8fb2b1eabdf445c7251c964e17fed8 Mon Sep 17 00:00:00 2001
From: Ben Sturmfels <ben@sturm.com.au>
Date: Tue, 16 Mar 2021 14:31:15 +1100
Subject: [PATCH] gnu: Add python-soundfile

* gnu/packages/audio.scm (python-soundfile): New variable.
---
gnu/packages/audio.scm | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)

Toggle diff (46 lines)
diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index 67a3e57dd9..6ce5823aa6 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -83,6 +83,7 @@
#:use-module (gnu packages icu4c)
#:use-module (gnu packages image)
#:use-module (gnu packages libbsd)
+ #:use-module (gnu packages libffi)
#:use-module (gnu packages libusb)
#:use-module (gnu packages linux)
#:use-module (gnu packages llvm)
@@ -2379,6 +2380,31 @@ included are the command line utilities @code{send_osc} and @code{dump_osc}.")
(define-public python2-pyliblo
(package-with-python2 python-pyliblo))
+(define-public python-soundfile
+ (package
+ (name "python-soundfile")
+ (version "0.10.3.post1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "SoundFile" version))
+ (sha256
+ (base32
+ "0yqhrfz7xkvqrwdxdx2ydy4h467sk7z3gf984y1x2cq7cm1gy329"))))
+ (build-system python-build-system)
+ (native-inputs
+ `(("python-pytest" ,python-pytest)))
+ (propagated-inputs
+ `(("python-cffi" ,python-cffi)
+ ("libsndfile" ,libsndfile)
+ ("python-numpy" ,python-numpy)))
+ (home-page "https://github.com/bastibe/python-soundfile")
+ (synopsis "An audio library based on libsndfile, CFFI and NumPy")
+ (description
+ "The soundfile module can read and write sound files, representing audio
+data as NumPy arrays.")
+ (license license:bsd-3)))
+
(define-public lilv
(package
(name "lilv")
--
2.30.2
N
N
Nicolò Balzarotti wrote on 16 Mar 2021 08:51
87eegfiljl.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me
Ben Sturmfels via Guix-patches via <guix-patches@gnu.org> writes:

Toggle quote (2 lines)
> Hi folks,
>
Hi,
Toggle quote (4 lines)
>
> OSError: cannot load library 'libsndfile.so.1': libsndfile.so.1:
> cannot open shared object file: No such file or directory
>
You can patch the sounfile.py file, setting the correct library path.

Many other python packages do this, like python-file, python-libarchive-c, python-pyzbar

It should look something like (untested):

#+begin_src scheme
(arguments
`(#:phases
(modify-phases %standard-phases
(add-before 'build 'set-library-file-name
(lambda* (#:key inputs #:allow-other-keys)
(let ((libsndfile (assoc-ref inputs "libsndfile")))
(substitute* "soundfile.py"
(("find_library\\('sndfile'\\)")
(string-append "'" libsndfile "/lib/libsndfile.so.0'")))
#t))))))
#+end_src

Nicolò
B
B
Ben Sturmfels wrote on 16 Mar 2021 12:47
(name . Nicolò Balzarotti)(address . anothersms@gmail.com)(address . 47181@debbugs.gnu.org)
87ft0v1fs1.fsf@sturm.com.au
Thanks Nicolò,

On Tue, 16 Mar 2021, Nicolò Balzarotti wrote:

Toggle quote (22 lines)
>> OSError: cannot load library 'libsndfile.so.1': libsndfile.so.1:
>> cannot open shared object file: No such file or directory
>>
> You can patch the sounfile.py file, setting the correct library path.
>
> Many other python packages do this, like python-file, python-libarchive-c, python-pyzbar
>
> It should look something like (untested):
>
> #+begin_src scheme
> (arguments
> `(#:phases
> (modify-phases %standard-phases
> (add-before 'build 'set-library-file-name
> (lambda* (#:key inputs #:allow-other-keys)
> (let ((libsndfile (assoc-ref inputs "libsndfile")))
> (substitute* "soundfile.py"
> (("find_library\\('sndfile'\\)")
> (string-append "'" libsndfile "/lib/libsndfile.so.0'")))
> #t))))))
> #+end_src

Thanks, that solves my problem. One follow-up question - is it better to
use the ".so" link or the specific "so.0"?

I've now discovered a subsequent issue with libsndfile that I'll need to
put a patch in for first though. Progress!

Regards,
Ben
N
N
Nicolò Balzarotti wrote on 16 Mar 2021 13:44
(name . Ben Sturmfels)(address . ben@sturm.com.au)(address . 47181@debbugs.gnu.org)
87a6r3i7yy.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me
Ben Sturmfels via Guix-patches via <guix-patches@gnu.org> writes:

Toggle quote (2 lines)
> Thanks, that solves my problem. One follow-up question - is it better to
> use the ".so" link or the specific "so.0"?
I don't know what's preferred, so let's wait for somebody else who knows
more than me :)

Nicolò
L
L
Léo Le Bouter wrote on 16 Mar 2021 13:49
(address . 47181@debbugs.gnu.org)
fe84ee4badae4bd06c8298eb6e9cb18fc89f2daf.camel@zaclys.net
On Tue, 2021-03-16 at 22:47 +1100, Ben Sturmfels via Guix-patches via
wrote:
Toggle quote (4 lines)
> Thanks, that solves my problem. One follow-up question - is it better
> to
> use the ".so" link or the specific "so.0"?

Use the more specific one since that is a symlink for a fixed ABI, if
the main library changes ABI it can then symlink with a bumped number
to indicate that and not break any dependent package. If you use the
less specific .so file directly then your package may suffer an ABI
break.
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEFIvLi9gL+xax3g6RRaix6GvNEKYFAmBQqW8ACgkQRaix6GvN
EKbYuRAAloRsDdy6cEZ8iDJJ0rf/NqtD3NErp/KgImmNGdonjxOg6x/z+FwkJo4L
Ma76RHcqjwviaz77fAWJhiimhhQl+FvKWCdZQtURqyD32ivbLbIbtnM80m52xq0/
pDH1xGUKy1EZrXfWzJTkxGswAOQLz9NlM10tHOxWwAnlbhpbrSUL4gW9sDiEGR+h
PUbMTulaF6SAHR6h94Dq+LIJpBBj75xU41VGYC240yaUKuAMaD3zOhQPFBWmBP24
g96y7dIvERLQO5qLqCjh+/57Zz+3kRIWFyJkC09CU3SQblAgKjWZDQnE/+hRe3dG
kt3U9j16CF3Gmzk82JEwY+pVMnXmPaPBAjJirpFDp+tKQiU/GdIL0SIJ6ufDpccn
B/EzGJVT2Yx+xpGgvvCUQOP/sOByRfB+YHfd91NSrh+nRaRNmIMwG9Zm6f/Ms2Q0
oBZuz3LslhYXFWG3+OJJ4tVICS8KRqtrPJeuHNw7wfK5ZgYYCYd8FYSmPlcyGkYC
LG/sPGDyjI6Yxqo96QdcuOrjVKv4/jZHb3SI+n7MU8BHzvr/KgyY3n5i/qcgFKmS
k9HkEvpZifu4ca3osgJfjBQwE3Tv0Ar43WyRSGjl0IcmPwTyNurg9lM5RxRHWpJz
pbbPWSNAhVlaixkjj0eVNIbnVOlpOMBwDPsTDogA/Xd4DcURHdk=
=sgQg
-----END PGP SIGNATURE-----


E
E
Efraim Flashner wrote on 16 Mar 2021 14:09
(name . Léo Le Bouter)(address . lle-bout@zaclys.net)
YFCt9d9eni+dBHdz@3900XT
On Tue, Mar 16, 2021 at 01:49:51PM +0100, Léo Le Bouter via Guix-patches via wrote:
Toggle quote (12 lines)
> On Tue, 2021-03-16 at 22:47 +1100, Ben Sturmfels via Guix-patches via
> wrote:
> > Thanks, that solves my problem. One follow-up question - is it better
> > to
> > use the ".so" link or the specific "so.0"?
>
> Use the more specific one since that is a symlink for a fixed ABI, if
> the main library changes ABI it can then symlink with a bumped number
> to indicate that and not break any dependent package. If you use the
> less specific .so file directly then your package may suffer an ABI
> break.

The package gets rebuilt each time so it is less likely with Guix.
However, if you substitute libsndfile.so and the full text is
libsndfile.so.0.0.23 (or something similar) then you'll still end up
with /gnu/store/...libsndfile.../libsndfile.so.0.0.23.

--
Efraim Flashner <efraim@flashner.co.il> ????? ?????
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmBQrfIACgkQQarn3Mo9
g1HajRAAmYNnr9XSnEifuaO6b/38q1tw5vkU3jyiba0rAyN6JyPFF5luUh6tJHie
pdRY1nS38UwVjzMmD8AUO5u6eqZdrTQTdwAu4Ev1TkWj4MRC7JER5wwrpi0E+Kmt
3tqnWhsD/PQjBtFbnQlvt0fIVRFG4umlGVtrtLk7t3Zg2borI4tGObyjVGuw2oqM
IoSiMQJ3aK6yDORlhYKqypjauXSeDAhPZe4mJuXZ2xFuq+8G5t7n2rGVt5R2npNa
J2TSDqxxG4i1TevKUxwU/Av77cUFBu/ziIu7soASfCpVAErTssGHwPZ+H5tyFDB4
/gFmm01LELtL/UVivyVtHI3KCwx+RUuJxhYaR/KAPhQFFpalFcQYJNBTfZC0idwx
2/QyJL51TEssZYim59rCbvZwITvr7ZLH2BQimysvLnZZO0taSNdWf1r0D3SvUYCF
Rc1jGjJLYD+9BAbNoQ6k1l3YIcl2xpSKcSu7vck0FaZKjiR6oJRBM9a1x2jxtI9v
IJfoy7g2KT0aU8zV8BV+xT3S8B6aLivry5V421gcidlkwiCsrryFM4P/ys0kv1Io
qQcViKTe6cXwJ+lXMEeKnhHYs0t+gcr1T0+V92/we3iMKBnKjJhZIWYUvX/ue9kJ
VDnAcxVIDksS6IelDcxbbbe7TRseqyMZVuyjlh2cuYPwcgUxqjY=
=fUYN
-----END PGP SIGNATURE-----


B
B
Ben Sturmfels wrote on 30 Mar 2021 08:20
(name . Efraim Flashner)(address . efraim@flashner.co.il)
87eefxqi1c.fsf@sturm.com.au
On Wed, 17 Mar 2021, Efraim Flashner wrote:

Toggle quote (18 lines)
> On Tue, Mar 16, 2021 at 01:49:51PM +0100, Léo Le Bouter via Guix-patches via wrote:
>> On Tue, 2021-03-16 at 22:47 +1100, Ben Sturmfels via Guix-patches via
>> wrote:
>> > Thanks, that solves my problem. One follow-up question - is it better
>> > to
>> > use the ".so" link or the specific "so.0"?
>>
>> Use the more specific one since that is a symlink for a fixed ABI, if
>> the main library changes ABI it can then symlink with a bumped number
>> to indicate that and not break any dependent package. If you use the
>> less specific .so file directly then your package may suffer an ABI
>> break.
>
> The package gets rebuilt each time so it is less likely with Guix.
> However, if you substitute libsndfile.so and the full text is
> libsndfile.so.0.0.23 (or something similar) then you'll still end up
> with /gnu/store/...libsndfile.../libsndfile.so.0.0.23.

Thanks Efraim, Léo and Nicolò for the info on .so links.

This patch is now waiting on updates to libsndfile in core-updates. I'll
post an updated patch when that's merged. For now, I've inlined this
into MediaGoblin's guix-env.scm so I can keep working on the packaging
there.

Regards,
Ben
B
B
Ben Sturmfels wrote on 12 Sep 2021 04:14
Re: bug#47181: Packaging python-soundfile for use in MediaGoblin
(address . 47181-done@debbugs.gnu.org)
878s02pmjs.fsf_-_@sturm.com.au
Closing - Leo Prinkler added python-soundfile back in May.

Regards,
Ben
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 47181@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 47181
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch