How to fix this issue

360 views
Skip to first unread message

Burke Geceyatmaz

unread,
Sep 13, 2023, 6:12:42 PM9/13/23
to Network Simulator 2 (NS2)
tcp/tcp-fack.cc:302:22: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
  302 |         register int found, npacket = 0;
      |                      ^~~~~
tcp/tcp-fack.cc:302:29: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
  302 |         register int found, npacket = 0;
      |                             ^~~~~~~
In file included from /usr/include/c++/12/bits/specfun.h:45,
                 from /usr/include/c++/12/cmath:1935,
                 from /usr/include/c++/12/math.h:36,
                 from ./tools/random.h:40,
                 from tcp/tcp-fack.cc:33:
/usr/include/c++/12/bits/stl_algobase.h: In instantiation of ‘constexpr const _Tp& std::max(const _Tp&, const _Tp&) [with _Tp = TracedInt]’:
tcp/tcp-fack.cc:87:15:   required from here
/usr/include/c++/12/bits/stl_algobase.h:259:15: error: no match for ‘operator<’ (operand types are ‘const TracedInt’ and ‘const TracedInt’)
  259 |       if (__a < __b)
      |           ~~~~^~~~~
/usr/include/c++/12/bits/stl_algobase.h:259:15: note: candidate: ‘operator<(int, int)’ (built-in)
/usr/include/c++/12/bits/stl_algobase.h:259:15: note:   conversion of argument 2 would be ill-formed:
/usr/include/c++/12/bits/stl_algobase.h:259:15: error: passing ‘const TracedInt’ as ‘this’ argument discards qualifiers [-fpermissive]
In file included from /home/bg/ns-allinone-2.34/tclcl-1.19/tclcl.h:48,
                 from ./config.h:60,
                 from ./common/ip.h:41,
                 from tcp/tcp-fack.cc:29:
/home/bg/ns-allinone-2.34/tclcl-1.19/tracedvar.h:94:16: note:   in call to ‘TracedInt::operator int()’
   94 |         inline operator int() { return val_; }
      |                ^~~~~~~~
In file included from /usr/include/c++/12/bits/stl_algobase.h:64:
/usr/include/c++/12/bits/stl_pair.h:663:5: note: candidate: ‘template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)’
  663 |     operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
      |     ^~~~~~~~
/usr/include/c++/12/bits/stl_pair.h:663:5: note:   template argument deduction/substitution failed:
/usr/include/c++/12/bits/stl_algobase.h:259:15: note:   ‘const TracedInt’ is not derived from ‘const std::pair<_T1, _T2>’
  259 |       if (__a < __b)
      |           ~~~~^~~~~
In file included from /usr/include/c++/12/bits/stl_algobase.h:67:
/usr/include/c++/12/bits/stl_iterator.h:451:5: note: candidate: ‘template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)’
  451 |     operator<(const reverse_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/12/bits/stl_iterator.h:451:5: note:   template argument deduction/substitution failed:
/usr/include/c++/12/bits/stl_algobase.h:259:15: note:   ‘const TracedInt’ is not derived from ‘const std::reverse_iterator<_Iterator>’
  259 |       if (__a < __b)
      |           ~~~~^~~~~
/usr/include/c++/12/bits/stl_iterator.h:496:5: note: candidate: ‘template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)’
  496 |     operator<(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/12/bits/stl_iterator.h:496:5: note:   template argument deduction/substitution failed:
/usr/include/c++/12/bits/stl_algobase.h:259:15: note:   ‘const TracedInt’ is not derived from ‘const std::reverse_iterator<_Iterator>’
  259 |       if (__a < __b)
      |           ~~~~^~~~~
/usr/include/c++/12/bits/stl_iterator.h:1683:5: note: candidate: ‘template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)’
 1683 |     operator<(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/12/bits/stl_iterator.h:1683:5: note:   template argument deduction/substitution failed:
/usr/include/c++/12/bits/stl_algobase.h:259:15: note:   ‘const TracedInt’ is not derived from ‘const std::move_iterator<_IteratorL>’
  259 |       if (__a < __b)
      |           ~~~~^~~~~
/usr/include/c++/12/bits/stl_iterator.h:1748:5: note: candidate: ‘template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)’
 1748 |     operator<(const move_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/12/bits/stl_iterator.h:1748:5: note:   template argument deduction/substitution failed:
/usr/include/c++/12/bits/stl_algobase.h:259:15: note:   ‘const TracedInt’ is not derived from ‘const std::move_iterator<_IteratorL>’
  259 |       if (__a < __b)
      |           ~~~~^~~~~
make: *** [Makefile:94: tcp/tcp-fack.o] Error 1
Ns make failed!

knudfl

unread,
Sep 13, 2023, 6:51:12 PM9/13/23
to Network Simulator 2 (NS2)
You are using the wrong gcc/g++ compiler.   There is no way gcc-12 / g++-12 can be used for ns2.

REPEAT
If you are building ns-allinone-2.34/ ,  the build command is 
export CC=gcc-4.8 CXX=g++-4.8 && ./install           (ns234_gcc49.patch must be applied beforehand)

If you are modifying ns-2.34/ ,  the build command  is
export CC=gcc-4.8 CXX=g++-4.8 && ./configure && make
___________________________

ns-allinone-2.35 :  export CC=gcc-4.8 CXX=g++-4.8 && ./install
Modifying ns-2.35 :  
Then you will have to use the same command = export CC=gcc-4.8 CXX=g++-4.8 && ./install
.... in the top directory ns-allinone-2.35/
I.e. the install command takes care of all 'make clean && ./configure && make'

Filippos Papadopoulos

unread,
Sep 15, 2024, 7:05:01 AM9/15/24
to Network Simulator 2 (NS2)
I am on a Fedora 40 Linux having g++ version 14.x
and export CC=gcc-4.8 CXX=g++-4.8
doesn't help (there is no gcc version 4.8)

What worked for me was to still use the default gcc compiler (version 14) but add some extra flags in the Makefile of ns source code (inside ns-2.35/) :
CCOPT = -Wall -Wno-write-strings -std=c++98 -fpermissive -Wno-unused-variable -Wno-unused-parameter -Wno-deprecated -Wno-error

knudfl

unread,
Sep 16, 2024, 8:12:00 AM9/16/24
to Network Simulator 2 (NS2)
@Filippos Papadopoulos

Nice work !
I don't have that knowledge about using gcc 14, so I would just have suggested my home made gcc48-c++-4.8.5-1.el6.x86_64.rpm or gcc53-c++-5.3.0-1.el6.x86_64.rpm
..... As I have the most main Linux operational systems, all versions, installed,  I used to build any gcc version asked for.


-

DIÓGENES ANTÔNIO MARQUES JOSÉ

unread,
Sep 18, 2024, 4:46:22 PM9/18/24
to ns-u...@googlegroups.com
I solved this error in this form:
d. NEW Error in Linux Mint and Derivatives (ERROR /usr/include/c++/11/bits/stl_algobase.h)

This error happens after updating Linux Mint 21 or downloading an updated version directly
from the official website: http://https://www.linuxmint.com/download.php. For example,
when compiling NS-2 in this new version of Linux Mint, the following error will appear:
1 - /usr/include/c++/11/bits/stl_algobase.h:259:15: error: no match

for ‘operator<’ (operand types are ‘const TracedInt’ and ‘const
TracedInt’) 259 | if (__a < __b)
This happens because, after updating OS, the library /usr/include/c++/11/bits/
stl_algobase.h receives functions max() and min() that have the same function names
used by the TCP protocol in NS-2. The affected files are located within the folders
∼/ns-allinone-2.34/ns-2.34/tcp: template.h, tcp-asym-sink.cc, tcp-asym.cc,
tcp-full.cc, tcp-linux.cc, tcp-session.cc, chost.cc, ack-recons.cc, and
snoop.h; ∼/ns-allinone-2.34/ns-2.34/baytcp/: tcp-full-bay.cc; ∼/ns-allinone-
2.34/ns-2.34/rap/: media-app.cc; and ∼/ns-allinone-2.34/ns-2.34/queue/: red.cc.
Error Solution in Linux Mint and Derivatives:
Open the following files: template.h, tcp-asym-sink.cc, tcp-asym.cc,
tcp-full.cc, tcp-linux.cc, tcp-session.cc, chost.cc, ack-recons.cc,
snoop.h, tcp-full-bay.cc, media-app.cc, and red.cc (e.g. located in
~/ns-allinone-2.34/ns-2.34/tcp; ~/ns-allinone-2.34/ns-2.34/baytcp/,
~/ns-allinone-2.34/ns-2.34/rap/, and ~/ns-allinone-2.34/ns-2.34/queue/)
and replace the max() and min() functions with max_( ) min_(). Ex:
Replace max(latest_susp_loss, cur->sessionSeqno_) with max_(latest_susp
_loss, cur->sessionSeqno_).
After making all the substitutions, recompile NS-2 and the problem will be solved;

Link for files already modified: https://github.com/dioxfile/ns-2.34-allinone

If you like this solution, look at my book about NS-2 here: https://www.amazon.com/dp/B0DC49FBSF

--
You received this message because you are subscribed to the Google Groups "Network Simulator 2 (NS2)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-users+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-users/77081ca1-cd45-45a3-b1d3-cd236aafe92bn%40googlegroups.com.

Hameurlaine Hicham

unread,
Oct 17, 2024, 11:28:30 AM10/17/24
to Network Simulator 2 (NS2)
make: *** [Makefile:94: tcp/tcp-fack.o] Error 1
when i use make i get this , can any one help ? 
@knudfl please

knudfl

unread,
Oct 18, 2024, 1:01:58 PM10/18/24
to Network Simulator 2 (NS2)
...  hichamham ......
Quote:  " Makefile:94: tcp/tcp-fack.o] Error 1"

?? Did you do any modifications / edits to tcp-fack.cc  or any other tcp related file / ns2 addition ?
Please describe what you are doing.
-

Diógenes José

unread,
Oct 18, 2024, 5:05:27 PM10/18/24
to ns-u...@googlegroups.com
Please zip your NS-2 and send it to me. I will try fix it.

--
You received this message because you are subscribed to the Google Groups "Network Simulator 2 (NS2)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-users+u...@googlegroups.com.


--
Professor Me. Diógenes Antonio Marques José
UNEMAT - Barra do Bugres
Fone: 65 99465280
Fone Institucional (UNEMAT): 65 3361-1413 ramal 205 (CCC)

Hameurlaine Hicham

unread,
Oct 19, 2024, 3:09:46 AM10/19/24
to ns-u...@googlegroups.com
Thanks, it s ok. I applied your commands in previous post. Thanks & Regards

--

Hameurlaine Hicham

unread,
Oct 19, 2024, 3:10:12 AM10/19/24
to ns-u...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages