Can't build 2.8.11.0 on Mac

I’m trying to install "Winpdb"http://winpdb.org/ on Mac OS X 10.6.5, which requires wxPython.

We’re using "virtualenv"http://virtualenv.openplans.org/ on top of Python 2.6. The Python 2.6 binary was built with the "Homebrew"https://github.com/cozi/homebrew package manager. This combination gives a consistent environment on different Macs.

I tried copying wxredirect.pth into my virtualenv’s site-packages. However, import winpdb fails with:

...

ImportError: dlopen(/usr/local/lib/wxPython-unicode-2.8.11.0/lib/python2.6/site-packages/wx-2.8-mac-unicode/wx/_core_.so, 2): no suitable image found.  Did find:

	/usr/local/lib/wxPython-unicode-2.8.11.0/lib/python2.6/site-packages/wx-2.8-mac-unicode/wx/_core_.so: no matching architecture in universal wrapper

Presumably because this is a home-built Python, not the system one.

It looks like I have to build wxPython myself, and I’ve adapted the instructions at http://codersbuffet.blogspot.com/2009/09/wxpython-in-virtualenv.html

However, I get this error building wxPython with Xcode 3.2.5:

./src/common/intl.cpp:2060: error: ‘smScriptLang’ was not declared in this scope

Here’s how I got to that point

Install Brew:

$ sudo chown -R $USER /usr/local

$ curl -Lsf http://github.com/cozi/homebrew/tarball/master | tar xz --strip 1 -C/usr/local

Use Brew to install Python 2.6 and "Pip"http://pip.openplans.org/:

$ brew install python pip

Install virtualenv with pip:

$ pip install virtualenv

Create a virtualenv called kitspython:

$ virtualenv --no-site-packages ~/kitspython

Activate the virtualenv:

$ source ~/kitspython/bin/activate

Start building wxPython:

$ tar -jxvf ~/Downloads/wxPython-src-*.tar.bz2

$ cd wxPython-src-*

$ ./configure --prefix=$(cd ~/kitspython/; pwd) --enable-unicode

Configured wxWidgets 2.8.11 for `i686-apple-darwin10.5.0'

  Which GUI toolkit should wxWidgets use?                 mac

  Should wxWidgets be compiled into single library?       no

  Should wxWidgets be compiled in debug mode?             no

  Should wxWidgets be linked as a shared library?         yes

  Should wxWidgets be compiled in Unicode mode?           yes

  What level of wxWidgets compatibility should be enabled?

									   wxWidgets 2.4      no

									   wxWidgets 2.6      yes

  Which libraries should wxWidgets use?

									   jpeg               builtin

									   png                builtin

									   regex              builtin

									   tiff               builtin

									   zlib               sys

									   odbc               no

									   expat              sys

									   libmspack          no

									   sdl                no

$ make install

/Users/georger/wxPython-src-2.8.11.0/bk-deps g++ -c -o basedll_intl.o -I./.pch/wxprec_basedll -D__WXMAC__     -DWXBUILDING -I./src/tiff -I./src/jpeg -I./src/png   -I./src/regex  -DwxUSE_GUI=0 -DWXMAKINGDLL_BASE -DwxUSE_BASE=1 -dynamic -fPIC -DPIC -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -I/Users/georger/wxPython-src-2.8.11.0/lib/wx/include/mac-unicode-release-2.8 -I./include -fpascal-strings -I./src/mac/carbon/morefilex -I/Developer/Headers/FlatCarbon -DWX_PRECOMP -Wall -Wundef -Wno-ctor-dtor-privacy -O2 -fno-strict-aliasing -fno-common ./src/common/intl.cpp

./src/common/intl.cpp: In static member function ‘static int wxLocale::GetSystemLanguage()’:

./src/common/intl.cpp:2060: error: ‘smScriptLang’ was not declared in this scope

./src/common/intl.cpp:2060: error: ‘GetScriptVariable’ was not declared in this scope

./src/common/intl.cpp:2061: warning: ‘GetScriptManagerVariable’ is deprecated (declared at /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Script.h:993)

./src/common/intl.cpp:2061: warning: ‘GetScriptManagerVariable’ is deprecated (declared at /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Script.h:993)

make: *** [basedll_intl.o] Error 1

This is a second-order problem, of course. All I really care about is running Winpdb inside the virtualenv.

Thanks in advance

/George

I'm trying to install "Winpdb"<http://winpdb.org/&gt; on Mac OS X 10.6.5,
which requires wxPython.

We're using "virtualenv"<http://virtualenv.openplans.org/&gt; on top of
Python 2.6. The Python 2.6 binary was built with the
"Homebrew"<https://github.com/cozi/homebrew&gt; package manager. This
combination gives a consistent environment on different Macs.

I tried copying wxredirect.pth into my virtualenv's site-packages.
However, `import winpdb` fails with:
...
ImportError:
dlopen(/usr/local/lib/wxPython-unicode-2.8.11.0/lib/python2.6/site-packages/wx-2.8-mac-unicode/wx/_core_.so,
2): no suitable image found. Did find:
/usr/local/lib/wxPython-unicode-2.8.11.0/lib/python2.6/site-packages/wx-2.8-mac-unicode/wx/_core_.so:
no matching architecture in universal wrapper

Presumably because this is a home-built Python, not the system one.

No, it is because Python is with running the 64-bit version in the universal binary, but wxPython is limited to 32-bit because it is using the Carbon APIs. You can either force Python to run with the 32-bit architecture, or you can move closer to the cutting edge and use a cocoa build of wxPython 2.9

It looks like I have to build wxPython myself, and I've adapted the
instructions at
http://codersbuffet.blogspot.com/2009/09/wxpython-in-virtualenv.html

However, I get this error building wxPython with Xcode 3.2.5:
./src/common/intl.cpp:2060: error: �smScriptLang� was not declared in
this scope

Here's how I got to that point

Install Brew:

$ sudo chown -R $USER /usr/local
$ curl -Lsf http://github.com/cozi/homebrew/tarball/master | tar xz
--strip 1 -C/usr/local

Use Brew to install Python 2.6 and "Pip"<http://pip.openplans.org/&gt;:

$ brew install python pip

Install virtualenv with pip:

$ pip install virtualenv

Create a virtualenv called kitspython:

$ virtualenv --no-site-packages ~/kitspython

Activate the virtualenv:

$ source ~/kitspython/bin/activate

Start building wxPython:

$ tar -jxvf ~/Downloads/wxPython-src-*.tar.bz2
$ cd wxPython-src-*
$ ./configure --prefix=$(cd ~/kitspython/; pwd) --enable-unicode

There are other configure options that should also be used. See http://wxpython.org/BUILD-2.8.html. Also you should be running configure and the build from an empty folder, not the root of the source tree. This keeps the build artifacts from comingling with the source files and avoids a few potential problems.

Configured wxWidgets 2.8.11 for `i686-apple-darwin10.5.0'

Which GUI toolkit should wxWidgets use? mac
Should wxWidgets be compiled into single library? no
Should wxWidgets be compiled in debug mode? no
Should wxWidgets be linked as a shared library? yes
Should wxWidgets be compiled in Unicode mode? yes
What level of wxWidgets compatibility should be enabled?
wxWidgets 2.4 no
wxWidgets 2.6 yes
Which libraries should wxWidgets use?
jpeg builtin
png builtin
regex builtin
tiff builtin
zlib sys
odbc no
expat sys
libmspack no
sdl no

$ make install
...
/Users/georger/wxPython-src-2.8.11.0/bk-deps g++ -c -o basedll_intl.o
-I./.pch/wxprec_basedll -D__WXMAC__ -DWXBUILDING -I./src/tiff
-I./src/jpeg -I./src/png -I./src/regex -DwxUSE_GUI=0 -DWXMAKINGDLL_BASE
-DwxUSE_BASE=1 -dynamic -fPIC -DPIC -D_FILE_OFFSET_BITS=64
-D_LARGE_FILES
-I/Users/georger/wxPython-src-2.8.11.0/lib/wx/include/mac-unicode-release-2.8
-I./include -fpascal-strings -I./src/mac/carbon/morefilex
-I/Developer/Headers/FlatCarbon -DWX_PRECOMP -Wall -Wundef
-Wno-ctor-dtor-privacy -O2 -fno-strict-aliasing -fno-common
./src/common/intl.cpp
./src/common/intl.cpp: In static member function �static int
wxLocale::GetSystemLanguage()�:
./src/common/intl.cpp:2060: error: �smScriptLang� was not declared in
this scope
./src/common/intl.cpp:2060: error: �GetScriptVariable� was not declared
in this scope

5 seconds with Google would have given you the answer to this one. Since you're building with the Carbon library you'll need to force the build to build for just 32-bit. An easy way to do this is to use gcc-4.0, not the default 4.2.

http://wiki.wxwidgets.org/Development:_wxMac#Building_on_Snow_Leopard_for_Snow_Leopard

./src/common/intl.cpp:2061: warning: �GetScriptManagerVariable� is
deprecated (declared at
/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Script.h:993)
./src/common/intl.cpp:2061: warning: �GetScriptManagerVariable� is
deprecated (declared at
/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Script.h:993)
make: *** [basedll_intl.o] Error 1

This is a second-order problem, of course. All I really care about is
running Winpdb inside the virtualenv.

If you use arch to force the use of the 32-bit version of Python then I expect that the stock wxPython will work fine for you.

···

On 1/18/11 5:38 PM, George V. Reilly wrote:

--
Robin Dunn
Software Craftsman