Hello,

It looks like there were some unanswered questions not long ago regarding 
problems building ns-2 on MacOSX 10.9 (Mavericks) with the newer Xcode 5.  I 
was just able to successfully build ns-2.35 on this platform with clang (llvm) 
based Xcode 5 compiler with a couple of small tweaks.  Here are some notes on 
building the ns-2.35 ns _and_ nam executables on a Mac OSX 10.9 (Mavericks) 
machine with the Xcode 5 llvm/clang compiler environment.  Note that I did 
_not_ use the "osx patch" that is available, but started with the generic 
ns-allinone-2.35 tarball from the download site.

ns-2.35 Mavericks build notes

Starting with a fresh ns-allinone-2.35 tarball:

1) Run the ns-allinone "install" script

./install

(This builds Tcl and Tk until it fails on the otcl-1.14 build)

2) Build otcl-1.14 with different configure command:

cd otcl-1.14
./configure --with-tcl-ver=8.5.10 --with-tk-ver=8.5.10 CFLAGS="-framework 
CoreFoundation"
make
cd ..

3) Build tclcl-1.20 with its default configure command

cd tclcl-1.20
./configure
make
cd ..

4) Modify a couple of source files and build ns with different configure 
command:

a) Run configure

./configure --x-libraries=/usr/X11R6/lib --x-includes=/usr/X11R6/include 
LIBS="-framework CoreFoundation -lstdc++.6" --with-otcl=../otcl-1.14 
--with-tclcl=../tclcl-1.20 CFLAGS='-stdlib=libstdc++'

b) Edit the resultant "Makefile" and add "-stdlib=libstdc++" to CFLAGS macro 
variable (It seems you should be able to make this happen somehow on the 
configure command line, but I had no luck with it).

Note these two steps above set the clang compiler to use the "libstdc++" C++ 
template libraries, etc instead of the newer "libc++" library that clang 
defaults to.

c) Edit the "linkstate/ls.h" file, line 137 to read:

void eraseAll() { this->erase(baseMap::begin(), baseMap::end()); }

Note adding the "this->" qualification to the call to "erase()" makes the 
llvm/clang compiler happier

d) Edit the "common/TclAppInit.cc" file, deleting or commenting out line 240 
which reads "extern MemTrace *globalMemTrace;"

e) Build ns

make ns


5) Build nam using the configure command:

./configure --x-libraries=/usr/X11R6/lib --x-includes=/usr/X11R6/include 
LIBS='-framework CoreFoundation' --with-tcl-ver=8.5.10 --with-tk-ver=8.5.10 
--with-otcl=../otcl-1.14 --with-tclcl=../tclcl-1.20

make nam

At this point you have the ns and nam executables for for your simulation 
enjoyment. I also built the "dei80211" WiFi model without issue.  I am sure 
these changes can be incorporated into future ns releases for MacOSX 10.9 
builds.

best regards,

Brian Adamson

Reply via email to