[NS] changes required to build NS with gcc 3.x

Igor Sobrado sobrado@condmat1.ciencias.uniovi.es
Sat Sep 7 05:15:15 2002


Hi, NS users and maintainers!

Next changes are required when building NS (2.1b8, 2.1b9, and 2.1b9a
at least) with recent gcc releases:

file           line  recommended change
-------------  ----  ----------------------------------------------
tfrc.h         116   friend class TfrcSendTimer;
tfrc.h         117   friend class TfrcNoFeedbackTimer;
tcp-rbp.cc     72    friend class RBPVegasPaceTimer;
tcp-rbp.cc     234   friend class RBPRenoPaceTimer;
tcp-full.h     131   friend class ReassemblyQueue;
sfq.cc         52    friend class SFQ;
drr.cc         37    friend class DRR;
snoop.h        114   friend class SnoopRxmitHandler;
snoop.h        115   friend class SnoopPersistHandler;
rxmit_queue.h  61    friend class ReXmitQ;
tfrc-sink.h    74    friend class TfrcNackTimer;

A friend declaration requires class-key.  Another change is the
next one:

file           line  recommended change
-------------  ----  ----------------------------------------------
route.h        81    int elements_in_level (int *addr, int level);

This function should not be inline because it is called outside
the module when it is declared.  An inline function is replaced
by its definition when called, and gcc does not maintain a reference
to it.  That reference is required when building the ns binary.

Additionally, for ns-2.1b9 and ns-2.1b9a next changes are required:

file           line  recommended change
-------------  ----  ----------------------------------------------
queue/wss.h    76    friend class SRR
queue/srr.cc   80    friend class SRR

On the other hand, wss.h is in CR+LF format!

On those operating systems where gcc is not the native compiler
(for example Solaris) adding the -R and -L options to LIB with the
directory where libstdc++ resides is a good idea too.  LD_LIBRARY_PATH
should be avoided when possible.  For example:

   LIB = [...] -R/opt/gnu/lib -L/opt/gnu/lib [...]

I found that next change is required in Makefile even when using
Gnu make:

install-recursive: force
        for i in $(SUBDIRS); do cd $$i; $(MAKE) install; cd ../../..; done

I cannot understand why Makefile.in fails in this matter, it should
work if parenthesis are preserved.  But parenthesis are lost when
building Makefile.

Makefiles in indep-utils/ should define CC as c++, and not as gcc.
Providing information about where looking for libstdc++ (with -R
and -L) is required too.  Binaries should not depend on LD_LIBRARY_PATH
environment variable on those platforms where the native C++ library
is not libstdc++.

I am now working on the issues related with building ns and nam using
other C/C++ compilers like WorkShop.

I have build those modified binaries in both Solaris x86 and Solaris SPARC
and the new binaries works just fine, passing without problems ALL the
tests recommended by Sally Floyd on her expanded note "Simulator Tests".

Cheers,
Igor.

-- 
Igor Sobrado, UK34436 - sobrado@acm.org