This is the summary of the steps to install wxPython on IBM AIX machine.
OS: AIX 5.3
Compiler: xlc_r, xlC_r: AIX Compiler, Version 6
wxPython: wxPython-src-2.6.1.0
Date: 1/30/2006

You should read BUILD.txt for general instructions first.

The whole process of the installation of the wxPython consists of two
major steps.
      1. Build wxWidgets/wxGTK shared libraries.
      2. Build wxPython shared libraries.

Note that I was successful only with debug enabled version of wxPython
shared library.  I had problems with release version since the
compilation of _core_wrap.cpp hung indefinitely.  It might be due to
optimization level, but I didn't spend time to fix it since the debug
enabled version is working perfectly.  Note that you'll see lots of
"ld: 0711-224 WARNING: Duplicate symbol" warning messages.  You can
safely disregard these warning messages since this is due to how AIX
compiler/linker handles C++ files.


<<<wxWidgets/wxGTK>>>
<configure>

The build with the following options was successful.  No extension
modules such as STC are installed since my project don't need them.
Make sure you have installed all the prerequisties.  You can download
those in rpm's from IBM website.

=== /opt/freeware/src/packages/SOURCES/wxPython-src-2.6.1.0/.configure ===
cd $WXDIR
mkdir bld
cd bld
../configure --prefix=/opt/wx/2.6 --with-gtk --enable-debug --disable-debugreport
=== end ===

With that .configure file, configure command was successful.
=== .configure command ===
/opt/freeware/src/packages/SOURCES/wxPython-src-2.6.1.0> ksh .configure 2>&1 | tee /opt/freeware/src/packages/RPMS/wxPython2.6-2.6.1.0-1/configure_output.txt
=== end ===

<make>
Once .configure command is successful, it will create bld directory.

In the bld directory, you'll find an auto-generated Makefile.  You
need to make the following changes to the Makefile.

=== /opt/freeware/src/packages/SOURCES/wxPython-src-2.6.1.0/bld/Makefile ===
SHARED_LD_CXX = /usr/lpp/xlC/bin/makeC++SharedLib -p 0 -o
-> SHARED_LD_CXX = /usr/vacpp/bin/makeC++SharedLib_r -p 0 -o
SHARED_LD_MODULE_CXX = /usr/lpp/xlC/bin/makeC++SharedLib -p 0 -o
-> SHARED_LD_MODULE_CXX = /usr/vacpp/bin/makeC++SharedLib_r -p 0 -o
EXTRALIBS_GUI = -L/opt/freeware/lib -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangox-1.0 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl -liconv -lpng -lz -ljpeg -ltiff
-> EXTRALIBS_GUI = -L/opt/freeware/lib -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangox-1.0 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl -liconv -lpng -lz -ljpeg -ltiff -lX11
CC = cc
-> CC = xlc_r
=== end ===

Note that xlC_r is the compiler for thread-safe C++ files, xlc_r is
the compiler for thread-safe c files, and makeC++SharedLib_r is the
utility to create thread-safe shared libraries.

You need to change SOCKLEN_T due to AIX 5.3 system incompatibility.
Change SOCKLEN_T to SOCKLENLEN_T to fix that incompatibility.  I used
find command to find all the files with SOCKLEN_T.  I don't think you
need to change all the files below.  My guess is that you don't need
to change the files under mac, msw, and gtk2-unicode-debug-2.6
directories.

==== SOCKLEN_T -> SOCKLENLEN_T under /opt/freeware/src/packages/SOURCES/wxPython-src-2.6.1.0 ===
./include/wx/mac/carbon/config_xcode.h:84:#define SOCKLEN_T socklen_t
./lib/wx/include/gtk2-unicode-debug-2.6/wx/setup.h:689:#define SOCKLEN_T socklen_t
./src/mac/carbon/gsocket.cpp:517:                   (SOCKLEN_T *) &m_local->m_len) != 0) ||
./src/mac/carbon/gsocket.cpp:576:  connection->m_endpoint = accept(m_endpoint, &from, (SOCKLEN_T *) &fromlen);
./src/mac/carbon/gsocket.cpp:682:                   (SOCKLEN_T *) &m_local->m_len) != 0))
./src/mac/carbon/gsocket.cpp:799:        SOCKLEN_T len = sizeof(error);
./src/mac/carbon/gsocket.cpp:1097:  SOCKLEN_T fromlen = sizeof(from);
./src/mac/carbon/gsocket.cpp:1102:  ret = recvfrom(m_endpoint, buffer, size, 0, &from, (SOCKLEN_T *) &fromlen);
./src/msw/gsocket.cpp:87:/* if we use configure for MSW SOCKLEN_T will be already defined */
./src/msw/gsocket.cpp:88:#ifndef SOCKLEN_T
./src/msw/gsocket.cpp:89:#  define SOCKLEN_T int
./src/msw/gsocket.cpp:302:  SOCKLEN_T size = sizeof(addr);
./src/msw/gsocket.cpp:414:                   (SOCKLEN_T *)&m_local->m_len) != 0) ||
./src/msw/gsocket.cpp:441:  SOCKLEN_T fromlen = sizeof(from);
./src/msw/gsocket.cpp:699:                   (SOCKLEN_T *)&m_local->m_len) != 0))
./src/msw/gsocket.cpp:870:        SOCKLEN_T len = sizeof(error);
./src/msw/gsocket.cpp:1117:  SOCKLEN_T fromlen = sizeof(from);
./src/unix/gsocket.cpp:111:#ifndef SOCKLEN_T
./src/unix/gsocket.cpp:114:#  define SOCKLEN_T unsigned int
./src/unix/gsocket.cpp:118:#      define SOCKLEN_T socklen_t
./src/unix/gsocket.cpp:121:#       define SOCKLEN_T socklen_t
./src/unix/gsocket.cpp:123:#    define SOCKLEN_T int
./src/unix/gsocket.cpp:127:#endif /* SOCKLEN_T */
./src/unix/gsocket.cpp:130:#define SOCKOPTLEN_T SOCKLEN_T
./src/unix/gsocket.cpp:399:  SOCKLEN_T size = sizeof(addr);
./src/unix/gsocket.cpp:415:  if (getsockname(m_fd, &addr, (SOCKLEN_T *) &size) < 0)
./src/unix/gsocket.cpp:517:                   (SOCKLEN_T *) &m_local->m_len) != 0) ||
./src/unix/gsocket.cpp:543:  SOCKLEN_T fromlen = sizeof(from);
./src/unix/gsocket.cpp:574:  connection->m_fd = accept(m_fd, &from, (SOCKLEN_T *) &fromlen);
./src/unix/gsocket.cpp:823:                   (SOCKLEN_T *) &m_local->m_len) != 0))
./src/unix/gsocket.cpp:1316:  SOCKLEN_T fromlen = sizeof(from);
./src/unix/gsocket.cpp:1324:    ret = recvfrom(m_fd, buffer, size, 0, &from, (SOCKLEN_T *) &fromlen);
=== end ===

Also add the following line to bld/lib/wx/include/gtk2-ansi-debug-2.6/wx/setup.h.

=== bld/lib/wx/include/gtk2-ansi-debug-2.6/wx/setup.h ===
/* The type of 3rd argument to getsockname() - usually size_t or int */
#define SOCKLENLEN_T socklen_t
=== end ===

I also made same changes to setup.h.in and configure.in.
=== /opt/freeware/src/packages/SOURCES/wxPython-src-2.6.1.0/setup.h.in ===
/* The type of 3rd argument to getsockname() - usually size_t or int */
#define SOCKLENLEN_T socklen_t
=== end ===

=== /opt/freeware/src/packages/SOURCES/wxPython-src-2.6.1.0/configure.in ===
AC_DEFINE_UNQUOTED(SOCKLENLEN_T, $wx_cv_type_getsockname3)
=== end ===

You need to make changes to setup.h since configure didn't generate
setup.h correctly for some reason.  Without these options setup
correctly, you'll see many linker error messages when you run "python
setup.py" command to create wxPython shared libraries.

=== bld/lib/wx/include/gtk2-ansi-debug-2.6/wx/setup.h ===
#define wxUSE_SOCKETS       0 
-> #define wxUSE_SOCKETS       1
#define wxUSE_FS_INET       0 
-> #define wxUSE_FS_INET       1
#define wxUSE_PROTOCOL 0 
-> #define wxUSE_PROTOCOL 1
#define wxUSE_PROTOCOL_FILE 0 
-> #define wxUSE_PROTOCOL_FILE 1
#define wxUSE_PROTOCOL_FTP 0 
-> #define wxUSE_PROTOCOL_FTP 1
#define wxUSE_PROTOCOL_HTTP 0 
-> #define wxUSE_PROTOCOL_HTTP 1
#define wxUSE_URL 0 
-> #define wxUSE_URL 1
=== end ===

Make sure that you run "make clean" if you change any options to clear
old object files.

=== make command ===
/opt/freeware/src/packages/SOURCES/wxPython-src-2.6.1.0/bld> make 2>&1 | tee /opt/freeware/src/packages/RPMS/wxPython2.6-2.6.1.0-1/make_output.txt
=== end ===

To start everything fresh, run unix command "rm -fr /opt/wx" and "rm
-fr /opt/freeware/src/packages/SOURCES/wxPython-src-2.6.1.0/bld".
Those are the only two directories created by .configure command and
"make install" command.

<make install>

=== make install command ===
/opt/freeware/src/packages/SOURCES/wxPython-src-2.6.1.0/bld> make install 2>&1 | tee /opt/freeware/src/packages/RPMS/wxPython2.6-2.6.1.0-1/make_install_output.txt
=== end ===


<<<wxPython>>>
<wxPython>
You need to make changes to source files due to some macros ended with
a semicolon.  AIX compiler generates error messages if a macro ends
with two semicolons.  Thanks to Mr. Robin Dunn for pointing that out!
Note that ld_so_aix and makexp_aix under
/usr/local/lib/python2.4/config and
/usr/local/lib/python2.4/distutils/*.py are outdated so I had come up
with a manual way to make the build.
 
=== /opt/freeware/src/packages/SOURCES/wxPython-src-2.6.1.0/wxPython/src/gtk/_windows_wrap.cpp ===
line 1748: DECLARE_ABSTRACT_CLASS(wxPyVScrolledWindow);
-> DECLARE_ABSTRACT_CLASS(wxPyVScrolledWindow)
line 1868: DECLARE_ABSTRACT_CLASS(wxPyVListBox);
-> DECLARE_ABSTRACT_CLASS(wxPyVListBox)
line 1951: DECLARE_ABSTRACT_CLASS(wxPyHtmlListBox);
-> DECLARE_ABSTRACT_CLASS(wxPyHtmlListBox)
line 2039: DECLARE_ABSTRACT_CLASS(wxPyTaskBarIcon);
-> DECLARE_ABSTRACT_CLASS(wxPyTaskBarIcon)
line 2527: DECLARE_CLASS(wxPyPreviewFrame);
-> DECLARE_CLASS(wxPyPreviewFrame)
line 2557: DECLARE_CLASS(wxPyPreviewControlBar);
-> DECLARE_CLASS(wxPyPreviewControlBar)

line 1886: DEC_PYCALLBACK__DCRECTSIZET_constpure(OnDrawItem);
-> DEC_PYCALLBACK__DCRECTSIZET_constpure(OnDrawItem)
line 1901: DEC_PYCALLBACK__DCRECTSIZET_constpure(OnDrawSeparator);
-> DEC_PYCALLBACK__DCRECTSIZET_constpure(OnDrawSeparator)
=== end ===

=== /opt/freeware/src/packages/SOURCES/wxPython-src-2.6.1.0/wxPython/include/wx/wxPython/printfw.h ===
line 38: DECLARE_ABSTRACT_CLASS(wxPyPrintout);
-> DECLARE_ABSTRACT_CLASS(wxPyPrintout)
=== end ===

=== /opt/freeware/src/packages/SOURCES/wxPython-src-2.6.1.0/wxPython/src/msw/_controls_wrap.cpp ===
line 1854: DECLARE_ABSTRACT_CLASS(wxPyListCtrl);
-> DECLARE_ABSTRACT_CLASS(wxPyListCtrl)
line 1946: DECLARE_ABSTRACT_CLASS(wxPyTreeCtrl);
-> DECLARE_ABSTRACT_CLASS(wxPyTreeCtrl)
line 1878: DEC_PYCALLBACK_INT_LONG_virtual(OnGetItemImage);
-> DEC_PYCALLBACK_INT_LONG_virtual(OnGetItemImage)
=== end ===

=== /opt/freeware/src/packages/SOURCES/wxPython-src-2.6.1.0/wxPython/src/gtk/_misc_wrap.cpp ===
line 2778: DEC_PYCALLBACK_STRING__const(GetText);
-> DEC_PYCALLBACK_STRING__const(GetText)
=== end ===

=== /opt/freeware/src/packages/SOURCES/wxPython-src-2.6.1.0/wxPython/src/gtk/grid_wrap.cpp ===
line 2253: DEC_PYCALLBACK_STRING__constpure(GetValue);
-> DEC_PYCALLBACK_STRING__constpure(GetValue)
=== end ===

==== /opt/freeware/src/packages/SOURCES/wxPython-src-2.6.1.0/wxPython/src/gtk/html_wrap.cpp ===
line 1536: DECLARE_DYNAMIC_CLASS(wxPyHtmlTagHandler);
-> DECLARE_DYNAMIC_CLASS(wxPyHtmlTagHandler)
line 1556: DECLARE_DYNAMIC_CLASS(wxPyHtmlWinTagHandler);
-> DECLARE_DYNAMIC_CLASS(wxPyHtmlWinTagHandler)
line 1823: DECLARE_ABSTRACT_CLASS(wxPyHtmlFilter);
-> DECLARE_ABSTRACT_CLASS(wxPyHtmlFilter)
line 1869: DECLARE_ABSTRACT_CLASS(wxPyHtmlWindow);
-> DECLARE_ABSTRACT_CLASS(wxPyHtmlWindow)
=== end ===

=== /opt/freeware/src/packages/SOURCES/wxPython-src-2.6.1.0/wxPython/src/gtk/wizard_wrap.cpp ===
line 1541: DECLARE_ABSTRACT_CLASS(wxPyWizardPage);
-> DECLARE_ABSTRACT_CLASS(wxPyWizardPage)
=== end ===

Make changes to ld_so_aix and makexp_aix under
/usr/local/lib/python2.4/config to log link commands.  We'll run
"python setup.py" command and log the output which we'll modify to set
the compile and link commands correctly.  The "python setup.py"
command uses /usr/local/lib/python2.4/distutils/*.py to create the
python shared library, but the current distutils package doesn't
support AIX 5.3.  Also, I think it is too much work to change the
distutils scripts to get the correct commands.  So we'll use the log
output as our basis and change the commands correctly for AIX 5.3.
Make sure that you remove *.o files whenever you change "python
setup.py" command options.  I do find command under
/opt/freeware/src/packages/SOURCES/wxPython-src-2.6.1.0/wxPython/build-gtk2
to remove old *.o files.  You need to remove old *.o files to log
compile commands.

==== ld_so_aix ===
CCARGS="$args"
-> CCARGS="$args -lgobject-2.0 -lgdk-x11-2.0"
#echo $CC $CCOPT $CCARGS
-> echo $CC $CCOPT $CCARGS
=== end ===

Do not use nm command to create export files for AIX 5.3.
Comment lines with nm command or remove those lines.
Use CreateExportList command instead.
You need to copy *.exp files to *.exp__copy files since "rm
$expTmpFileName" removes *.exp files.  For some reason, if you comment
out "rm $expTmpFileName", it will stop after 1st run.  Note that *.exp
files will have all the symbols since I didn't do any post processing.
My guess is you only need to export init_* function, but I'm not clear
on this.

=== makexp_aix ===
expFileName=$1
expTmpFileName=${expFileName}__Tmp
toAppendStr=$2
shift; shift;
inputFiles=$*
automsg="Generated automatically by makexp_aix"
notemsg="NOTE: lists _all_ global symbols defined in the above file(s)."
curwdir=`pwd`

echo "#!"$toAppendStr > $expFileName
echo "*" >> $expFileName
echo "* $automsg  (`date -u`)" >> $expFileName
echo "*" >> $expFileName
echo "* Base Directory: $curwdir" >> $expFileName
echo "* Input File(s) : $inputFiles" >> $expFileName
echo "*" >> $expFileName
echo "* $notemsg" >> $expFileName
echo "*" >> $expFileName

echo "/usr/vac/bin/CreateExportList $expTmpFileName $inputFiles"
/usr/vac/bin/CreateExportList $expTmpFileName $inputFiles

cat $expTmpFileName >> $expFileName

cp $expFileName ${expFileName}__copy

rm $expTmpFileName
== =end ===

Make changes to config.py and build_options.py since some flags are
not set up correctly.  MONOLITHIC = 0, FINAL = 0, HYBRID = 0 means
we'll build wxPython mulitple shared libraries with -g debug enabled
and __WXDEBUG__ assertion debug enabled.

=== /opt/freeware/src/packages/SOURCES/wxPython-src-2.6.1.0/wxPython/config.py ===
MONOLITHIC = 0
FINAL = 0
HYBRID = 0
=== end ===

=== /opt/freeware/src/packages/SOURCES/wxPython-src-2.6.1.0/wxPython/build_options.py ===
MONOLITHIC = 0
FINAL = 0
HYBRID = 0
=== end ===

Now run the "python setup.py" command to create a log file.
There are command-line options to disable extension modules not used.
/opt/freeware/src/packages/SOURCES/wxPython-src-2.6.1.0/wxPython> python setup.py build_ext BUILD_GLCANVAS=0 BUILD_STC=0 BUILD_GIZMOS=0 BUILD_ANIMATE=0 --inplace --debug 2>&1 | tee /opt/freeware/src/packages/RPMS/wxPython2.6-2.6.1.0-1/python_setup_output.txt
=== python_setup_output.txt e.g. ===
e.g. _core_wrap.o 
xlC_r -DNDEBUG -O -g -DSWIG_TYPE_TABLE=_wxPython_table -DHAVE_CONFIG_H -DWXP_USE_THREAD=1 -UNDEBUG -D__WXDEBUG__ -D__WXGTK__ -D_LARGE_FILES -Iinclude -Isrc -I/opt/wx/2.6/lib/wx/include/gtk2-ansi-debug-2.6 -I/opt/wx/2.6/include/wx-2.6 -I/opt/freeware/include/gtk-2.0 -I/opt/freeware/lib/gtk-2.0/include -I/opt/freeware/include/atk-1.0 -I/opt/freeware/include/pango-1.0 -I/opt/freeware/include/glib-2.0 -I/opt/freeware/lib/glib-2.0/include -I/usr/local/include/python2.4 -c src/gtk/_core_wrap.cpp -o build-gtk2/temp.aix-5.3-2.4/src/gtk/_core_wrap.o -g -O0

e.g. _core_.so
xlC_r -Wl,-einit_core_ -Wl,-bE:_core_.exp -Wl,-bI:/usr/local/lib/python2.4/config/python.exp -Wl,-bhalt:4 -Wl,-bM:SRE -lm -o wx/_core_.so  -g build-gtk2/temp.aix-5.3-2.4/src/helpers.o build-gtk2/temp.aix-5.3-2.4/src/gtk/_core_wrap.o -L/usr/X11R6/lib -L/opt/wx/2.6/lib -L/usr/lib/threads -lwx_gtk2d_xrc-2.6 -lwx_gtk2d_html-2.6 -lwx_gtk2d_adv-2.6 -lwx_gtk2d_core-2.6 -lwx_based_xml-2.6 -lwx_based_net-2.6 -lwx_based-2.6 -lgobject-2.0 -lgdk-x11-2.0
=== end ===

From that log file, I created python_setup_commands.sh file manually.
=== /opt/freeware/src/packages/SOURCES/wxPython-src-2.6.1.0/wxPython/python_setup_commands.sh ===
#!/usr/bin/sh

e.g. _core_wrap.o
xlC_r -g -DSWIG_TYPE_TABLE=_wxPython_table -DHAVE_CONFIG_H -DWXP_USE_THREAD=1 -D__WXDEBUG__ -D__WXGTK__ -D_LARGE_FILES -Iinclude -Isrc -I/opt/wx/2.6/lib/wx/include/gtk2-ansi-debug-2.6 -I/opt/wx/2.6/include/wx-2.6 -I/opt/freeware/include/gtk-2.0 -I/opt/freeware/lib/gtk-2.0/include -I/opt/freeware/include/atk-1.0 -I/opt/freeware/include/pango-1.0 -I/opt/freeware/include/glib-2.0 -I/opt/freeware/lib/glib-2.0/include -I/usr/local/include/python2.4 -c src/gtk/_core_wrap.cpp -o build-gtk2/temp.aix-5.3-2.4/src/gtk/_core_wrap.o

e.g. _core_.so
/usr/vacpp/bin/makeC++SharedLib_r -o wx/_core_.so -L/usr/X11R6/lib -L/opt/wx/2.6/lib -L/usr/lib/threads -lwx_gtk2d_xrc-2.6 -lwx_gtk2d_html-2.6 -lwx_gtk2d_adv-2.6 -lwx_gtk2d_core-2.6 -lwx_based_xml-2.6 -lwx_based_net-2.6 -lwx_based-2.6 -lgobject-2.0 -lgdk-x11-2.0 -p 0 -I /usr/local/lib/python2.4/config/python.exp -E _core_.exp -n init_core_ build-gtk2/temp.aix-5.3-2.4/src/helpers.o build-gtk2/temp.aix-5.3-2.4/src/gtk/_core_wrap.o
=== end ===

Set the environment variables.
Note that you need to export them.
=== .kshrc ===
export PATH="$PATH:/users/zc5639/min/tools:/opt/wx/2.6/bin"
export LD_LIBRARY_PATH="/opt/wx/2.6/lib"
export LIBPATH="opt/wx/2.6/lib"
export WXDIR="/opt/freeware/src/packages/SOURCES/wxPython-src-2.6.1.0"
export PYTHONPATH="$WXDIR/wxPython"
=== end ===

Once you run python_setup_commands.sh file successfully, you should be
able to use wxPython.  To test it, run "python demo.py" under
/opt/freeware/src/packages/SOURCES/wxPython-src-2.6.1.0/wxPython/demo.

Enjoy wxPython on AIX 5.3!!!


Min Kim

BuildingOnAIX (last edited 2008-03-11 10:50:28 by localhost)

NOTE: To edit pages in this wiki you must be a member of the TrustedEditorsGroup.