Failed to install Otcl-1.14 for NS-2

2.3k Views Asked by At

I'm trying to install NS-2 on Mac OS X 10.9.x Mavericks with ns-allinone

Everytime I run the install script, it fails in a step installing Otcl with the errors:

rm -f libotcl otcl.o so_locations
gcc -c -g -O2 -DNDEBUG -DUSE_SHM -DHAVE_UNISTD_H=1 -fPIC -I. -I/Users/songsong/Downloads/ns-allinone-2.35/include -I/Users/songsong/Downloads/ns-allinone-2.35/include -I/Users/songsong/Downloads/ns-allinone-2.35/include -I/usr/X11R6/include -I/include  otcl.c
otcl.c:784:14: warning: cast to 'Proc *' (aka 'struct Proc *') from smaller
      integer type 'int' [-Wint-to-pointer-cast]
      return Tcl_CmdInfoGetProc(co);
             ^
otcl.c:74:32: note: expanded from macro 'Tcl_CmdInfoGetProc'
#define Tcl_CmdInfoGetProc(co) (Proc *)(co->isNativeObjectProc) ? co->ob...
                               ^
1 warning generated.
o libotcl otcl.o
make: o: No such file or directory
make: [libotcl] Error 1 (ignored)
rm -f libotcl
gcc -o otclsh  -g -O2 -I. -I/Users/songsong/Downloads/ns-allinone-2.35/include -I/Users/songsong/Downloads/ns-allinone-2.35/include -I/Users/songsong/Downloads/ns-allinone-2.35/include -I/usr/X11R6/include -I/include  otclAppInit.c \
    -L. -lotcl -L/Users/songsong/Downloads/ns-allinone-2.35/lib -ltk8.5 -L/Users/songsong/Downloads/ns-allinone-2.35/lib -ltcl8.5 -L/usr/X11R6/lib -lXext -lX11  -lm
Undefined symbols for architecture x86_64:
  "_CFAbsoluteTimeGetCurrent", referenced from:
      _Tcl_SetTimer in libtcl8.5.a(tclMacOSXNotify.o)
      _Tcl_ServiceModeHook in libtcl8.5.a(tclMacOSXNotify.o)
      _Tcl_Sleep in libtcl8.5.a(tclMacOSXNotify.o)
  "_CFBundleCopyBundleURL", referenced from:
      _Tcl_MacOSXOpenVersionedBundleResources in libtcl8.5.a(tclMacOSXBundle.o)
  "_CFBundleCopyResourceURL", referenced from:
      _Tcl_MacOSXOpenVersionedBundleResources in libtcl8.5.a(tclMacOSXBundle.o)
  "_CFBundleCreate", referenced from:
      _Tcl_MacOSXOpenVersionedBundleResources in libtcl8.5.a(tclMacOSXBundle.o)
  "_CFBundleGetBundleWithIdentifier", referenced from:
      _Tcl_MacOSXOpenVersionedBundleResources in libtcl8.5.a(tclMacOSXBundle.o)
  "_CFLocaleCopyCurrent", referenced from:
      _TclpSetVariables in libtcl8.5.a(tclUnixInit.o)
  "_CFLocaleGetIdentifier", referenced from:
      _TclpSetVariables in libtcl8.5.a(tclUnixInit.o)
  "_CFRelease", referenced from:
      _Tcl_FinalizeNotifier in libtcl8.5.a(tclMacOSXNotify.o)
      _TclpSetVariables in libtcl8.5.a(tclUnixInit.o)
      _Tcl_MacOSXOpenVersionedBundleResources in libtcl8.5.a(tclMacOSXBundle.o)
  "_CFRunLoopAddObserver", referenced from:
      _Tcl_InitNotifier in libtcl8.5.a(tclMacOSXNotify.o)
      _TclMacOSXNotifierAddRunLoopMode in libtcl8.5.a(tclMacOSXNotify.o)
  "_CFRunLoopAddSource", referenced from:
      _Tcl_InitNotifier in libtcl8.5.a(tclMacOSXNotify.o)
      _TclMacOSXNotifierAddRunLoopMode in libtcl8.5.a(tclMacOSXNotify.o)
  "_CFRunLoopAddTimer", referenced from:
      _TclMacOSXNotifierAddRunLoopMode in libtcl8.5.a(tclMacOSXNotify.o)
      _Tcl_ServiceModeHook in libtcl8.5.a(tclMacOSXNotify.o)
  "_CFRunLoopGetCurrent", referenced from:
      _Tcl_InitNotifier in libtcl8.5.a(tclMacOSXNotify.o)
  "_CFRunLoopObserverCreate", referenced from:
      _Tcl_InitNotifier in libtcl8.5.a(tclMacOSXNotify.o)
  "_CFRunLoopObserverInvalidate", referenced from:
      _Tcl_FinalizeNotifier in libtcl8.5.a(tclMacOSXNotify.o)
  "_CFRunLoopRunInMode", referenced from:
      _Tcl_WaitForEvent in libtcl8.5.a(tclMacOSXNotify.o)
      _Tcl_Sleep in libtcl8.5.a(tclMacOSXNotify.o)
  "_CFRunLoopSourceCreate", referenced from:
      _Tcl_InitNotifier in libtcl8.5.a(tclMacOSXNotify.o)
  "_CFRunLoopSourceInvalidate", referenced from:
      _Tcl_FinalizeNotifier in libtcl8.5.a(tclMacOSXNotify.o)
  "_CFRunLoopSourceSignal", referenced from:
      _Tcl_AlertNotifier in libtcl8.5.a(tclMacOSXNotify.o)
      _NotifierThreadProc in libtcl8.5.a(tclMacOSXNotify.o)
  "_CFRunLoopTimerCreate", referenced from:
      _Tcl_ServiceModeHook in libtcl8.5.a(tclMacOSXNotify.o)
  "_CFRunLoopTimerGetNextFireDate", referenced from:
      _Tcl_Sleep in libtcl8.5.a(tclMacOSXNotify.o)
  "_CFRunLoopTimerInvalidate", referenced from:
      _Tcl_FinalizeNotifier in libtcl8.5.a(tclMacOSXNotify.o)
  "_CFRunLoopTimerSetNextFireDate", referenced from:
      _Tcl_SetTimer in libtcl8.5.a(tclMacOSXNotify.o)
      _Tcl_Sleep in libtcl8.5.a(tclMacOSXNotify.o)
  "_CFRunLoopWakeUp", referenced from:
      _Tcl_AlertNotifier in libtcl8.5.a(tclMacOSXNotify.o)
      _NotifierThreadProc in libtcl8.5.a(tclMacOSXNotify.o)
  "_CFStringCompare", referenced from:
      _Tcl_MacOSXOpenVersionedBundleResources in libtcl8.5.a(tclMacOSXBundle.o)
  "_CFStringCreateWithCString", referenced from:
      _Tcl_MacOSXOpenVersionedBundleResources in libtcl8.5.a(tclMacOSXBundle.o)
  "_CFStringGetCString", referenced from:
      _TclpSetVariables in libtcl8.5.a(tclUnixInit.o)
  "_CFURLCopyLastPathComponent", referenced from:
      _Tcl_MacOSXOpenVersionedBundleResources in libtcl8.5.a(tclMacOSXBundle.o)
  "_CFURLCreateCopyAppendingPathComponent", referenced from:
      _Tcl_MacOSXOpenVersionedBundleResources in libtcl8.5.a(tclMacOSXBundle.o)
  "_CFURLGetFileSystemRepresentation", referenced from:
      _Tcl_MacOSXOpenVersionedBundleResources in libtcl8.5.a(tclMacOSXBundle.o)
  "___CFConstantStringClassReference", referenced from:
      CFString in libtcl8.5.a(tclMacOSXNotify.o)
      CFString in libtcl8.5.a(tclMacOSXBundle.o)
      CFString in libtcl8.5.a(tclMacOSXBundle.o)
  "_kCFRunLoopCommonModes", referenced from:
      _Tcl_InitNotifier in libtcl8.5.a(tclMacOSXNotify.o)
      _Tcl_ServiceModeHook in libtcl8.5.a(tclMacOSXNotify.o)
  "_kCFRunLoopDefaultMode", referenced from:
      _Tcl_WaitForEvent in libtcl8.5.a(tclMacOSXNotify.o)
      _Tcl_Sleep in libtcl8.5.a(tclMacOSXNotify.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [otclsh] Error 1
2

There are 2 best solutions below

1
On

I found that CF in _CF* things does mean CoreFoundation Framework (might be a part of Xcode) And the installer doesn't recognize it.

Thus, I put -framework CoreFoundation to $CFLAGS in Makefile

If you run ./configure before make, Makefile will be modified and your modification will be lost. In that case, replace CFLAGS="-g -O2" with CFLAGS="-g -O2 -framework CoreFoundation" in ./configure

0
On

In the otcl directory in the configure exe file change this

if test "$GCC" = yes; then CFLAGS="-g -O2"

to this

if test "$GCC" = yes; then CFLAGS="-g -O2 -framework CoreFoundation"