Compiling Dynamips on (Intel) Mac

For those Apple Mac (Intel) users out there that have been asking how to compile Dynamips on Apple Mac(Intel) or if you want, you can try my Apple-Mac-(Intel)-compiled dynamips-0.2.7-intel-mac.bin.tar.bz2.

I’m not a programmer and don’t have any programming nor even Apple MAC (Intel) experience. Therefore, I can’t really explain what is happening here and why you need to do so.

XCode.

This is the package from Apple for those Apple Mac users who want to start do some programming and compiling. Apparently, It’s a big file (approx. 924MB) to download and you need to create an account with Apple. Installation is pretty straightforward. Download the package Xcode 2.4.1 (DMG) and follow the instructions.

Darwin Ports

get this file from Darwin Ports follow the installation instructions and update your ports using this command.

$ sudo port -d selfupdate
Password: <your root password>

What you need is a libpcap.a file and you can get it from Darwin port.

$ sudo port install libpcap
Password: <your root password>

Create a symbolic link to this libpcap.a file

 
$ sudo ln -s /opt/usr/local/libpcap.a /usr/local/lib/libpcap.a
Password: <your root password>

Libelf – ELF object file access library.

$ curl 'http://www.mr511.de/software/libelf-0.8.9.tar.gz' -o libelf-0.8.9.tar.gz 
$ tar -zxvf libelf-0.8.9.tar.gz 
$ cd libelf-0.8.9 
$ ./configure --prefix=/usr/local 
$ make 
$ sudo make install

Dynamips

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

Thanks to dynamips (Cisco 7200 Simulator) on Mac OS X

NOTE: Why the compile output has 4MB file instead of small binary like Linux/Windows?
ANSWER: Check Greg’s comments. The file is now updated with smaller size.

21 thoughts on “Compiling Dynamips on (Intel) Mac

  1. Greg

    Nice writeup. You need to strip the binary to remove the debugging symbols. That’s why the file size is so big. Just do “strip dynamips-0.2.7.intel-mac.bin”

  2. Scott Vermillion

    Hey David,

    Thanks much for the write-up. I was able to compile 0.2.8-RC2 following your instructions. I had a minor variation having to do with file locations (IIRC, I had to change sudo ln -s /opt/usr/local/libpcap.a /usr/local/lib/libpcap.a to sudo ln -s /opt/usr/local/libpcap.a /usr/lib/libpcap.a – the difference being that I had to strip out the local), but other than that it went off without a hitch!

    Regards,

    Scott

  3. jeff

    Hi David,

    I have compiled dynamips as stated above. Can you tell me how to start it from the terminal please..i.e what command to use?

    cheers,

    jeff

  4. jamie

    I am getting this message when I try to run make. Everything previous worked without error.

    $ make
    Linking rom2c
    i686-apple-darwin9-gcc-4.0.1: /usr/local/lib/libpcap.a: No such file or directory
    make: *** [rom2c] Error 1

  5. Barry

    I had the same error trying to start the make process.
    I had to change the ln into this to fix it
    ( After first removing the original alias which pointed to a dir that did not exist )

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

  6. Zakk

    I’m a newbie to Linux, but these instructions seem pretty straight forward. I have the same problem as Jamie and I cannot get around it. After following Barry’s suggestion I get this:

    $ sudo ln -s /opt/local/lib/libpcap.a /usr/local/lib/libpcap.a
    ln: /usr/local/lib/libpcap.a: File exists

    So the libpcap.a file is there. Yet, when I try to start the make process I get the same error as jamie:

    $ make
    Linking rom2c
    i686-apple-darwin8-gcc-4.0.1: /usr/local/lib/libpcap.a: No such file or directory
    make: *** [rom2c] Error 1

    What am I doing wrong here?

    Frustrated,

    Zakk

  7. roaminajeep

    Zakk,

    it really depends on where your libpcap.a file is located. once you have determined that and create the symbolic link (it shouldn’t return any output when you correctly assign the link) the make command for the dynamips install will work.

    here is the path/command for mine:
    sudo ln -s /opt/local/var/macports/software/libpcap/0.9.8_0/opt/local/lib/libpcap.a /usr/local/lib/libpcap.a

    oh! and you might need a to install a newer version of dynamips.. i did version 2.8 RC 2.

    You can find the latest version here
    http://www.ipflow.utc.fr/dynamips/dynamips-0.2.8-RC2.tar.gz

  8. ccievirus

    Hi,

    I was able to do all the steps here using 0.2.8-RC2 and it was smooth. Pardon me for I am not good in programming..

    My question now,

    How can I run this now? Please give me step by step process
    How can I apply the internetwork expert topology here?

    Rgds,

    CV

  9. Pingback: 101 Resources for Self Learning Cisco | Learning On Demand

  10. HaEr

    I would like to compile dynamips on my Snow Leopard MacMini.
    Is it just to follow your guide? I am not a programmer, I have never before compiled a program.

  11. Nikhil

    Did you try to compile it using dynamips 2.8RC2.. I need one urgently. I am trying to follow the directions above and am having problems. Please let me know.

    Thanks

    Nikhil
    dvbn844[at]gmail.com

  12. Nikhil

    I am getting this error when I make 2.8-RC2

    Compiling mips64_jit.c
    mips64_jit.c:258: warning: ‘insn_jump_find’ defined but not used
    /var/folders/g3/g3g2ojmoF2WEeDIAOXDuMk+++TI/-Tmp-//cc491UUf.s:1328:suffix or operands invalid for `mov’
    make: *** [mips64_jit.o] Error 1

  13. rito

    I’m getting this error when introduce make command, I mean, I don’t know who this mean

    making all in lib
    make[1]: Nothing to be done for `all’.
    making all in po
    make[1]: Nothing to be done for `all’.

    thanks!!

  14. phoman

    I also found that Snow Leopard won’t compile dynamips as a 64 bit application – looks like the jit is for a 32 bit instruction set, hence the error when compiling as an x86 architecture. I tried changing the DYNAMIPS_ARCH in the makefile to amd_64 and it compiled ok and ran, but seg faulted when it tried to load an IOS image. Then I disabled the jit by setting the DYNAMIPS_ARCH to nojit and it compiled and runs fine. I also screwed around with setting compiler options to -m32, but this threw up wrong architecture type errors with my Port libs (because they are all noewly compiled by 10.6 as 64 bit). Looks like someone needs to rewrite the jit for 64 bit to work with 10.6.

  15. Mario

    @Phoman – Can you please describe how exactly is it that you change the “DYNAMIPS_ARCH” to nojit ?

    I’ve updated xcode, updated macports and run into the issues people have posted here regarding Snow Leopard. I am just curious how to make the necessary changes recommended.

    BTW – This issues is documented : http://trac.macports.org/ticket/22285

  16. Pingback: Dynamips-0.2.8-RC3 Installation from Source on Linux Fedora « Brezular's Technical Blog

  17. Pingback: Dynamips Compilation and Installation on Fedora Linux | Brezular's Blog

Leave a Reply