YunLambert / ns3-sumo-control

sumo和ns3之间进行通信的框架(通过ns3控制sumo)
19 stars 5 forks source link

The project cannot be run #1

Closed LanxiangC2 closed 3 years ago

LanxiangC2 commented 3 years ago

I can run the original author's code, but you can't, which makes me confused

YunLambert commented 3 years ago

Could you show me your error log, so i can find what is the error?

LanxiangC2 commented 3 years ago

Could you show me your error log, so i can find what is the error? Thank you for your reply. I will upload error later!

LanxiangC2 commented 3 years ago

I copy the two folders to the /src directory according to the method you said. There is an error when compiling. The error is as follows

../src/traci-applications/model/sumo-ns3-control-util.cc:1:9: error: #pragma once in main file [-Werror]
 #pragma once
         ^
cc1plus: all warnings being treated as errors

../src/traci-applications/examples/ns3-sumo-coupling-simple.cc: In function ‘int main(int, char**)’:
../src/traci-applications/examples/ns3-sumo-coupling-simple.cc:92:3: error: ‘RsuSpeedControlHelper’ was not declared in this scope
   RsuSpeedControlHelper rsuSpeedControlHelper (9); // Port #9
   ^
../src/traci-applications/examples/ns3-sumo-coupling-simple.cc:93:3: error: ‘rsuSpeedControlHelper’ was not declared in this scope
   rsuSpeedControlHelper.SetAttribute ("Velocity", UintegerValue (30));           // initial velocity value which is sent to vehicles
   ^
../src/traci-applications/examples/ns3-sumo-coupling-simple.cc:106:3: error: ‘VehicleSpeedControlHelper’ was not declared in this scope
   VehicleSpeedControlHelper vehicleSpeedControlHelper (9);
   ^
../src/traci-applications/examples/ns3-sumo-coupling-simple.cc:107:3: error: ‘vehicleSpeedControlHelper’ was not declared in this scope
   vehicleSpeedControlHelper.SetAttribute ("Client", (PointerValue) sumoClient); // pass TraciClient object for accessing sumo in application
   ^

Waf: Leaving directory `/home/hlc/tarballs/ns-allinone-3.28/ns-3.28/build'
Build failed
 -> task in 'ns3-traci-applications' failed (exit status 1): 
    {task 139950971930320: cxx sumo-ns3-control-util.cc -> sumo-ns3-control-util.cc.1.o}
['/usr/bin/g++', '-O0', '-ggdb', '-g3', '-Wall', '-Werror', '-std=c++11', '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wstrict-aliasing', '-fPIC', '-pthread', '-pthread', '-I.', '-I..', '-I/usr/include/gtk-2.0', '-I/usr/lib/x86_64-linux-gnu/gtk-2.0/include', '-I/usr/include/gio-unix-2.0', '-I/usr/include/cairo', '-I/usr/include/pango-1.0', '-I/usr/include/atk-1.0', '-I/usr/include/pixman-1', '-I/usr/include/libpng12', '-I/usr/include/gdk-pixbuf-2.0', '-I/usr/include/harfbuzz', '-I/usr/include/glib-2.0', '-I/usr/lib/x86_64-linux-gnu/glib-2.0/include', '-I/usr/include/freetype2', '-I/usr/include/libxml2', '-DNS3_BUILD_PROFILE_DEBUG', '-DNS3_ASSERT_ENABLE', '-DNS3_LOG_ENABLE', '-DHAVE_SYS_IOCTL_H=1', '-DHAVE_IF_NETS_H=1', '-DHAVE_NET_ETHERNET_H=1', '-DHAVE_PACKET_H=1', '-DHAVE_IF_TUN_H=1', '-DHAVE_GSL=1', '-DHAVE_SQLITE3=1', '-DHAVE_GTK2=1', '-DHAVE_LIBXML2=1', '../src/traci-applications/model/sumo-ns3-control-util.cc', '-c', '-o', '/home/hlc/tarballs/ns-allinone-3.28/ns-3.28/build/src/traci-applications/model/sumo-ns3-control-util.cc.1.o']
 -> task in 'ns3-sumo-coupling-simple' failed (exit status 1): 
    {task 139950968109328: cxx ns3-sumo-coupling-simple.cc -> ns3-sumo-coupling-simple.cc.1.o}
['/usr/bin/g++', '-O0', '-ggdb', '-g3', '-Wall', '-Werror', '-std=c++11', '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wstrict-aliasing', '-pthread', '-pthread', '-I.', '-I..', '-I/usr/include/gtk-2.0', '-I/usr/lib/x86_64-linux-gnu/gtk-2.0/include', '-I/usr/include/gio-unix-2.0', '-I/usr/include/cairo', '-I/usr/include/pango-1.0', '-I/usr/include/atk-1.0', '-I/usr/include/pixman-1', '-I/usr/include/libpng12', '-I/usr/include/gdk-pixbuf-2.0', '-I/usr/include/harfbuzz', '-I/usr/include/glib-2.0', '-I/usr/lib/x86_64-linux-gnu/glib-2.0/include', '-I/usr/include/freetype2', '-I/usr/include/libxml2', '-DNS3_BUILD_PROFILE_DEBUG', '-DNS3_ASSERT_ENABLE', '-DNS3_LOG_ENABLE', '-DHAVE_SYS_IOCTL_H=1', '-DHAVE_IF_NETS_H=1', '-DHAVE_NET_ETHERNET_H=1', '-DHAVE_PACKET_H=1', '-DHAVE_IF_TUN_H=1', '-DHAVE_GSL=1', '-DHAVE_SQLITE3=1', '-DHAVE_GTK2=1', '-DHAVE_LIBXML2=1', '../src/traci-applications/examples/ns3-sumo-coupling-simple.cc', '-c', '-o', '/home/hlc/tarballs/ns-allinone-3.28/ns-3.28/build/src/traci-applications/examples/ns3-sumo-coupling-simple.cc.1.o']
YunLambert commented 3 years ago

r: ‘RsuSpeedControlHelper’

Maybe you can try reconfigure ns3 like this:

If you don't know how to run in the scratch:

If still not work, plz let me know

LanxiangC2 commented 3 years ago

OK,I'll try it later,thanks. 

---Original--- From: "YUN"<notifications@github.com> Date: Wed, Jan 6, 2021 15:49 PM To: "YunLambert/ns3-sumo-control"<ns3-sumo-control@noreply.github.com>; Cc: "LanxiangC2"<815505781@qq.com>;"Author"<author@noreply.github.com>; Subject: Re: [YunLambert/ns3-sumo-control] The project cannot be run (#1)

r: ‘RsuSpeedControlHelper’

Maybe you can try reconfigure ns3 like this:

"CXXFLAGS="-std=c++11" ./waf configure --disable-tests --disable-examples --disable-python"

"./waf build"

And then try to run the test file in the scratch.

If you don't know how to run in the scratch:

Move the test file to the "ns3/scratch/" directory : "cp src/traci-applications/examples/line-test.cc scratch/"

Enter the scratch directory: " cd scratch"

Run: "../waf --run line-test"

If still not work, plz let me know

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

LanxiangC2 commented 3 years ago

According to the method you said, an error was reported when running "./waf --run line-test".The error is as follows.

Waf: Entering directory `/home/hlc/tarballs/ns-allinone-3.28/ns-3.28/build'
[ 905/1863] Compiling scratch/line-test.cc
[1848/1863] Linking build/scratch/scratch-simulator
[1852/1863] Linking build/scratch/line-test
Waf: Leaving directory `/home/hlc/tarballs/ns-allinone-3.28/ns-3.28/build'
Build commands will be stored in build/compile_commands.json
'build' finished successfully (2.766s)
sh: 1: /usr/bin/sumo-gui: not found
Sumo: wait for socket: 1s
msg="Can not connect to sumo via traci: tcpip::Socket::connect() @ connect: Connection refused", file=../src/traci/model/traci-client.cc, line=256
terminate called after throwing an instance of 'tcpip::SocketException'
  what():  tcpip::Socket::connect() @ connect: Connection refused
Command ['/home/hlc/tarballs/ns-allinone-3.28/ns-3.28/build/scratch/line-test'] terminated with signal SIGIOT. Run it under a debugger to get more information (./waf --run <program> --command-template="gdb --args %s <args>").
YunLambert commented 3 years ago

It seems like the program has no compile-error, Only "the sumo-gui program is not found". So you should go check where your sumo-gui is or is your sumo-gui installed correctly.

In the line-test.cc:

sumoClient->SetAttribute ("SumoBinaryPath", StringValue (""));    // use system installation of sumo
sumoClient->SetAttribute ("SumoGUI", BooleanValue (false));

can set sumo and sumo-gui options.

Since you said original author's code runs fine, maybe it's line-test.cc's sumo binary path problem.