gEDA on Mac OS X Lion 10.7.1
gEDA on Mac OS X Lion 10.7.1
2011
For a small private project which started about 4 years ago and which I then put aside, I needed to finalize a schematic diagram and PCB layout. However, I wasn’t very careful and had a quick finger when Mac OS X Lion came out, so several software packages stopped working then, and the gEDA tools were among them. So, I decided once again to re-build the tools and their dependencies from the source packages.
I know about MacPorts and fink, but prefer to configure and make the open source packages myself so that I have more control over what stuff is in which directories and what happens during the build. Hopefully, the information on this page will be useful for others and save them some time :-)
The OS and GCC version that I use:
% uname -a
Darwin Andreas-Schweizers-MacBook-Pro.local 11.1.0 Darwin Kernel Version 11.1.0: Tue Jul 26 16:07:11 PDT 2011; root:xnu-1699.22.81~1/RELEASE_X86_64 x86_64
% gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)
If you have a different environment (or even if you have the same), this may work or may not. From top to bottom, it should take about two to three hours. If it doesn’t work, leave a comment and I’ll try to help :-)
I’ll first give a list of all packages with links to where you can download them. To avoid issues when Apple update stuff in /usr/lib, I try to depend on as few things in /usr/lib as possible and provide all dependencies, so the list is very long. Click on each entry to get more information and download the package.
4.libiconv-1.14 - character encoding conversion, unicode support
15. dbus-1.4.14 - message bus system for interprocess communication
16. pkg-config-0.25 - metadata database for installed libraries
20. fontconfig-2.8.0 - configuring and customizing font access
30. gtk+-2.24.6 - GIMP toolkit for graphical user interfaces
31. gd-2.0.33 - graphics library for dynamic image generation
I like to have all these packages in /usr/local/geda, so I’ve first added /usr/local/geda/bin to the PATH variable in my .bash_profile, created a src subdirectory, downloaded and extracted all packages into /usr/local/geda/src.
Of course, one could put these anywhere (preferrably not into /usr ;-).
Next, I’ve set LDFLAGS=”-L/usr/local/geda/lib” and CPPFLAGS=”-I/usr/local/geda/include” so that the compiler and linker can find the header files and libraries.
For every package, I’ve created a build directory in src, for example build-libtool-2.4, and then done the configure / make / make install steps. For the configure step, I’ve always included the --prefix=/usr/local/geda:
% mkdir build-libtool-2.4
% cd build-libtool-2.4/
% ../libtool-2.4/configure --prefix=/usr/local/geda
## ----------------------- ##
## Configuring libtool 2.4 ##
## ----------------------- ##
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ../libtool-2.4/libltdl/config/install-sh -c -d
checking for gawk... no
checking for mawk... no
...
This should work fine for most packages. With one exception (dbus), I’ve never run “make install” as root user because I have full access to /usr/local/geda. All packages will be compiled to x86_64 by default, which worked just fine for me. The following list contains information about those packages which need some “special treatment”.
2.zlib-1.2.5
Building zlib in a separate directory doesn’t word for me. Simply cd into zlib-1.2.5 and run ./configure --prefix=/usr/local/geda.
7. ncurses-5.9
This library needs the --with-shared configure switch, otherwise it will only generate static library files.
8.gettext-0.18.1.1
Generates a compiler error:
../../../gettext-0.18.1.1/gettext-tools/gnulib-lib/stpncpy.c:34: error: expected declaration specifiers or ‘...’ before numeric constant
To fix it, remove or comment-out the following three lines of preprocessor code in stpncpy.c (lines 27 to 29):
#ifndef weak_alias
# define __stpncpy stpncpy
#endif
Then the compilation will succeed.
11.gc-7.2alpha6
Fails with a compilation error:
../gc-7.2alpha6/libatomic_ops/src/atomic_ops/sysdeps/gcc/x86_64.h:111: error: unsupported inline asm: input constraint with a matching output constraint of incompatible type!
Modify the x86_64.h at line 113, i.e. this statement:
__asm__ __volatile__("xchgb %0, %1"
: "=q"(oldval), "=m"(*addr)
: "0"(0xff), "m"(*addr) : "memory");
Insert a typecast on the third line, like this:
: "0"((unsigned int)0xff), "m"(*addr) : "memory");
Then it should compile correctly.
Credits to Jeremy Huddleston!
http://permalink.gmane.org/gmane.comp.programming.garbage-collection.boehmgc/4590
13.readline-6.2
Has not been updated for Mac OS X 10.7 (darwin11), so open the support/shobj-conf and change darwin10 to darwin11 in the two places where it appears.
14.gmp-5.0.2
Has a small issue in acinclude.m4 which causes the test (which you should run with make check after building!) to hang indefinitely. Search for 1,2,3 in acinclude.m4 (should be on line 1944 in version 5.0.2) and change two lines of code:
extern const int foo[];
const int foo[] = {1,2,3};
Duplicate the brackets so that the code reads like this:
extern const int foo[[]];
const int foo[[]] = {1,2,3};
You need to do this before the configure step. The same in configure, but there, you put single brackets at line 26450 like this:
extern const int foo[];
const int foo[] = {1,2,3};
Credit to Jack Howarth for this one!
http://gmplib.org/list-archives/gmp-bugs/2011-July/002308.html
15.dbus-1.4.14
Wants to install something into /Library/LaunchAgents for which it needs extended permissions, so you need to run “make install” as root or with sudo. Don’t forget to do a sudo chown -R aschweiz /usr/local/geda afterwards to fix the ownership of the installed files. (Replace aschweiz with your user name.)
17. glib-2.29.18
Gives an error during configuration. Open a new Terminal window and run again the “export LDFLAGS=...” and “export CPPFLAGS=...” as described above.
configure: error:
*** You must have either have gettext support in your C library, or use the
*** GNU gettext library. (http://www.gnu.org/software/gettext/gettext.html)
In addition, comment-out or remove the lines 64 to 66 in glib/gconvert.c:
#if !defined(USE_LIBICONV_GNU) && defined (_LIBICONV_H)
#error GNU libiconv not in use but included iconv.h is from libiconv
#endif
Then it will fail a little bit later during “make”
../../glib-2.29.18/gio/gunixmounts.c: In function '_g_get_unix_mounts':
../../glib-2.29.18/gio/gunixmounts.c:608: warning: passing argument 1 of 'getmntinfo' from incompatible pointer type
../../glib-2.29.18/gio/gunixmounts.c:617: error: 'struct statvfs' has no member named 'f_mntonname'
Comment-out the statements in gio/gunixmounts.c starting at line 596 as illustrated here:
static GList *
_g_get_unix_mounts (void)
{
//#if defined(USE_STATFS)
struct statfs *mntent = NULL;
//#elif defined(USE_STATVFS)
// struct statvfs *mntent = NULL;
//#else
// #error statfs juggling failed
//#endif
int num_mounts, i;
And some more at line 620:
//#if defined(USE_STATFS)
if (mntent[i].f_flags & MNT_RDONLY)
//#elif defined(USE_STATVFS)
// if (mntent[i].f_flag & MNT_RDONLY)
//#endif
Then it should compile fine.
21.guile-1.8.8
This one took a while to figure out. Instructions are on my older blog entry:
Detecting_the_direction_of_stack_growth_in_C
I was lazy when trying all steps again and just replaced the two occurrences of the find_stack_direction function with my dirty version with the dummy local parameters. Anyway, this time, it worked perfectly fine!
Update (21.11.2011):
gsch2pcb doesn’t work like this; I got the following error when running gnetlist (gsch2pcb hides the error):
/srfi/srfi-1.scm:223:1: file:
"libguile-srfi-srfi-1-v-3", message: "file not found"
As a hotfix, I’ve modified the srfi-1.scm on line 223 to include the full path of the libguile-srfi-srfi-1-v-3, but I need to check this in more detail.
22.pixman-0.22.2 (added on 30.11.2011)
The configure script is no longer included in the downloadable .tar.gz and there are some issues to generate it (see the comments below), so I’ve attached the version which I had used as a temporary solution. Luckily I still found it on my harddisk.
25.pango-1.29.3
See my older blog entry: CoreText_vs._FontConfig
In short, you can download the patch file at the right side into /usr/local/geda/src, then cd into pango-1.29.3 and run the following command:
% patch -p1 -i ../pango-1.29.3-coretext.patch
This fixes a caching issue in Pango which would lead to messed-up font sizes in gschem later.
32.gtkglext-1.2.0
I get an error about missing X development libraries:
configure: error: X development libraries not found
To fix it, export CPPFLAGS="-I/usr/local/geda/include -I/usr/X11/include" and export LDFLAGS="-L/usr/local/geda/lib -dylib_file/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib -L/usr/x11/lib".
Then, there would later be runtime errors about missing
dyld: lazy symbol binding failed: Symbol not found: _GTK_WIDGET_NO_WINDOW
Referenced from: /usr/local/geda/lib/libgtkglext-x11-1.0.0.dylib
Expected in: flat namespace
To avoid these upfront, modify gtk/gtkglwidget.c:
-replace all GTK_WIDGET_REALIZED with gtk_widget_get_realized (8 occurrences: lines 130, 157, 177, 197, 254, 435, 477, 504)
-replace GTK_WIDGET_TOPLEVEL with gtk_widget_is_toplevel (a single occurrence, line 177)
-replace !GTK_WIDGET_NO_WINDOW with gtk_widget_get_has_window (note the ! which you need to remove because the semantic of the new method is inverted! - there’s a single occurrence on line 254)
33.gerbv-2.4.0
It was worth the effort - the GUI is fantastic!
34.pcb-20110918
The CPPFLAGS and LDFLAGS need to be set as written above, in 32. In addition, add the following declaration in src/hid/common/hidgl.c for example at line 69:
typedef GLvoid (*_GLUfuncptr)(GLvoid);
Then it should work:
35.geda-gaf-1.7.1
Thanks to the Pango fix, there are no surprises here :-)
Well, it didn’t find my symbols, but that should be easy to fix:
As a final step, I backed up the entire /usr/local/geda on my file server and then removed /usr/local/geda/src to save some space on the SSD. The disk space usage:
-bin - 8.2 MB
-etc - 81 kB
-include - 8.3 MB
-lib - 75.9 MB
-libexec - 484 kB
-man - 630 kB
-share - 88.7 MB
-var - 936 kB
(Ah yes, and src is 1.13 GB...)
Leave me a comment if you have ideas for improvement or other feedback!
Compiling the gEDA Tools on Mac OS X 10.7.1
06.10.2011
I spent the last two week’s evenings trying to build the gEDA tools on my MacBook Pro with Mac OS X 10.7 Lion. Here are some step-by-step instructions for those who want to do the same.