Fail under Linux. Does not find libraries that are really present

9 views
Skip to first unread message

sandro dentella

unread,
Jun 20, 2009, 6:31:52 AM6/20/09
to PyInstaller
Hi,

The same configuration that generates working executable under
Windows
fails under Linux with the following error. Really it works on the
machine
that generated it but fails when run on a different machine.

I generated it under ubuntu 8.04, it fails with the same error under
ubuntu 8.10 and ubuntu 9.04. It complains libffi.so.4: no such file
or
directory, but that file is present in the dir created by
pyinstaller.

Analizing wih strace -e trace=open (http://dpaste.com/57495/) you
can see
that it searches in the real filesystems and does not search in the
dir
generated by pyinstaller (/home/sandro/src/skdir/sqledit)

Any hints?

sandro
*:-)



sandro@ubu904:~/src/skdir/sqledit$ ls -l libff*
-rwxr-xr-x 1 sandro sandro 22308 2008-04-01 20:17 libffi.so.4


sandro@ubu904:~/src/skdir/sqledit$ ./sqledit
locale /home/sandro/src/skdir/sqledit/skdir/build/pyi.linux2/sqledit/
outPYZ1.pyz/locale
Traceback (most recent call last):
File "<string>", line 29, in <module>
File "/home/misc/src/svn/pyinstaller-hg/iu.py", line 439, in
importHook
File "/home/misc/src/svn/pyinstaller-hg/iu.py", line 524, in
doimport
File "skdir/build/pyi.linux2/sqledit/outPYZ1.pyz/sqlkit", line 21,
in <module>
File "/home/misc/src/svn/pyinstaller-hg/iu.py", line 439, in
importHook
File "/home/misc/src/svn/pyinstaller-hg/iu.py", line 524, in
doimport
File "skdir/build/pyi.linux2/sqledit/outPYZ1.pyz/sqlkit.db.proxy",
line 19, in <module>
File "/home/misc/src/svn/pyinstaller-hg/iu.py", line 480, in
importHook
File "/home/misc/src/svn/pyinstaller-hg/iu.py", line 524, in
doimport
File "skdir/build/pyi.linux2/sqledit/outPYZ1.pyz/
sqlkit.db.minspect", line 4, in <module>
File "/home/misc/src/svn/pyinstaller-hg/iu.py", line 480, in
importHook
File "/home/misc/src/svn/pyinstaller-hg/iu.py", line 524, in
doimport
File "skdir/build/pyi.linux2/sqledit/outPYZ1.pyz/sqlkit.debug", line
1, in <module>
File "/home/misc/src/svn/pyinstaller-hg/iu.py", line 439, in
importHook
File "/home/misc/src/svn/pyinstaller-hg/iu.py", line 524, in
doimport
File "skdir/build/pyi.linux2/sqledit/outPYZ1.pyz/
sqlkit.debug.debug", line 80, in <module>
File "/home/misc/src/svn/pyinstaller-hg/iu.py", line 439, in
importHook
File "/home/misc/src/svn/pyinstaller-hg/iu.py", line 508, in
doimport
File "/home/misc/src/svn/pyinstaller-hg/iu.py", line 300, in getmod
File "/home/misc/src/svn/pyinstaller-hg/iu.py", line 109, in getmod
ImportError: could not import gobject (error was: ImportError
('libffi.so.4: cannot open shared object file: No such file or
directory',))

Giovanni Bajo

unread,
Jun 20, 2009, 12:49:54 PM6/20/09
to PyIns...@googlegroups.com
On sab, 2009-06-20 at 03:31 -0700, sandro dentella wrote:
> Hi,
>
> The same configuration that generates working executable under
> Windows
> fails under Linux with the following error. Really it works on the
> machine
> that generated it but fails when run on a different machine.
>
> I generated it under ubuntu 8.04, it fails with the same error under
> ubuntu 8.10 and ubuntu 9.04. It complains libffi.so.4: no such file
> or
> directory, but that file is present in the dir created by
> pyinstaller.
>
> Analizing wih strace -e trace=open (http://dpaste.com/57495/) you
> can see
> that it searches in the real filesystems and does not search in the
> dir
> generated by pyinstaller (/home/sandro/src/skdir/sqledit)
>
> Any hints?

PyInstaller does set LD_LIBRARY_PATH to the directory where it's running
from (in one-dir mode). Try printing the contents of that environment
variable at the beginning of the program, before importing GTK.

So, I'm unsure why it's being ignored when you change the Linux version.
Can you maybe help debugging this? It's probably related to ld.so
configuration or something like that.
--
Giovanni Bajo
Develer S.r.l.
http://www.develer.com


Alessandro Dentella

unread,
Jun 21, 2009, 3:44:23 AM6/21/09
to PyIns...@googlegroups.com
On Sat, Jun 20, 2009 at 06:49:54PM +0200, Giovanni Bajo wrote:
> PyInstaller does set LD_LIBRARY_PATH to the directory where it's running
> from (in one-dir mode). Try printing the contents of that environment
> variable at the beginning of the program, before importing GTK.

no, os.environ['LD_LIBRARY_PATH'] is empty

> So, I'm unsure why it's being ignored when you change the Linux version.

In fact it's empty in the machine where I produce it, also...

sandro
*:-)

Alessandro Dentella

unread,
Jun 23, 2009, 3:34:00 PM6/23/09
to PyIns...@googlegroups.com
> PyInstaller does set LD_LIBRARY_PATH to the directory where it's running
> from (in one-dir mode). Try printing the contents of that environment
> variable at the beginning of the program, before importing GTK.

The following example shows what I mean:

sandro@bluff:/misc/src/svn/pyinstaller-hg$ cat babex/ex2.py
import os
print "\nLD_LIBRARY_PRELOAD:", os.environ.get('LD_LIBRARY_PRELOAD', None)

sandro@bluff:/misc/src/svn/pyinstaller-hg$ Makespec.py babex/ex2.py
wrote /home/misc/src/svn/pyinstaller-hg/ex2/ex2.spec
now run Build.py to build the executable
sandro@bluff:/misc/src/svn/pyinstaller-hg$ Build.py ex2/ex2.spec
checking Analysis
building because babex/ex2.py changed
running Analysis outAnalysis0.toc
Analyzing: ./support/_mountzlib.py
Analyzing: ./support/useUnicode.py
Analyzing: babex/ex2.py
ex2/build/pyi.linux2/ex2/outAnalysis0.toc no change!
checking PYZ
checking PKG
building because babex/ex2.py changed
building PKG outPKG3.pkg
checking EXE
rebuilding outEXE2.toc because pkg is more recent
building EXE from outEXE2.toc
Appending archive to EXE ex2/build/pyi.linux2/ex2/ex2
checking COLLECT
building outCOLLECT4.toc because ex2/build/pyi.linux2/ex2/ex2 is more recent
building COLLECT outCOLLECT4.toc
sandro@bluff:/misc/src/svn/pyinstaller-hg$ ex2/dist/ex2/ex2

LD_LIBRARY_PRELOAD: None

Do other people have different behaviour on Linux?

sandro
*:-)

Giovanni Bajo

unread,
Jul 6, 2009, 12:47:37 PM7/6/09
to PyIns...@googlegroups.com
On Sun, 2009-06-21 at 09:44 +0200, Alessandro Dentella wrote:
> On Sat, Jun 20, 2009 at 06:49:54PM +0200, Giovanni Bajo wrote:
> > PyInstaller does set LD_LIBRARY_PATH to the directory where it's running
> > from (in one-dir mode). Try printing the contents of that environment
> > variable at the beginning of the program, before importing GTK.
>
> no, os.environ['LD_LIBRARY_PATH'] is empty

I have fixed this in PyInstaller trunk. Can you try again please?

Alessandro Dentella

unread,
Jul 6, 2009, 7:31:59 PM7/6/09
to PyIns...@googlegroups.com
On Mon, Jul 06, 2009 at 06:47:37PM +0200, Giovanni Bajo wrote:
>
> On Sun, 2009-06-21 at 09:44 +0200, Alessandro Dentella wrote:
> > On Sat, Jun 20, 2009 at 06:49:54PM +0200, Giovanni Bajo wrote:
> > > PyInstaller does set LD_LIBRARY_PATH to the directory where it's running
> > > from (in one-dir mode). Try printing the contents of that environment
> > > variable at the beginning of the program, before importing GTK.
> >
> > no, os.environ['LD_LIBRARY_PATH'] is empty
>
> I have fixed this in PyInstaller trunk. Can you try again please?


I confirm. It works. Thanks

sandro


Reply all
Reply to author
Forward
0 new messages