Compiling Dynamips on Intel Mac + Leopard.

by David Sudjiman ~ December 16th, 2007. Filed under: Cisco, Mac.

This article is a continuity from my previous article.

As I’ve upgrade my MBP from Tiger to Leopard, some adjustment needs to be made.

Installing XCode 3.0

If you get the Leopard CD, you can install XCode 3.0 from it. Go to Optional Install - Xcode Tools - and run XcodeTools.mpkg to install.

Or you can also download it from http://developer.apple.com/tools/download/. You need to get Apple Developer Connection to get it.

Installing X11 SDK

This package is installed by default when you have Leopard on your machine. However, if you need to install X11 SDK, you can use Leopard CD. Go to Optional Install - Xcode Tools - Packages - and run X11SDK.mpkg to install.

MacPorts

Get this MacPorts-1.5.0-10.5.dmg and install it.

Update your port list.

sudo port -v selfupdate

Install libpcap

$ sudo port install libpcap
$ sudo ln -s /opt/usr/local/libpcap.a /usr/local/lib/libpcap.a

Instal libelf

$ sudo port install libelf

Download the latest Dynamips 0.2.8-RC2 source code and install it.

$ curl 'http://www.ipflow.utc.fr/dynamips/dynamips-0.2.8-RC2.tar.gz' -o dynamips-0.2.8-RC2.tar.gz
$ tar -zxvf dynamips-0.2.8-RC2.tar.gz
$ cd dynamips-0.2.8-RC2
$ make
$ mv dynamips dynamips-0.2.8-RC2.intel-mac.bin
$ strip dynamips-0.2.8-RC2.intel-mac.bin

Greg has put his Dynamips compiled on Leopard. You can download this binary from here

3 Responses to Compiling Dynamips on Intel Mac + Leopard.

  1. milisdad

    Saya menggunakan GNS-3, bisa juga menggunakan dynamips namun masih gagal di “emulate mode” :(

    masih ingat saya?
    saya dulu di Tim ILC 2002 Jogja :D

  2. Whisperwind

    David, in following your instructions which are very helpful, thank you. I successfully get through all but the last couple of steps as shown below…. Any ideas????

    ProKick:~ ProKick$ cd dynamips-0.2.8-RC2
    ProKick:dynamips-0.2.8-RC2 ProKick$ make
    Linking rom2c
    rom2c.c:16:20: error: libelf.h: No such file or directory
    rom2c.c: In function ‘main’:
    rom2c.c:25: error: ‘Elf32_Ehdr’ undeclared (first use in this function)
    rom2c.c:25: error: (Each undeclared identifier is reported only once
    rom2c.c:25: error: for each function it appears in.)
    rom2c.c:25: error: ‘ehdr’ undeclared (first use in this function)
    rom2c.c:26: error: ‘Elf32_Phdr’ undeclared (first use in this function)
    rom2c.c:26: error: ‘phdr’ undeclared (first use in this function)
    rom2c.c:27: error: ‘Elf’ undeclared (first use in this function)
    rom2c.c:27: error: ‘img_elf’ undeclared (first use in this function)
    rom2c.c:42: warning: implicit declaration of function ‘elf_version’
    rom2c.c:42: error: ‘EV_CURRENT’ undeclared (first use in this function)
    rom2c.c:42: error: ‘EV_NONE’ undeclared (first use in this function)
    rom2c.c:47: warning: implicit declaration of function ‘elf_begin’
    rom2c.c:47: error: ‘ELF_C_READ’ undeclared (first use in this function)
    rom2c.c:49: warning: implicit declaration of function ‘elf_errmsg’
    rom2c.c:49: warning: implicit declaration of function ‘elf_errno’
    rom2c.c:49: warning: format ‘%s’ expects type ‘char *’, but argument 3 has type ‘int’
    rom2c.c:53: warning: implicit declaration of function ‘elf32_getphdr’
    rom2c.c:55: warning: format ‘%s’ expects type ‘char *’, but argument 3 has type ‘int’
    rom2c.c:64: warning: implicit declaration of function ‘elf32_getehdr’
    rom2c.c:75: warning: value computed is not used
    make: *** [rom2c] Error 1
    ProKick:dynamips-0.2.8-RC2 ProKick$ mv dynamiips dynamips-0.2.8-RC2.intel-mac.bin
    mv: rename dynamiips to dynamips-0.2.8-RC2.intel-mac.bin: No such file or directory
    ProKick:dynamips-0.2.8-RC2 ProKick$ strip dynamips-0.2.8-RC2.intel-mac.bin
    strip: can’t open file: dynamips-0.2.8-RC2.intel-mac.bin (No such file or directory)

  3. Kris

    Wisperwind,

    After getting libelf from ports as well, you need to create these additional links in order for the compiler to find them:

    $ sudo ln -s /opt/local/include/libelf /usr/include/libelf
    $ sudo ln -s /opt/local/include/libelf.h /usr/include/libelf.h

    After this & instructions from David, I ran the make without any problems.

Leave a Reply