GRC running on Mac OS X 10.6.4 using GTK+ Quartz 32bit Carbon backend

Hi,
After much effort, I’ve managed to get a good portion of GNU
Radio running on Mac OS X 10.6.4, using its native Carbon interface, and
bypassing the X11 windows.

This was done from scratch manually, from the source files, and I’ve
documented it. It was necessary to do this, to explore various options,
like the 64-bit Cocoa parts, which still need some work. I learnt quite
a bit of the limitations and interdependencies, doing this.

Here is a screenshot of grc running with GTK+ using the quartz backend.

Nice work!
Since the menubar is still in the application window, I’m wondering if
it uses http://gtk-osx.sourceforge.net/ ?

Alex

Hi Alex,

On Sep 21, 2010, at 3:26 AM, Alexandru C. wrote:

Since the menubar is still in the application window, I’m wondering if
it uses http://gtk-osx.sourceforge.net/ ?

Yes, I used GTK+ with the quartz backend from the sources available at
that site. I tried building using the jhbuild script and the build
process that they suggested but that resulted in a couple of failures
for some packages, probably because it was blindly compiling for x86_64,
when there were 32-bit Carbon dependencies in the packages.

So, I ran the jhbuild anyway, looked at the build log, noted down the
build order, and manually compiled all the required files and patched
the GTK+ sources for Mac OS X 10.6.4. After that, GNU Radio’s configure
was able to pick up the GTK+ installation.

Here is the procedure for replicating this for the GTK+ part and using
Quartz backend. I didn’t use libpng,libjpeg and libtiff for this build.
I also ignored the doc generation utilities.

I did some basic dial tone tests, using GRC and it worked fine. I still
have to test out the main GNU Radio stuff with the UHD driver.

Step 45.00: Install GTK+, which is required for GRC.

GTK+ additionally requires the following libraries:

libpng
gtk-osx-docbook
gnome-doc-utils
gtk-doc
libjpeg
libtiff
expat
perl-xml-parser
perl-xml-simple
hicolor-icon-theme
gnome-common
intltool

glib
pixman
freetype
fontconfig
cairo
pango
atk
gtk+

Step 45.01: Install expat-2.0.1.

$ cd expat-2.0.1
$ ./configure CC=’/usr/bin/gcc-4.0’ CPP=’/usr/bin/cpp-4.0’
CXX=’/usr/bin/g+±4.0’ CXXCPP=’/usr/bin/cpp-4.0’ CFLAGS=’-arch i386
-arch x86_64’ CPPFLAGS=’-arch i386 -arch x86_64’ CXXFLAGS=’-arch i386
-arch x86_64’ LDFLAGS=’-arch i386 -arch x86_64’
–disable-dependency-tracking
$ make -j 6
$ sudo make install

Check the file architecture.

$ file /usr/local/lib/libexpat.dylib

/usr/local/lib/libexpat.dylib: Mach-O universal binary with 2
architectures
/usr/local/lib/libexpat.dylib (for architecture i386): Mach-O
dynamically linked shared library i386
/usr/local/lib/libexpat.dylib (for architecture x86_64): Mach-O 64-bit
dynamically linked shared library x86_64

Step 45.02: Install hicolor-icon-theme-0.11.

$ cd hicolor-icon-theme-0.11
$ ./configure
$ make
$ sudo make install

Step 45.03: Install glib-2.24.1. (32-bit only, need to create a
universal binary later on).

GLib is the low-level core library that forms the basis for projects
such as GTK+ and GNOME. It provides data structure handling for C,
portability wrappers, and interfaces for such runtime functionality as
an event loop, threads, dynamic loading, and an object system.

$ cd glib-2.24.1

$ ./configure CC=’/usr/bin/gcc-4.0’ CPP=’/usr/bin/cpp-4.0’
CXX=’/usr/bin/g+±4.0’ CXXCPP=’/usr/bin/cpp-4.0’ CFLAGS=’-arch i386’
CPPFLAGS=’-arch i386’ CXXFLAGS=’-arch i386’ LDFLAGS=’-arch i386’

$ make -j 6
$ sudo make install

Check the file architecture.

$ file /usr/local/lib/libglib-2.0.dylib

/usr/local/lib/libglib-2.0.dylib: Mach-O dynamically linked shared
library i386

Step 45.04: Install pixman-0.16.0.

Pixman is a library that provides low-level pixel manipulation features
such as image compositing and trapezoid rasterization.

$ cd pixman-0.16.0
$ ./configure CC=’/usr/bin/gcc-4.0’ CPP=’/usr/bin/cpp-4.0’
CXX=’/usr/bin/g+±4.0’ CXXCPP=’/usr/bin/cpp-4.0’ CFLAGS=’-arch i386
-arch x86_64’ CPPFLAGS=’-arch i386 -arch x86_64’ CXXFLAGS=’-arch i386
-arch x86_64’ LDFLAGS=’-arch i386 -arch x86_64’
–disable-dependency-tracking
$ make -j 6
$ sudo make install

Check the file architecture.

$ file /usr/local/lib/libpixman-1.dylib

/usr/local/lib/libpixman-1.dylib: Mach-O universal binary with 2
architectures
/usr/local/lib/libpixman-1.dylib (for architecture i386): Mach-O
dynamically linked shared library i386
/usr/local/lib/libpixman-1.dylib (for architecture x86_64): Mach-O
64-bit dynamically linked shared library x86_64

Step 45.05: Install freetype-2.3.11.

$ cd freetype-2.3.11
$ ./configure CC=’/usr/bin/gcc-4.0’ CPP=’/usr/bin/cpp-4.0’ CFLAGS=’-arch
i386 -arch x86_64’ CPPFLAGS=’-arch i386 -arch x86_64’ LDFLAGS=’-arch
i386 -arch x86_64’ --disable-dependency-tracking
$ make -j 6
$ sudo make install

Check the file architecture.

$ file /usr/local/lib/libfreetype.dylib

/usr/local/lib/libfreetype.dylib: Mach-O universal binary with 2
architectures
/usr/local/lib/libfreetype.dylib (for architecture i386): Mach-O
dynamically linked shared library i386
/usr/local/lib/libfreetype.dylib (for architecture x86_64): Mach-O
64-bit dynamically linked shared library x86_64

Step 45.06: Install fontconfig-2.7.3.

$ cd fontconfig-2.7.3
$ ./configure CC=’/usr/bin/gcc-4.0’ CPP=’/usr/bin/cpp-4.0’ CFLAGS=’-arch
i386 -arch x86_64’ CPPFLAGS=’-arch i386 -arch x86_64’ LDFLAGS=’-arch
i386 -arch x86_64’ --disable-dependency-tracking
$ make -j 6
$ sudo make install

Check the file architecture.

$ file /usr/local/lib/libfontconfig.dylib

/usr/local/lib/libfontconfig.dylib: Mach-O universal binary with 2
architectures
/usr/local/lib/libfontconfig.dylib (for architecture i386): Mach-O
dynamically linked shared library i386
/usr/local/lib/libfontconfig.dylib (for architecture x86_64): Mach-O
64-bit dynamically linked shared library x86_64

Step 45.07: Install cairo-1.8.8. (32-bit only, due to Carbon
dependency).

Cairo is a 2D graphics library with support for multiple output devices.
Currently supported output targets include the X Window System, quartz,
win32, and image buffers, as well as PDF, PostScript, and SVG file
output. Experimental backends include OpenGL (through glitz), XCB, BeOS,
OS/2, and DirectFB.

$ cd cairo-1.8.8
$ ./configure CC=’/usr/bin/gcc-4.0’ CPP=’/usr/bin/cpp-4.0’
CXX=’/usr/bin/g+±4.0’ CXXCPP=’/usr/bin/cpp-4.0’ CFLAGS=’-arch i386’
CPPFLAGS=’-arch i386’ CXXFLAGS=’-arch i386’ LDFLAGS=’-arch i386’

cairo (version 1.8.8 [release]) will be compiled with:

The following surface backends:
Image: yes (always builtin)
Xlib: yes
Xlib Xrender: yes
Quartz: yes
Quartz-image: no (disabled, use --enable-quartz-image to enable)
XCB: no (disabled, use --enable-xcb to enable)
Win32: no (requires a Win32 platform)
OS2: no (disabled, use --enable-os2 to enable)
PostScript: yes
PDF: yes
SVG: yes
glitz: no (disabled, use --enable-glitz to enable)
BeOS: no (disabled, use --enable-beos to enable)
DirectFB: no (disabled, use --enable-directfb to enable)

The following font backends:
User: yes (always builtin)
FreeType: yes
Win32: no (requires a Win32 platform)
Quartz: yes

The following functions:
PNG functions: yes

And the following internal features:
gcov support: no
test surfaces: no (disabled, use --enable-test-surfaces to enable)
ps testing: no (requires ghostscript)
pdf testing: no (requires poppler-glib >= 0.9.2)
svg testing: no (requires librsvg-2.0 >= 2.15.0)

$ make -j 6
$ sudo make install

Check the file architecture.

$ file /usr/local/lib/libcairo.dylib

/usr/local/lib/libcairo.dylib: Mach-O dynamically linked shared library
i386

Step 45.08: Install pango-1.28.1. (32-bit only, due to Carbon
dependency).

Pango is a library for layout and rendering of text, with an emphasis on
internationalization. Pango can be used anywhere that text layout is
needed; however, most of the work on Pango so far has been done using
the GTK+ widget toolkit as a test platform. Pango forms the core of text
and font handling for GTK±2.x.

$ cd pango-1.28.1
$ wget
http://github.com/jralls/gtk-osx-build/raw/master/patches/pangoatsui-fontname.patch
$ patch -p1 < pangoatsui-fontname.patch

$ ./configure CC=’/usr/bin/gcc-4.0’ CPP=’/usr/bin/cpp-4.0’
CXX=’/usr/bin/g+±4.0’ CXXCPP=’/usr/bin/cpp-4.0’ CFLAGS=’-arch i386’
CPPFLAGS=’-arch i386’ CXXFLAGS=’-arch i386’ LDFLAGS=’-arch i386’

configuration:
backends: Cairo Xft FreeType X

$ make -j 6
$ sudo make install

Check the file architecture.

$ file /usr/local/lib/libpango-1.0.dylib

/usr/local/lib/libpango-1.0.dylib: Mach-O dynamically linked shared
library i386

Step 45.09: Install atk-1.30.0. (32-bit only, due to glib-2.24.1 32-bit
build dependency).

$ cd atk-1.30.0
$ ./configure CC=’/usr/bin/gcc-4.0’ CPP=’/usr/bin/cpp-4.0’ CFLAGS=’-arch
i386’ CPPFLAGS=’-arch i386’ LDFLAGS=’-arch i386’

$ make -j 6
$ sudo make install

Check the file architecture.

$ file /usr/local/lib/libatk-1.0.dylib

/usr/local/lib/libatk-1.0.dylib: Mach-O dynamically linked shared
library i386

Step 45.10: Install gtk±2.20.1. (32-bit only, due to Carbon
dependency).

$ cd gtk±2.20.1

Patch the source files:

$ wget
http://github.com/jralls/gtk-osx-build/raw/master/patches/gtkselection.patch
$ patch -p1 < “gtkselection.patch”

$ wget
http://github.com/jralls/gtk-osx-build/raw/master/patches/gtkcups.patch
$ patch -p1 < “gtkcups.patch”

$ wget
http://github.com/jralls/gtk-osx-build/raw/master/patches/gdkwindow-quartz.patch
$ patch -p1 < “dkwindow-quartz.patch”

$ wget
http://github.com/jralls/gtk-osx-build/raw/master/patches/gtk_meta.patch
$ patch -p1 < “gtk_meta.patch”

$ wget
http://github.com/jralls/gtk-osx-build/raw/master/patches/gtk-introspection.patch
$ patch -p1 < “gtk-introspection.patch”

$ wget
http://github.com/jralls/gtk-osx-build/raw/master/patches/gtk-keyhash.patch
$ patch -p1 < “gtk-keyhash.patch”

$ ./configure CC=’/usr/bin/gcc-4.0’ CPP=’/usr/bin/cpp-4.0’
CXX=’/usr/bin/g+±4.0’ CXXCPP=’/usr/bin/cpp-4.0’ CFLAGS=’-arch i386’
CPPFLAGS=’-arch i386’ CXXFLAGS=’-arch i386’ LDFLAGS=’-arch i386’
–with-gdktarget=quartz --without-libtiff --without-libjpeg

configuration:
target: quartz

$ make -j 6
$ sudo make install

Check the file architecture.

$ file /usr/local/lib/libgtk-quartz-2.0.dylib

/usr/local/lib/libgtk-quartz-2.0.dylib: Mach-O dynamically linked shared
library i386

Step 46.00: Install Python GTK+ wrapper.

Step 46.01: Download and build gobject-introspection-0.9.6. (Not
working, error linking to x86_64 when not specified.)

http://ftp.gnome.org/pub/GNOME/sources/gobject-introspection/0.9/gobject-introspection-0.9.6.tar.bz2

$ cd gobject-introspection-0.9.6

$ ./configure CC=’/usr/bin/gcc-4.0’ CPP=’/usr/bin/cpp-4.0’ CFLAGS=’-arch
i386’ CPPFLAGS=’-arch i386’ LDFLAGS=’-arch i386’

$ make -j 6
$ sudo make install

Step 46.02: Download and build pygobject-2.21.5. (Introspection
disabled since we couldn’t build it).

http://ftp.gnome.org/pub/GNOME/sources/pygobject/2.21/pygobject-2.21.5.tar.bz2

$ cd pygobject-2.21.5

$ ./configure CC=’/usr/bin/gcc-4.0’ CPP=’/usr/bin/cpp-4.0’ CFLAGS=’-arch
i386’ CPPFLAGS=’-arch i386’ LDFLAGS=’-arch i386’ --disable-introspection

$ make -j 6
$ sudo make install

Step 46.03: Download and build pycairo-1.8.8, for python-2.x.

http://cairographics.org/releases/pycairo-1.8.8.tar.gz

$ cd pycairo-1.8.8

$ ./configure CC=’/usr/bin/gcc-4.0’ CPP=’/usr/bin/cpp-4.0’ CFLAGS=’-arch
i386’ CPPFLAGS=’-arch i386’ LDFLAGS=’-arch i386’

$ make -j 6
$ sudo make install

Test the pycairo installation:

$ export VERSIONER_PYTHON_PREFER_32_BIT=yes
$ python

import cairo
cairo.cairo_version_string() # shows the cairo version
‘1.8.8’

cairo.version # shows the pycairo version
‘1.8.8’

exit()

Step 46.04: Download and build pygtk-2.21.0.

http://ftp.gnome.org/pub/GNOME/sources/pygtk/2.21/pygtk-2.21.0.tar.bz2

$ cd pygtk-2.21.0

$ ./configure CC=’/usr/bin/gcc-4.0’ CPP=’/usr/bin/cpp-4.0’ CFLAGS=’-arch
i386’ CPPFLAGS=’-arch i386’ LDFLAGS=’-arch i386’

The following modules will be built:

atk
pango
pangocairo
gtk with 2.20 API
gtk.unixprint

The following modules will NOT be built:

gtk.glade

Numpy support: yes

$ make -j 6
$ sudo make install

Ensure that you update the PYTHONPATH variable with the location of the
pygtk installation package. This is not normally added, unless you
explicitly make a call

/usr/local/lib/python2.6/site-packages/gtk-2.0

This is not normally added, unless you explicitly state that you require
the pygtk 2.0 as follows:

try:
import pygtk
pygtk.require(‘2.0’)
except ImportError:
pass
import gobject
import gtk

Best regards,

Elvis D.