Cannot run wireless example after moving it to scratch directory

989 views
Skip to first unread message

S Developer

unread,
Aug 3, 2022, 1:20:43 PM8/3/22
to ns-3-users
I'm trying to run the wifi-spatial-reuse example and making some changes in the code by moving it to the scratch directory and renaming it as wifi-spatial-reuse-edit. The original version in the examples directory works but the new one does not build and gives an error

assert failed. cond="uid != 0", msg="Assert in TypeId::LookupByName: ns3::UdpSocketFactory not found", +0.000000000s -1 file=/media/abhishek.s4/Data/Developer/ns3/source/ns-3.36.1/src/core/model/type-id.cc, line=833
terminate called without an active exception
Command 'build/scratch/ns3.36.1-wifi-spatial-reuse-edit-default' died with <Signals.SIGABRT: 6>.

Tom Henderson

unread,
Aug 3, 2022, 5:02:19 PM8/3/22
to ns-3-...@googlegroups.com
I don't know why that program is not linked to the internet module
library (I will ask Gabriel about it), but in the meantime, there is a
simple fix. Delete this statement (which is an unused variable):

TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory");

- Tom

Gabriel Ferreira

unread,
Aug 3, 2022, 5:17:16 PM8/3/22
to ns-3-users
Hmm, quite the unexpected issue popping out this late. 
I have forgotten to forcefully link unused shared libraries... 

diff --git a/scratch/CMakeLists.txt b/scratch/CMakeLists.txt
--- a/scratch/CMakeLists.txt    (revision 8bac4ffb586ef1c3ea0d5f6ee3b38519f18e4e3f)
+++ b/scratch/CMakeLists.txt    (revision 5baf7f88bbbb11c1c60071f0c1f0b981c486c919)
@@ -52,8 +52,8 @@
     )
   else()
     target_link_libraries(
-      ${target_prefix}${scratch_name} "${ns3-libs}" "${ns3-contrib-libs}"
-      "${ns3-external-libs}"
+      ${target_prefix}${scratch_name} ${LIB_AS_NEEDED_PRE} "${ns3-libs}" "${ns3-contrib-libs}"
+      "${ns3-external-libs}" ${LIB_AS_NEEDED_POST}
     )
   endif()
   set_runtime_outputdirectory(

Gabriel Ferreira

unread,
Aug 3, 2022, 5:26:54 PM8/3/22
to ns-3-users

S Developer

unread,
Aug 3, 2022, 6:29:02 PM8/3/22
to ns-3-users
Thank you Tom and Gabriel, that fixed the issue and now the script runs fine.

naish...@gmail.com

unread,
Aug 26, 2022, 4:33:43 AM8/26/22
to ns-3-users
Hello Sir,
pls let me know whether  this fix is updated in ns.3.36.1 which is available in the website? I'm still getting the error  "assert failed. cond="uid != 0", msg="Assert in TypeId::LookupByName: ns3::UdpSocketFactory not found", +0.000000000s -1 file=/media/abhishek.s4/Data/Developer/ns3/source/ns-3.36.1/src/core/model/type-id.cc, line=833

terminate called without an active exception "

And I downloaded the latest version i.e ns3.36.1 today.

Tom Henderson

unread,
Aug 26, 2022, 11:20:08 AM8/26/22
to ns-3-...@googlegroups.com
On 8/26/22 01:33, naish...@gmail.com wrote:
> Hello Sir,
> pls let me know whether  this fix is updated in ns.3.36.1 which is
> available in the website? I'm still getting the error  "assert failed.
> cond="uid != 0", msg="Assert in TypeId::LookupByName:
> ns3::UdpSocketFactory not found", +0.000000000s -1
> file=/media/abhishek.s4/Data/Developer/ns3/source/ns-3.36.1/src/core/model/type-id.cc,
> line=833
> terminate called without an active exception "
>
> And I downloaded the latest version i.e ns3.36.1 today.

That fix is not in ns-3.36.1 but it will be in ns-3.37 (planned for
September). You will have to patch ns-3.36.1 source code yourself. The
URL that Gabriel shared contains the changes necessary to make.

- Tom

naish...@gmail.com

unread,
Aug 27, 2022, 6:06:27 AM8/27/22
to ns-3-users
Thanks for the reply Sir.
Made the changes suggested by Gabriel and its working fine.
Thankyou Tom and Gabriel.

Abdelkader Gnichi

unread,
May 30, 2023, 7:25:35 AM5/30/23
to ns-3-users

i'm using ns-3.37 i have this issue below, also i try the patch provided by Gabriel and mentioned by Tom but it didn't work for me and i still have that error i copy the ofswitch13-first file to scratch and changed it name to myofswitch13-first, please if can anyone help me here i will appreciate it.
Thanks in advance.

assert failed. cond="itSrc->second == inPort", msg="Inconsistent L2 switching table", +1.004683364s 14 file=/home/gadour/source/ns-3.37/contrib/ofswitch13/model/ofswitch13-learning-controller.cc, line=148

terminate called without an active exception
Command 'build/scratch/ns3.37-myofswitch13-first-debug' died with <Signals.SIGABRT: 6>.

Tom Henderson

unread,
May 30, 2023, 8:59:27 AM5/30/23
to ns-3-...@googlegroups.com, Abdelkader Gnichi
The assert is a new problem, possibly a mis-configuration of the scenario.  I think the patch provided by Gabriel helped, but you now have a different error.  I don't know about the file 'ofswitch13-first' so it is hard to guess what might be the problem below, but the assert message is trying to give you a hint as to what may be wrong.
--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/95300f89-1958-4ac1-8cb6-bd8f2c8801fen%40googlegroups.com.


Abdelkader Gnichi

unread,
May 30, 2023, 9:14:35 AM5/30/23
to ns-3-users
Hi Tom i'am so thankful for your response
actually i try to rename the file with it's original name but the same error still showing up i think that i made a mistake with the scenario but i'm not sure where the problem came from can i please send you the code maybe you can help me ?
i made some changes on the original code i put 7 nodes (as client) and 7 node as ofswitche13 switches switches and i set up the ping app betwen the first and last clients  nodes. 

Tom Henderson

unread,
May 30, 2023, 9:20:43 AM5/30/23
to ns-3-...@googlegroups.com, Abdelkader Gnichi
I can try to help but please do not email me (or the list) a bunch of
files to add to ns-3.  If you want help, please post a branch on GitLab
or GitHub on a repository that I can clone, and please tell me exactly
how to run the program to reproduce the error.  In other words, you
should be able to tell me:

1) clone the following repository ...
2) checkout the following branch ...
3) run the following program exactly like this ...

Note, this is a general piece of advice in getting help from one of the
maintainers for issues like this-- please make it easy for us to set up
your environment.

Abdelkader Gnichi

unread,
May 30, 2023, 10:00:52 AM5/30/23
to ns-3-users
Hi Tom i upload the script here in this link https://github.com/Abdelkader-gnichi/myofswitch13-first on github.
In the readme.md file you will find all the necessary steps to run the myofswitch-first.cc file and reproduce the error. 
thank you in advance Mr Tom i really appreciate it.

Abdelkader Gnichi

unread,
Jun 3, 2023, 10:13:51 AM6/3/23
to ns-3-users
Hi Tom,
did you try to run my script that i put it on github i really wait your response about that script because until now i'm not able to find the error.
and thanks

Message has been deleted

Tommaso Pecorella

unread,
Sep 16, 2023, 6:46:59 PM9/16/23
to ns-3-users
I'd strongly suggest to:
1) Read the posting guidelines
2) Do not reply to random threads - the chances to be ignored are extremely high (also because ppl get angry and they don't reply when they're angry)
3) Learn to use a debugger.
4) Repeat points 1, 2, and 3 until you understand.
5) Repeat points 1, 2, and 3 once more, just to be sure.

About your error, I did find it right away, but I won't tell you exactly where it is - because... see point 1.
However, I *will* tell you that you forgot to create the wifi channel. So, basically... you have also to learn to copy the examples without missing pieces.
On Saturday, 16 September 2023 at 21:53:33 UTC+2 rawane...@gmail.com wrote:
hello everyone i have this error i can't fix it 

[0/2] Re-checking globbed directories...
ninja: no work to do.
NS_ASSERT failed, cond="m_ptr", msg="Attempted to dereference zero pointer", +0.000000000s -1 file=/home/raouane/ns-allinone-3.38/ns-3.38/src/core/model/ptr.h, line=752
NS_FATAL, terminating

terminate called without an active exception
Command 'build/scratch/ns3.38-examreti-default' died with <Signals.SIGABRT: 6>.


Reply all
Reply to author
Forward
0 new messages