Hi Martin,

Thank you for your help.

> Maybe you could try link the libpython.a statically when compiling the
> bootloader.

I made two changes:

1) In source/wscript there is some code that ensures that we do not
link with libpython:

    # Do not link with libpython and libpthread.
    for lib in conf.env.LIB_PYEMBED:
        if lib.startswith('python') or lib.startswith('pthread'):
            conf.env.LIB_PYEMBED.remove(lib)

By adding an extra test on the platform we ensure libpython is
statically linked on AIX:

--- pyinstaller-1.5.1.orig/source/wscript       2010-11-12
17:12:34.000000000 +0100
+++ pyinstaller-1.5.1/source/wscript    2011-09-07 17:19:57.000000000
+0200
@@ -93,9 +93,9 @@
      conf.check_tool('python')
      conf.check_python_headers()

-     # Do not link with libpython and libpthread.
+     # Do not link with libpython (except on AIX) and libpthread.
      for lib in conf.env.LIB_PYEMBED:
-         if lib.startswith('python') or lib.startswith('pthread'):
+         if lib.startswith('pthread') or (lib.startswith('python')
and not myplatform.startswith('aix')):
              conf.env.LIB_PYEMBED.remove(lib)

2) In the bootloader file source/common/launch.c the Python DLL/Shared
Lib is loaded dynamically in function loadPython(). By adding a simple
#elif we prevent loading the shared library on AIX:

--- pyinstaller-1.5.1.orig/source/common/launch.c       2011-07-05
00:17:42.000000000 +0200
+++ pyinstaller-1.5.1/source/common/launch.c    2011-09-07
17:37:13.000000000 +0200
@@ -495,7 +495,11 @@
        }

        mapNames(dll);
- #else
+
+ #elif defined(_AIX)
+   /* On AIX we link statically with libpython so don't try to load
any shared library. */
+
+ #else /* neither WIN32 nor AIX */

        /* Determine the path */
  #ifdef __APPLE__


Now, I can build the boot loader

bash-3.00$ ./waf distclean
'distclean' finished successfully (0.977s)
bash-3.00$ ./waf configure build install
AIX-32bit detected
<..snip..>
'install' finished successfully (0.191s)
bash-3.00$

I can build my executable:

bash-3.00$ rm -rf dist/ build/
bash-3.00$ pyinstaller-1.5.1/Configure.py
<..snip..>
bash-3.00$ pyinstaller-1.5.1/Makespec.py test.py
wrote /data/maconomy/mgd/test.spec
now run Build.py to build the executable
bash-3.00$ pyinstaller-1.5.1/Build.py test.spec
<..snip..>

The generated binary no longer fails (trying to load a non-existent
shared library). However, nothing happens apart from a non-zero exit
code:

bash-3.00$ dist/test/test
bash-3.00$ echo $?
255
bash-3.00$

Running the original Python script, however, works as expected.

bash-3.00$ ./test.py
Hello PyInstaller!
bash-3.00$


Any hints on where to look in the boot loader code will be highly
appreciated.

/Martin

-- 
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pyinstaller?hl=en.

Reply via email to