all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Python: Error loading shared library in Guix
@ 2019-03-19 14:25 Björn Höfling
  2019-03-19 14:52 ` Ricardo Wurmus
  0 siblings, 1 reply; 3+ messages in thread
From: Björn Höfling @ 2019-03-19 14:25 UTC (permalink / raw)
  To: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 3231 bytes --]

I'm trying to package TaskCoach (https://www.taskcoach.org/) and
stumble upon a problem when running it: It cannot load a shared library
with ctypes. Here is the stacktrace:

  File "/gnu/store/xnigri1g96wl0n14d9bfjyn7jnkn0f6c-taskcoach-1.4.4/lib/python2.7/site-packages/taskcoachlib/application/application.py", line 226, in init
    self.settings, splash=splash)
  File "/gnu/store/xnigri1g96wl0n14d9bfjyn7jnkn0f6c-taskcoach-1.4.4/lib/python2.7/site-packages/taskcoachlib/gui/mainwindow.py", line 92, in __init__
    self.taskFile.efforts())
  File "/gnu/store/xnigri1g96wl0n14d9bfjyn7jnkn0f6c-taskcoach-1.4.4/lib/python2.7/site-packages/taskcoachlib/gui/idlecontroller.py", line 84, in __init__
    super(IdleController, self).__init__()
  File "/gnu/store/xnigri1g96wl0n14d9bfjyn7jnkn0f6c-taskcoach-1.4.4/lib/python2.7/site-packages/taskcoachlib/patterns/observer.py", line 333, in __init__
    super(Observer, self).__init__(*args, **kwargs)
  File "/gnu/store/xnigri1g96wl0n14d9bfjyn7jnkn0f6c-taskcoach-1.4.4/lib/python2.7/site-packages/taskcoachlib/powermgt/idle.py", line 111, in __init__
    IdleQuery.__init__(self)
  File "/gnu/store/xnigri1g96wl0n14d9bfjyn7jnkn0f6c-taskcoach-1.4.4/lib/python2.7/site-packages/taskcoachlib/powermgt/idle.py", line 46, in __init__
    _xss = CDLL('libXss.so.1')
  File "/gnu/store/aws3fsg614lqr392y5pp9w65dy7gmvlx-python2-2.7.15/lib/python2.7/ctypes/__init__.py", line 366, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libXss.so.1: cannot open shared object file: No such file or directory

I had no glue at all what's going on, so I read a bit in the Python
manual and tried to reproduce this in a container:

https://docs.python.org/3/library/ctypes.html

$ guix environment -C --ad-hoc python2 coreutils binutils less which
libxscrnsaver zlib

[env]# ls $GUIX_ENVIRONMENT/lib
libXss.a   libXss.so	libXss.so.1.0.0  libbfd.la     libopcodes.la	libpython2.7.so.1.0  libz.so.1	     pkgconfig
libXss.la  libXss.so.1	libbfd.a	 libopcodes.a  libpython2.7.so	libz.so		     libz.so.1.2.11  python2.7

[env]# python
Python 2.7.15 (default, Jan  1 1970, 00:00:01) 
[GCC 5.5.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes;
>>> from ctypes import *;
>>> libc=CDLL("libc.so.6");
>>> libc
<CDLL 'libc.so.6', handle 7fac69a4b550 at 7fac69733110>
>>> libz=CDLL("libz.so.1");
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/gnu/store/aws3fsg614lqr392y5pp9w65dy7gmvlx-python2-2.7.15/lib/python2.7/ctypes/__init__.py", line 366, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libz.so.1: cannot open shared object file: No such file or directory

So, it can load "libc.so.6", but not "libz.so.1", which I found in my
environments lib folder.

What's wrong here? How can I load the library in Guix? Do I have to set
anything beforehand? I thought the environment would care for me. Do I
need to add anything to my package definition to fix that?

If that helps, I attached the first version of my package definition,
it's not nice, but builds and runs (until the above stacktrace appears).

Thanks,

Björn



	

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-XXX-TaskCoach-First-stub.patch --]
[-- Type: text/x-patch, Size: 4672 bytes --]

From d5ef3a9fb50b88fe1b38b8d62bf3ff78c0fcd147 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20H=C3=B6fling?=
 <bjoern.hoefling@bjoernhoefling.de>
Date: Mon, 18 Mar 2019 23:15:01 +0100
Subject: [PATCH] XXX: TaskCoach: First stub.

---
 gnu/packages/task-management.scm | 99 +++++++++++++++++++++++++++++++-
 1 file changed, 98 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/task-management.scm b/gnu/packages/task-management.scm
index 701e14a5e2..911e4a8475 100644
--- a/gnu/packages/task-management.scm
+++ b/gnu/packages/task-management.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2015 Tomáš Čech <sleep_walker@suse.cz>
+;;; Copyright © 2019 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -21,9 +22,14 @@
   #:use-module (guix packages)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages lua)
+  #:use-module (gnu packages python)
+  #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages tls)
+  #:use-module (gnu packages wxwidgets)
+  #:use-module (gnu packages xorg)
   #:use-module (guix download)
-  #:use-module (guix build-system cmake))
+  #:use-module (guix build-system cmake)
+  #:use-module (guix build-system python))
 
 (define-public taskwarrior
   (package
@@ -59,3 +65,94 @@
 Done time management method.  It supports network synchronization, filtering
 and querying data, exposing task data in multiple formats to other tools.")
     (license license:expat)))
+
+(define-public taskcoach
+  (package
+    (name "taskcoach")
+    (version "1.4.4")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "mirror://sourceforge/taskcoach/taskcoach/Release-" version  "/TaskCoach-" version ".tar.gz"))
+       (sha256 (base32
+                "1jb5n4xmb7qdhcgg3lfin293jcks1g8qvqkjfrfifpmfmpmjqv50"))))
+    (build-system python-build-system)
+    (inputs
+     `(("python2-wxpython" ,python2-wxpython)
+       ("python2-twisted" ,python2-twisted)
+       ))
+    (propagated-inputs
+     `(
+       ("libxscrnsaver" ,libxscrnsaver)
+       ))
+
+    (arguments
+     `(#:tests? #f ; TODO: Needs X11. Maybe simulate one? Cmp. OpenCV.
+       #:python ,python-2))
+    ;;  `(#:tests? #f ; No tests implemented.
+       ;; #:phases
+       ;; (modify-phases %standard-phases
+       ;;   (add-before
+       ;;    'patch-source-shebangs 'remove-broken-symlinks
+       ;;    (lambda _
+       ;;      ;; These files are broken symlinks - delete them.
+       ;;      (delete-file "src/cal")
+       ;;      (delete-file "src/calendar")
+       ;;      (delete-file "src/tw"))))))
+     (home-page "https://www.taskcoach.org")
+    (synopsis "TODO")
+    (description
+     "TODO")
+    ;; thirdparty:
+    ;; aui: wxPython license.
+    ;; chardet: LGPL 2.1+
+
+    ;; EXPAT:
+    ;; guid.py
+    ;; deltaTime.py
+    ;; https://github.com/pyparsing/pyparsing/blob/master/examples/deltaTime.py
+    ;; This is part of pyparsing and thus under EXPAT license.
+
+    ;; snarl.py: This is the same file modulo whitespace and header changes that was
+    ;; published under version 0.2a und GPLv2 here:
+    ;; https://github.com/abl/python-snarl/commit/4e6a26edfc477f5a56493a3a91d7cc3547e28945
+
+    ;; _weakrefset.py: Part of Python, license:psfl.
+
+    ;; dateutil: PSFL
+
+    ;; desktop: LGPG 3+
+
+    ;; gntp: This is GNTP v0.8, see
+    ;; https://github.com/kfdm/gntp/tree/a4c1c69cabaa0faa1f650eab193c9872516eb192/gntp
+    ;; and is thus under EXPAT license.
+
+    ;; keyring: EXPAT | PSFL
+    ;; See https://github.com/philipn/python-keyring-lib
+
+    ;; lockfile: MIT
+    ;; https://github.com/smontanaro/pylockfile/blob/426db4cc4389539797f2b5f26883a55534ce6648/LICENSE
+
+    ;; ntlm: LGPLv3+
+    ;; http://sourceforge.net/projects/ntlmaps/
+
+    ;; pubsub: BSD-2-clause:
+    ;; http://pypubsub.sourceforge.net/about.html#license
+
+    ;; squaremap: EXPAT
+    ;; https://bazaar.launchpad.net/~mcfletch/squaremap/trunk/view/head:/license.txt
+
+    ;; timeline
+    ;; according to this stackoverflow answer, this is written by Frank Nissink for TaskCoach:
+    ;; https://stackoverflow.com/questions/715950/a-wxpython-timeline-widget/819462#819462
+    ;; thus, it is GPL3+
+
+    ;; wxScheduler:
+    ;; https://github.com/expobrain/wxscheduler/tree/1.3.0
+    ;; wxLicense
+
+    ;; xdg
+    ;; LGPL v2
+    ;; https://github.com/takluyver/pyxdg/blob/master/COPYING
+    (license license:gpl3+)))
-- 
2.20.1


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: Python: Error loading shared library in Guix
  2019-03-19 14:25 Python: Error loading shared library in Guix Björn Höfling
@ 2019-03-19 14:52 ` Ricardo Wurmus
  2019-03-19 18:04   ` Björn Höfling
  0 siblings, 1 reply; 3+ messages in thread
From: Ricardo Wurmus @ 2019-03-19 14:52 UTC (permalink / raw)
  To: Björn Höfling; +Cc: guix-devel


Björn Höfling <bjoern.hoefling@bjoernhoefling.de> writes:

> [env]# ls $GUIX_ENVIRONMENT/lib
> libXss.a   libXss.so	libXss.so.1.0.0  libbfd.la     libopcodes.la	libpython2.7.so.1.0  libz.so.1	     pkgconfig
> libXss.la  libXss.so.1	libbfd.a	 libopcodes.a  libpython2.7.so	libz.so		     libz.so.1.2.11  python2.7
>
> [env]# python
> Python 2.7.15 (default, Jan  1 1970, 00:00:01) 
> [GCC 5.5.0] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import ctypes;
>>>> from ctypes import *;
>>>> libc=CDLL("libc.so.6");
>>>> libc
> <CDLL 'libc.so.6', handle 7fac69a4b550 at 7fac69733110>
>>>> libz=CDLL("libz.so.1");
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/gnu/store/aws3fsg614lqr392y5pp9w65dy7gmvlx-python2-2.7.15/lib/python2.7/ctypes/__init__.py", line 366, in __init__
>     self._handle = _dlopen(self._name, mode)
> OSError: libz.so.1: cannot open shared object file: No such file or directory

Using the full file name would work, for example:

./pre-inst-env guix environment --ad-hoc python zlib -- \
    python3 -c "import os; import ctypes; libz=ctypes.CDLL(os.environ['GUIX_ENVIRONMENT']+'/lib/libz.so.1')"

-- 
Ricardo

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Python: Error loading shared library in Guix
  2019-03-19 14:52 ` Ricardo Wurmus
@ 2019-03-19 18:04   ` Björn Höfling
  0 siblings, 0 replies; 3+ messages in thread
From: Björn Höfling @ 2019-03-19 18:04 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 417 bytes --]

On Tue, 19 Mar 2019 15:52:41 +0100
Ricardo Wurmus <rekado@elephly.net> wrote:

> Using the full file name would work, for example:
> 
> ./pre-inst-env guix environment --ad-hoc python zlib -- \
>     python3 -c "import os; import ctypes;
> libz=ctypes.CDLL(os.environ['GUIX_ENVIRONMENT']+'/lib/libz.so.1')"

Right! With a "substitute*", I can inject the full path and then it
works.

Thanks,

Björn


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-03-19 18:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-19 14:25 Python: Error loading shared library in Guix Björn Höfling
2019-03-19 14:52 ` Ricardo Wurmus
2019-03-19 18:04   ` Björn Höfling

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.