COMPILING THE GEDA TOOLS ON MAC OS X 10.7.1

http://web.me.com/aschweiz/Website/Blog/Entries/2011/10/6_Compiling_the_gEDA_Tools_on_Mac_OS_X_10.7.1.html

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.


  1. 1.libtool-2.4 - shared libraries support script

  2. 2.zlib-1.2.5 - compression library

  3. 3.expat-2.0.1 - xml parser

  4. 4.libiconv-1.14 - character encoding conversion, unicode support

  5. 5.libxml2-2.7.8 - XML parser and toolkit

  6. 6.libunistring-0.9.3 - manipulating unicode strings

  7. 7.ncurses-5.9 - API for writing text user interfaces

  8. 8.gettext-0.18.1.1 - tools for multilingual messages

  9. 9.intltool-0.41.1 - string translations

  10. 10. libpng-1.5.4 - handling PNG images

  11. 11. gc-7.2alpha6 - garbage collector for C and C++

  12. 12. libffi-3.0.9 - foreign function interface library

  13. 13. readline-6.2 - command-line editing in applications

  14. 14. gmp-5.0.2 - multiple precision arithmetic library

  15. 15. dbus-1.4.14 - message bus system for interprocess communication

  16. 16. pkg-config-0.25 - metadata database for installed libraries

  17. 17. glib-2.29.18 - extensions for C

  18. 18. shared-mime-info-0.90 - common MIME types

  19. 19. desktop-file-utils-0.18 - desktop entries

  20. 20. fontconfig-2.8.0 - configuring and customizing font access

  21. 21. guile-1.8.8 - extension language

  22. 22. pixman-0.22.2 - pixel manipulation library

  23. 23. cairo-1.11.2 - 2D graphics library

  24. 24. freetype-2.4.6 - portable font engine

  25. 25. pango-1.29.3 - text layout and rendering

  26. 26. atk-2.1.91 - accessibility toolkit

  27. 27. jpeg-8c - JPEG image compression library

  28. 28. tiff-3.8.2 - TIFF image library and utilities

  29. 29. gdk-pixbuf-2.24.0 - GIMP drawing kit

  30. 30. gtk+-2.24.6 - GIMP toolkit for graphical user interfaces

  31. 31. gd-2.0.33 - graphics library for dynamic image generation

  32. 32. gtkglext-1.2.0 - OpenGL extension for GTK

  33. 33. gerbv-2.4.0 - ... :-)

  34. 34. pcb-20110918 - ... :-)

  35. 35. geda-gaf-1.7.1 - ... :-)


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”.


  1. 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.


  1. 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.


  1. 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


  1. 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.


  1. 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


  1. 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.


  1. 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.


  1. 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.


  1. 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.


  1. 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:

  1. -replace all GTK_WIDGET_REALIZED with gtk_widget_get_realized (8 occurrences: lines 130, 157, 177, 197, 254, 435, 477, 504)

  2. -replace GTK_WIDGET_TOPLEVEL with gtk_widget_is_toplevel (a single occurrence, line 177)

  3. -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)


  1. 33.gerbv-2.4.0

It was worth the effort - the GUI is fantastic!



  1. 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:



  1. 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:

  1. -bin - 8.2 MB

  2. -etc - 81 kB

  3. -include - 8.3 MB

  4. -lib - 75.9 MB

  5. -libexec - 484 kB

  6. -man - 630 kB

  7. -share - 88.7 MB

  8. -var - 936 kB

(Ah yes, and src is 1.13 GB...)


Leave me a comment if you have ideas for improvement or other feedback!

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值