Banner
Sunday, July 3, 2011
[HOW-TO] - Install NS2 on Mac OSX Snow Leopard
1. Download xcode from the official website of apple developer.
2. Download NS2 all in one set from the NS2 official website.
3. Untar it and move the folder to the directory which there is no space in the path name.
4. In the folder of ns-allinone-x.xx, use xcode to open the file “install.”
5. Modify the sections shown below to:
#! /bin/sh
#
# Copyright (C) 2000 by USC/ISI
# All rights reserved.
#
# Redistribution and use in source and binary forms are permitted
# provided that the above copyright notice and this paragraph are
# duplicated in all such forms and that any documentation, advertising
# materials, and other materials related to such distribution and use
# acknowledge that the software was developed by the University of
# Southern California, Information Sciences Institute. The name of the
# University may not be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED “AS IS” AND WITHOUT ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
# $Header: /cvsroot/nsnam/ns-2/allinone/install,v 1.31 2007/03/10 23:40:05 tom_henderson Exp $
X_INCL = /Developer/SDKs/MacOSX10.6.sdk/usr/X11R6/include
X_LIBS = /Developer/SDKs/MacOSX10.6.sdk/usr/X11R6/lib
MACOS_CONF = “--x-include=$X_INCL --x-libraries=$X_LIBS”
die() {
echo “$@“ 1>&2
test ! -z “$blame” && echo “$blame” 1>&2
exit 1
}
warn() {
echo “$@“
}
。。。
。。。
# Build otcl
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 ..
# Build tclcl
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 ../
# John’s hack
test -f ./otcl-$OTCLVER/libotcl.a && rm ./otcl-$OTCLVER/libotcl.so
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 ../
# Build nam
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
6. Execute “install” in Terminal.
7. In the very directory, use the command:
echo “PATH=/Users/username/ns2/ns-allinone-2.31/bin:$PATH” > .bashrc
Remember to modify the red parts to the directory that you keep the NS2 folder.
8. Go to your home directory, add the following line to “.profile” :
export PATH=$PATH:/Users/wangxiaofei/work/ns/229/bin:/Users/wangxiaofei/work/ns229/tcl8.4.11/unix:/Users/wangxiaofei/work/ns/229/tk8.4.11/unix
export LD_LIBRARY_PATH=/Users/wangxiaofei/work/ns/229/otcl-1.11:/Users/wangxiaofei/work/ns/229/lib
export TCL_LIBRARY=/Users/wangxiaofei/work/ns/229/tcl8.4.11/library
Again, remember to modify the red parts.
9. Use the command: source .profile
10. Use the command “ns” and “nam” to see if the installation success or not.
11. If command “nam” is not working, try to find the folder nam-x.xx in the ns-allinone-x.xx. Make again. And then add the path to .profile as mentioned in step 8.
12. If you have any problem following this tutorial, feel free to ask questions.
13. Reference:
http://ns2-dalingege.blogbus.com/logs/66591956.html
http://old.nabble.com/Ns2-on-Mac-OS,-problem-invoking-Nam-td31055904.html
Subscribe to:
Post Comments (Atom)
2 comments:
How can I install it on Mac OS X Lion :(?
Please I need this as soon as possible
I'm trying to install ns2 on my mac and after following instructions get the following error after running install - symbol(s) not found for architecture x86_64 whilst its building OTcl-1.14
Post a Comment