Installing NS-2 2.33 or 2.34 on Mac OS X 10.6 (aka Snow Leopard)

8 09 2011

Apply the following modifications to the file ns-allinone-2.34/install: (add what’s in red and in green*)

* the lines in green are, possibly, only necessary to Mac OS X 10.6 (aka Snow Leopard). With Mac OS X 10.5 (aka Leopard), the red lines should be enough.

Modification 1

echo "============================================================"
echo "* Build OTcl-$OTCLVER"
echo "============================================================"
cd ./otcl-$OTCLVER
blame='Please check http://www.isi.edu/nsnam/ns/ns-problems.html
for common problems and bug fixes.'
if  [ "${test_cygwin}" = "true" ]; then
        ./configure --x-libraries=/usr/X11R6/lib --x-includes=/usr/X11R6/include || die "otcl-$OTCLVER configuration failed! Exiting ...";
else
        ./configure --x-libraries=/usr/X11R6/lib --x-includes=/usr/X11R6/include CFLAGS="-framework CoreFoundation" || die "otcl-$OTCLVER configuration failed! Exiting ...";
fi
if make
then
     echo "otcl-$OTCLVER has been installed successfully."
else
     echo "otcl-$OTCLVER make failed! Exiting ..."
     echo "See http://www.isi.edu/nsnam/ns/ns-problems.html for problems"
     exit
fi
cd ..

Modification 2

echo "============================================================"
echo "* Build Tclcl-$TCLCLVER"
echo "============================================================"
cd ./tclcl-$TCLCLVER
if  [ "${test_cygwin}" = "true" ]; then
        ./configure --x-libraries=/usr/X11R6/lib --x-includes=/usr/X11R6/include || die "tclcl-$TCLCLVER configuration failed! Exiting ...";
else
        ./configure --x-libraries=/usr/X11R6/lib --x-includes=/usr/X11R6/include --with-otcl=../otcl-$OTCLVER || die "tclcl-$TCLCLVER configuration failed! Exiting ..."
fi
if make
then
     echo "tclcl-$TCLCLVER has been installed successfully."
else
     echo "tclcl-$TCLCLVER make failed! Exiting ..."
     echo "See http://www.isi.edu/nsnam/ns/ns-problems.html for problems"
     exit
fi    
cd ../

Modification 3

echo "============================================================"
echo "* Build ns-$NSVER"
echo "============================================================"
cd ./ns-$NSVER
if [ -f Makefile ] ; then
     make distclean
fi
if  [ "${test_cygwin}" = "true" ]; then
        ./configure --x-libraries=/usr/X11R6/lib --x-includes=/usr/X11R6/include || die "Ns configuration failed! Exiting ...";
else
        ./configure --x-libraries=/usr/X11R6/lib --x-includes=/usr/X11R6/include LIBS="-framework CoreFoundation" --with-otcl=../otcl-$OTCLVER --with-tclcl=../tclcl-$TCLCLVER || die "Ns configuration failed! Exiting ...";
fi
if make
then
     echo " Ns has been installed successfully."
else
     echo "Ns make failed!"
     echo "See http://www.isi.edu/nsnam/ns/ns-problems.html for problems"
     exit
fi
cd ../

Modification 4

echo "============================================================"
echo "* Build nam-$NAMVER"
echo "============================================================"
ln -s otcl-$OTCLVER otcl
ln -s tclcl-$TCLCLVER tclcl
cd ./nam-$NAMVER
# XXX temporary OS X hack
if  [ "${test_darwin}" = "true" ]; then
ln -s /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation libcorefoundation.dylib
fi
if  [ "${test_cygwin}" = "true" ]; then
        ./configure --x-libraries=/usr/X11R6/lib --x-includes=/usr/X11R6/include --with-tclcl=$CUR_PATH/tclcl-$TCLCLVER  || die "Nam configuration failed! Exiting ...";
else
        ./configure --x-libraries=/usr/X11R6/lib --x-includes=/usr/X11R6/include V_LIBS="-framework CoreFoundation" --with-otcl=../otcl-$OTCLVER --with-tclcl=../tclcl-$TCLCLVER || die "Nam configuration failed! Exiting ...";
fi
............
cd ../

After applying those modifications, use Terminal app to go to the ns-allinone-2.3x directory and enter  ./install.

Those installation procedures were tested with Max OS X 10.6, but they should work just fine with 10.5.

STILL HAVING PROBLEMS DURING INSTALLATION?

1. If, even after applying the above modifications, your installation fails, proceed as follows:

Install first Xcode development tools. They come with Mac OS X 10.6 CD as an optional installation. After doing that, proceed as explained above.

2. Still failing? Check the following instruction:

In the configure files inside nam, ns, otcl and tclcl directories, look for xlibdirs and xincdirs and check if the following lines, respectively, can be found:

/Developer/SDKs/MacOSX10.4u.sdk/usr/X11R6/lib \

and

/Developer/SDKs/MacOSX10.4u.sdk/usr/X11R6/include \

In NS-2 version 2.34, those lines are present. You should carefully  look for them when using other versions.

 

Anything to say about it? Drop a line in the comments!

 


Ações

Information

12 responses

2 05 2012
S

Hey there, I’ve modified the script accordingly, but the error I got during installation is ‘tk8.4.18 make failed’. Do you have any idea what’s happening? Thanks!

19 07 2012
eduardobuarque

S, what are the ns-2 OS X version you’re using, S? Any further information about the console output would be helpful!

19 07 2012
Geraint Yang

Thanks, it works fine for ns-2.35 !!

19 07 2012
eduardobuarque

Great! What’s your version of OS X?

30 07 2012
geraint0923

I use Lion 10.7, it works.

30 07 2012
geraint0923

But now I fail to build ns-2.33 on Mountain Lion 10.8, also with error when compiling tk, it seems that X11/Xlib.h could not find. I can’t find Xlib.h on my Mac, what about you?

30 07 2012
eduardobuarque

Unfortunately, I won’t be able to test this procedure with OS X 10.8 because I have a 2008 White MacBook that is not compatible with this new release 😦

Anyway, maybe I can help you somehow… The only problem is that exactly today my MacBook power adapter died 😦 and now I’m out of battery.

When I get a new power adapter, I’ll get in touch and maybe I’ll be able to help you.

Thanks!

28 09 2012
Bruno

Any solutions for mac os x 10.8 ? I can’t install on mountain lion

28 09 2012
eduardobuarque

Not yet, Bruno. As I said before, I have a MacBook that is not compatible with ML, therefore I can’t test ns on this new OS X version.

30 09 2012
iaiel (@iael)

Thank you soooo much for this article! I almost went crazy trying to install ns2 on my Lion 10.7.5!

This finally got me to a successful installation. Thanks!

30 09 2012
eduardobuarque

I’m glad everything went fine with your installation.

6 10 2012
iaiel (@iael)

Hello again!
The ns as I said before it is working perfectly, but I’m having a rough time with the xgraph which is not opening and giving me an error.
I checked the installation log and there was an issue with the xgraph and since ‘it is an optional package’ it kept right on.
Could you help me with that?

Deixe um comentário