Real time Simulator on Mac OS

167 views
Skip to first unread message

sibsutispds

unread,
Jan 23, 2020, 11:01:34 AM1/23/20
to ns-3-users
Hello!

I'm running Mac OS X 10.15 (Catalina) and would like to use Real time scheduler in my simulations. However, I can't enable RealTime simulation feature:

Real Time Simulator           : not enabled (librt is not available)


I understand that this is the consequence of the missing rt library. As I understood, rt is not available on Mac. Do you know if one really needs rt to build ns3 realtime simulator or can we build without it on mac? Is there any possible workaround you aware of so I could use realtime scheduler on Mac os?

Thank you, guys, in advance for help!

Have a good evening!

Regards, Nikita.   

 

sibsutispds

unread,
Jan 27, 2020, 9:05:43 AM1/27/20
to ns-3-users
Hello!

If someone is facing this problem, here's the solution worked for me.

Realtime simulator on linux require to be linked against librt. However, on MacOS you don't need rt, since sys/time.h is part of default command line tools (at least on 10.15 Catalina). 
So, you don't need to link against, thus, in the core module's src/core/wscript where the check if librt is linked is performed (around line 145):

if not conf.check_nonfatal(lib='rt', uselib='RT, PTHREAD', define_name='HAVE_RT'):
        conf
.report_optional_feature("RealTime", "Real Time Simulator",
                                     
False, "librt is not available")
   
else:
        conf
.report_optional_feature("RealTime", "Real Time Simulator",
                                     conf
.env['ENABLE_THREADING'],
                                     
"threading not enabled")
        conf
.env["ENABLE_REAL_TIME"] = conf.env['ENABLE_THREADING']

 one could either remove check and always enable Enable realtime module or introduce additional check and condition for the OS.

Hope this will be helpful to someone.

/Nikita
Reply all
Reply to author
Forward
0 new messages