GNU bug report logs - #47181
Packaging python-soundfile for use in MediaGoblin

Previous Next

Package: guix-patches;

Reported by: Ben Sturmfels <ben <at> sturm.com.au>

Date: Tue, 16 Mar 2021 03:51:01 UTC

Severity: normal

Done: Ben Sturmfels <ben <at> sturm.com.au>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 47181 in the body.
You can then email your comments to 47181 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#47181; Package guix-patches. (Tue, 16 Mar 2021 03:51:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ben Sturmfels <ben <at> sturm.com.au>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Tue, 16 Mar 2021 03:51:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ben Sturmfels <ben <at> sturm.com.au>
To: guix-patches <at> gnu.org
Subject: Packaging python-soundfile for use in MediaGoblin
Date: Tue, 16 Mar 2021 14:50:45 +1100
[Message part 1 (text/plain, inline)]
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
[add-python-soundfile.patch (text/x-patch, inline)]
From 44dd541cca8fb2b1eabdf445c7251c964e17fed8 Mon Sep 17 00:00:00 2001
From: Ben Sturmfels <ben <at> 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(+)

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


Information forwarded to guix-patches <at> gnu.org:
bug#47181; Package guix-patches. (Tue, 16 Mar 2021 07:52:02 GMT) Full text and rfc822 format available.

Message #8 received at 47181 <at> debbugs.gnu.org (full text, mbox):

From: Nicolò Balzarotti <anothersms <at> gmail.com>
To: Ben Sturmfels <ben <at> sturm.com.au>, 47181 <at> debbugs.gnu.org
Subject: Re: [bug#47181] Packaging python-soundfile for use in MediaGoblin
Date: Tue, 16 Mar 2021 08:51:10 +0100
Ben Sturmfels via Guix-patches via <guix-patches <at> gnu.org> writes:

> Hi folks,
>
Hi,
>
>   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ò




Information forwarded to guix-patches <at> gnu.org:
bug#47181; Package guix-patches. (Tue, 16 Mar 2021 11:48:02 GMT) Full text and rfc822 format available.

Message #11 received at 47181 <at> debbugs.gnu.org (full text, mbox):

From: Ben Sturmfels <ben <at> sturm.com.au>
To: Nicolò Balzarotti <anothersms <at> gmail.com>
Cc: 47181 <at> debbugs.gnu.org
Subject: Re: [bug#47181] Packaging python-soundfile for use in MediaGoblin
Date: Tue, 16 Mar 2021 22:47:42 +1100
Thanks Nicolò,

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

>>   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




Information forwarded to guix-patches <at> gnu.org:
bug#47181; Package guix-patches. (Tue, 16 Mar 2021 12:45:02 GMT) Full text and rfc822 format available.

Message #14 received at 47181 <at> debbugs.gnu.org (full text, mbox):

From: Nicolò Balzarotti <anothersms <at> gmail.com>
To: Ben Sturmfels <ben <at> sturm.com.au>
Cc: 47181 <at> debbugs.gnu.org
Subject: Re: [bug#47181] Packaging python-soundfile for use in MediaGoblin
Date: Tue, 16 Mar 2021 13:44:21 +0100
Ben Sturmfels via Guix-patches via <guix-patches <at> gnu.org> writes:

> 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ò




Information forwarded to guix-patches <at> gnu.org:
bug#47181; Package guix-patches. (Tue, 16 Mar 2021 12:56:02 GMT) Full text and rfc822 format available.

Message #17 received at 47181 <at> debbugs.gnu.org (full text, mbox):

From: Léo Le Bouter <lle-bout <at> zaclys.net>
To: Ben Sturmfels <ben <at> sturm.com.au>, Nicolò Balzarotti
 <anothersms <at> gmail.com>
Cc: 47181 <at> debbugs.gnu.org
Subject: Re: [bug#47181] Packaging python-soundfile for use in MediaGoblin
Date: Tue, 16 Mar 2021 13:49:51 +0100
[Message part 1 (text/plain, inline)]
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.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#47181; Package guix-patches. (Tue, 16 Mar 2021 13:10:02 GMT) Full text and rfc822 format available.

Message #20 received at 47181 <at> debbugs.gnu.org (full text, mbox):

From: Efraim Flashner <efraim <at> flashner.co.il>
To: Léo Le Bouter <lle-bout <at> zaclys.net>
Cc: Ben Sturmfels <ben <at> sturm.com.au>, 47181 <at> debbugs.gnu.org,
 Nicolò Balzarotti <anothersms <at> gmail.com>
Subject: Re: [bug#47181] Packaging python-soundfile for use in MediaGoblin
Date: Tue, 16 Mar 2021 15:09:09 +0200
[Message part 1 (text/plain, inline)]
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.

-- 
Efraim Flashner   <efraim <at> 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
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#47181; Package guix-patches. (Tue, 30 Mar 2021 06:21:01 GMT) Full text and rfc822 format available.

Message #23 received at 47181 <at> debbugs.gnu.org (full text, mbox):

From: Ben Sturmfels <ben <at> sturm.com.au>
To: Efraim Flashner <efraim <at> flashner.co.il>
Cc: Léo Le Bouter <lle-bout <at> zaclys.net>, 47181 <at> debbugs.gnu.org,
 Nicolò Balzarotti <anothersms <at> gmail.com>
Subject: Re: [bug#47181] Packaging python-soundfile for use in MediaGoblin
Date: Tue, 30 Mar 2021 17:20:31 +1100
On Wed, 17 Mar 2021, Efraim Flashner wrote:

> 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




Reply sent to Ben Sturmfels <ben <at> sturm.com.au>:
You have taken responsibility. (Sun, 12 Sep 2021 02:15:02 GMT) Full text and rfc822 format available.

Notification sent to Ben Sturmfels <ben <at> sturm.com.au>:
bug acknowledged by developer. (Sun, 12 Sep 2021 02:15:02 GMT) Full text and rfc822 format available.

Message #28 received at 47181-done <at> debbugs.gnu.org (full text, mbox):

From: Ben Sturmfels <ben <at> sturm.com.au>
To: 47181-done <at> debbugs.gnu.org
Subject: Re: bug#47181: Packaging python-soundfile for use in MediaGoblin
Date: Sun, 12 Sep 2021 12:14:47 +1000
Closing - Leo Prinkler added python-soundfile back in May.

Regards,
Ben




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 10 Oct 2021 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 198 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.