Compiling Dynamips on Intel Mac + Leopard.

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 InstallXcode 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 InstallXcode ToolsPackages – 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

10 thoughts on “Compiling Dynamips on Intel Mac + Leopard.

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

  4. Hello David,

    Thanks for your instructions. Getting through I had a little problem, could you help me?? Thanks!

    leonardo-pinzons-macbook:~ Leo$ sudo ln -s /opt/usr/local/libpcap.a /usr/local/lib/libpcap.a
    ln: /usr/local/lib/libpcap.a: No such file or directory

  5. Hi, i found an error when i tryed to make the dyamips.

    Linking rom2c
    ld: library not found for -lelf
    collect2: ld returned 1 exit status
    make: *** [rom2c] Error 1

    any idea? i do not understand what kind of file of libelf is looking for..

    Regards,

  6. Me again, i found the solution:

    Try this:

    sudo ln -s /opt/local/lib/libelf.a /usr/lib/libelf.a

    It works for me.

    Kindly Regards,

  7. Received the following error when performing make, any ideas ?

    Compiling mips64_jit.c
    mips64_jit.c:258: warning: ‘insn_jump_find’ defined but not used
    /var/tmp//ccBtfdBn.s:1328:suffix or operands invalid for `mov’
    make: *** [mips64_jit.o] Error 1
    sh-3.2# make
    Compiling mips64_jit.c
    mips64_jit.c:258: warning: ‘insn_jump_find’ defined but not used
    /var/tmp//ccWn22Ok.s:1328:suffix or operands invalid for `mov’
    make: *** [mips64_jit.o] Error 1
    sh-3.2#

  8. I get one error, what should I do? Please Help.

    Macintosh-2:dynamips-0.2.8-RC2 Cisco$ sudo make
    Linking rom2c
    ld: warning: directory ‘/usr/local/lib’ following -L not found
    Extracting ROM from ELF file ‘mips64_microcode’…
    Extracting ROM from ELF file ‘ppc32_microcode’…
    Compiling mempool.c
    Compiling registry.c
    Compiling rbtree.c
    Compiling hash.c
    Compiling sbox.c
    Compiling utils.c
    Compiling parser.c
    Compiling plugin.c
    Compiling ptask.c
    Compiling timer.c
    Compiling crc.c
    Compiling base64.c
    Compiling net.c
    Compiling net_io.c
    Compiling net_io_bridge.c
    Compiling net_io_filter.c
    Compiling atm.c
    Compiling atm_vsar.c
    Compiling atm_bridge.c
    Compiling frame_relay.c
    Compiling eth_switch.c
    Compiling dynamips.c
    Compiling insn_lookup.c
    insn_lookup.c:319: warning: ‘ilt_dump’ defined but not used
    Compiling vm.c
    vm.c:115: warning: ‘vm_object_rebuild_list’ defined but not used
    Compiling cpu.c
    Compiling jit_op.c
    Compiling mips64.c
    Compiling mips64_mem.c
    mips64_mem.c: In function ‘mips64_mts32_slow_lookup’:
    mips64_mem.c:377: warning: label ‘err_address’ defined but not used
    Compiling mips64_cp0.c
    Compiling mips64_jit.c
    mips64_jit.c:258: warning: ‘insn_jump_find’ defined but not used
    /var/tmp//cc0kLRR2.s:1328:suffix or operands invalid for `mov’
    make: *** [mips64_jit.o] Error 1
    Macintosh-2:dynamips-0.2.8-RC2 Cisco$

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>