Recent Changes - Search:

PmWiki

pmwiki.org

edit SideBar

MacOSX

  • Unpacked everything, hooked it up according to the instructions.
  • Turned it on.
  • Picked English.
  • Watched the "Welcome" video.
  • Picked a US keyboard.
  • Picked "United States".
  • Picked US keyboard layout.
  • Picked LAN for Internet connection method.
  • Left Apple ID blank.
  • Apple-Q past the registration.
  • User name "david", random password.
  • Selected Denver time.
  • Date and time already correct.
  • Skipped the "Don't forget to register" screen.
  • Turned on screen sharing.
  • Did OS detection. Already there.
  • Wow, it comes with Subversion already installed. Checked out nmap.
  • Figured out screen sharing: http://lifehacker.com/software/how-to/remote-control-leopard-with-tightvnc-319528.php. It works with TightVNC. Password "vnc".
  • Ran software update. Wow, big update, I'll do it later.
  • Installed Xcode Tools from XcodeTools.mpkg off the installation disc.
  • Built Nmap. Command-line works fine. Trying to run Zenmap (python zenmap) gives
    Error in sys.excepthook:
    Traceback (most recent call last):
      File "zenmap", line 58, in excepthook
        import gtk
    ImportError: No module named gtk
    
    Original exception was:
    Traceback (most recent call last):
      File "zenmap", line 149, in <module>
        app.run()
      File "/Users/david/nmap/zenmap/zenmapGUI/App.py", line 96, in run
        self.__run_gui()
      File "/Users/david/nmap/zenmap/zenmapGUI/App.py", line 100, in __run_gui
        import gtk
    ImportError: No module named gtk
    
  • Building a .app with python setup.py py2app works, but trying to run the resulting file gives this dialog:
  • Tried downloading MacPorts 1.6.0, even though I suspect its GTK packages may require the Apple X11 server to be installed, which I consider suboptimal.
  • The installer didn't make the .profile modifications it was supposed to, so I made the changes suggested at http://guide.macports.org/#installing.shell.
  • sudo port install py25-gtk
    That installed a ton of packages: atk, cairo, docbook-xml-4.1.2, docbook-xsl, expat, fftw-3, fontconfig, freetype, g95, getopt, gettext, glib2, gnome-common, gtk-doc, gtk2, intltool, jpeg, libglade2, libiconv, libpng, libxml2, libxslt, ncurses, ncursesw, openssl, p5-xml-parser, pango, perl5.8, pkgconfig, py25-cairo, py25-gobject, py25-gtk, py25-hashlib, py25-numpy, python25, rarian, render, shared-mime-info, tiff, Xft2, xmlcatmgr, xorg-util-macros, xorg-xproto, xrender, zlib.
  • Now ./zenmap doesn't work, but /opt/local/bin/python2.5 zenmap starts up X11 and shows a dialog saying sqlite3 isn't found.
  • sudo port install py25-sqlite3
  • Now /opt/local/bin/python2.5 zenmap gives this crash:

    I don't feel like tracking that down as it seems to be a MacPorts problem. Instead I'll try building a native GTK+. Also MacPorts doesn't have a py2app for Python 2.5.
  • for a in `port installed | grep '^ ' | sed -e 's/@.*//'`; do port deactivate $a; done to turn off MacPorts so it won't interfere.
  • See instructions at http://developer.imendio.com/projects/gtk-macosx/build-instructions.
  • jhbuild bootstrap
  • sudo jhbuild build
  • It hung up on libjpeg because ijg.org wasn't resolvable. I downloaded the source tarball from a mirror, put it in $HOME/Source/pkgs, and chose the "force_checkout" option.
  • It worked, and I can run gtk-demo.
  • Downloaded pygobject-2.14.1.tar.bz2 and pygtk-2.12.1.tar.bz2.
  • ./configure in pygobject, had to add /opt/gtk/bin to PATH for pkg-config. sudo make install.
  • PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure in pygtk.
  • pygtk chokes on a dependency on pycairo, even though it's supposed to be able to build without it, so download pycairo-1.4.12.tar.gz.
  • ./configure, make, make install in pycairo.
  • PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure CFLAGS=-I/opt/gtk/include LDFLAGS=-L/opt/gtk/lib
  • This put everything in /usr/local/bin, /usr/local/include, etc., except for Python packages in /Library/Python/2.5/site-packages.
  • Crap, hit the _PyGBoxed_Type problem reported earlier.
  • Tried installing pygobject with distutils on a recommendation from this page.
  • Okay, now importing gobject works. Now importing gtk gives a different missing symbol. Try building PyGTK with distutils: CFLAGS=-I/usr/local/include/pygtk-2.0 python setup.py build.
  • Now do it with pycairo.
  • This put Python modules in /Library/Python/2.5/site-packages, a postinstall script in /usr/local/bin, and data files in /System/Library/Frameworks/Python.framework/\
    Versions/2.5/{include,share}
    . Also silently put pkg-config files in /System/Library/Frameworks/Python.framework/Versions/2.5/lib/pkgconfig.
  • Success!

    It runs all right. The screen won't minimize, I think because of a problem in the GTK+ port. The menu bar at the top of the screen just says "Python". You get a little rocketship icon in the dock.
  • I kind of got a .app package built. It runs and gives you the "you're not root" dialog, but then the main window doesn't repaint itself and stops responding. (You need to "force quit.")
  • Ran a software update to 10.5.2 and rebooted.
  • As root,
    rm -r /usr/local/{bin,include,lib,liibexec,share}
    rm -r /Library/Python/2.5/site-packages/*
    rm -r /System/Library/Frameworks/Python.framework/\
    Versions/2.5/{include/*,lib/pkgconfig,share/*}
  • See if there are any other new files with sudo find / -newerBB /opt/local | tee find-new.log.
  • I should probably use Time Machine to back things up while I'm experimenting but it seems to require an external disk or partition.
  • sudo port uninstall py25-sqlite3 sqlite3
  • for a in `port installed | grep '^ ' | sed -e 's/@.*//'`; do port activate $a; done
  • export PYTHONPATH=/opt/local/lib/python2.5/site-packages:\
    /opt/local/lib/python2.5/site-packages/gtk-2.0
  • ./configure --prefix=/usr/local, make, make install in nmap.
  • Crap, I shouldn't have deleted /System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5. Copy it from the MacPorts version. Later I replaced it with the files from the MacPython 2.5.1 distribution.
  • PATH=/usr/local/bin:$PATH
  • PYTHONPATH=/usr/local/lib/python2.5/site-packages:$PYTHONPATH
  • zenmap
  • Success!
  • Made a change to how Zenmap overrides the module search path at install time.
  • This uses a mixture of Mac OS X Python libraries and MacPorts libraries. I read from this page that the problem may be with the packaging of sqlite3. So try something new:
  • sudo port install py25-sqlite3 which brings in sqlite3 as a dependency.
  • sudo port uninstall -f sqlite3 which uninstalls sqlite3 without uninstalling py25-sqlite3.
  • ./configure, make PYTHON=/opt/local/bin/python2.5, sudo make install.
  • /usr/local/bin/zenmap works. With sudo too. And nothing weird in the environment.
  • That works pretty good for MacPorts. Let's try Fink.

Fink

  • Downloaded fink-0.28.1.tar.gz
  • ./bootstrap
  • Enable unstable distribution.
  • . /sw/bin/init.sh
  • fink selfupdate; choose "rsync".
  • fink -b install nmap
  • /sw/bin/zenmap

Another stab a making a .app bundle

  • Looked at Advene, who have all kinds of wicked hacks to make a PyGTK bundle work.
  • Got a "Hello, world" app built. Only 18 MB! (Uncompressed.)

Making it work for Zenmap

  • sudo port install py25-zlib (for compressed executable).

Trying to build universal libraries

  • Uninstalled all the packages.
  • You should be able to do sudo install py25-gtk +universal, but that fails due to this bug.
  • The python25 package doesn't build with the universal variant: issue #14923. So I had to patch it to remove $(LDFLAGS) from the /usr/bin/libtool line.
  • I had to modify the portfiles for py25-hashlib, py25-libxml2, py25-numeric, py25-numpy, py25-sqlite3, and py25-zlib to add universal_variant no.
  • sudo port install py25-gtk +universal
  • sudo port install py25-sqlite3 +universal
  • sudo port install py25-zlib +universal
  • Now make the bundle. For some reason it works this time without uninstalling sqlite3.
  • The universal app is 45.9 MB, compared to about 24 MB for the Intel-only app.

Making it reproducible

  • Download source MacPorts-1.6.0.tar.bz2.
  • Build source for multiple installation as described here, using the prefix /opt/local-universal.
  • export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11/bin (the "/usr/X11/bin" is because of this bug.
  • sudo mkdir /Library/Tcl/macports-universal
  • ./configure --prefix=/opt/local-universal --with-tclpackage=/Library/Tcl/macports-universal
  • make
  • sudo make install
  • sudo vi /opt/local-universal/etc/macports/variants.conf; add +universal.
  • sudo /opt/local-universal/bin/port selfupdate
  • mkdir -p ~/macports-sources/ports/python
  • cp -R /opt/local-universal/var/macports/sources/\
    rsync.macports.org/release/ports/python/\
    {py25-hashlib,py25-libxml2,py25-numeric,py25-numpy,py25-sqlite3,py25-zlib} \
    ~/macports-sources/ports/python/
  • mkdir -p ~/macports-sources/ports/lang
  • cp -R /opt/local-universal/var/macports/sources/\
    rsync.macports.org/release/ports/lang/python25 ~/macports-sources/ports/lang/
  • Apply necessary changes to the tree.
  • ln -s /opt/local-universal/var/macports/sources/rsync.macports.org/release/ports ~/macports-sources/ports.orig
  • cd ~/macports-sources
  • diff -ru -x PortIndex ports.orig ports | grep -v '^Only in' > macports-1.6.0-universal.diff
  • sudo vi /opt/local-universal/etc/macports/sources.conf; add file:///Users/david/macports-sources/ports/ above the rsync line.
  • cd ~/macports-sources/ports/
  • sudo /opt/local-universal/bin/portindex
  • sudo /opt/local-universal/bin/port install py25-gtk py25-sqlite3 py25-zlib

Screenshot

Full-screen screenshot

Making universal work for 10.4

I have a feeling some of the crashes are because my libraries are compiled to be universal on 10.5 only. You have to give arguments like the location of the SDK and -mmacosx-version-min to make it work on 10.4 also. MacPorts has configuration variables to control these (universal_target, universal_sysroot, universal_archs), but they aren't in the 1.6.0 version. I checked out revision 36289 from Subversion.

  • svn co http://svn.macports.org/repository/macports/trunk/base MacPorts-svn
  • cd MacPorts-svn
  • export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11/bin
  • sudo mkdir /Library/Tcl/macports-universal-10.4
  • ./configure --prefix=/opt/local-universal-10.4 --with-tclpackage=/Library/Tcl/macports-universal-10.4 --with-universal-target=10.4 --with-universal-sysroot=/Developer/SDKs/MacOSX10.4u.sdk
  • make
  • sudo make install
  • sudo vi /opt/local-universal-10.4/etc/macports/variants.conf; add +universal.
  • sudo /opt/local-universal-10.4/bin/port sync ("sync", not "selfupdate", or you will get downgraded to 1.6.0!)
  • sudo vi /opt/local-universal-10.4/etc/macports/sources.conf; add file:///Users/david/macports-sources/ports/ above the rsync line.
  • sudo /opt/local-universal-10.4/bin/port install py25-gtk py25-sqlite3 py25-zlib
  • It chokes on gtk2, because it's looking for some CUPS defines that aren't in the 10.4 SDK. I submitted ticket #15132.
  • Make the necessary changes to the gtk2 portfile.
  • sudo /opt/local-universal/bin/portindex
  • sudo /opt/local-universal-10.4/bin/port install py25-gtk py25-sqlite3 py25-zlib

glib fixes

It turns out glib2 needs a patch that I copied from Inkscape. I applied the patch and rebuilt the port index. I had trouble removing just the packages that depend on glib2, so I wiped out my whole installation and reinstalled.

  • sudo rm -rf /opt/local-universal-10.4
  • cd ~/MacPorts-svn
  • sudo make install
  • Edit sources.conf.
  • Edit variants.conf.
  • sudo /opt/local-universal-10.4/bin/port sync
  • PATH=/opt/local-universal-10.4/bin:/opt/local-universal-10.4/sbin:\
    /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
  • sudo /opt/local-universal-10.4/bin/port -v install py25-gtk py25-sqlite3 py25-zlib

How to force a terminal program to run translated under Rosetta

From the Universal Binary Programming Guidelines:
ditto -arch ppc program program-ppc
./program-ppc

Upstream MacPorts tickets submitted

  • #15132: cups-config.
  • #15568: py25-macholib-devel.
  • #15569: Use --x-includes and --x-libraries.
  • #15570: Use universal arguments.

.dmg files are disk images, basically a compressed bundle that gets mounted as a disk. This is a container around a package. It's the preferred container format. Here's a command line for building a .dmg from an .app directory.

.pkg files are installers run by the Installer application. This is known as a "managed install."

.app files are single-component packages, really just a directory recursively copied to the filesystem. This is known as "manual install." It's the preferred way to deliver applications. This is also known as a "bundle," a directory with a specific hierarchical structure.

Edit - History - Print - Recent Changes - Search
Page last modified on June 09, 2008, at 11:39 AM