Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation error: ‘ns3_ai_gym’ namespace not found in ns3-ai-gym-interface.cc #106

Open
jixiaofeng1999 opened this issue Dec 12, 2023 · 3 comments

Comments

@jixiaofeng1999
Copy link

Hello,

I'm encountering a compilation issue when trying to build a project that includes the NS3 AI . The compiler is unable to find the ns3_ai_gym namespace, which should be generated from a protobuf file. Below is the error output when trying to compile with CMake and Ninja:

FAILED: contrib/ai/CMakeFiles/libai-obj.dir/model/gym-interface/cpp/ns3-ai-gym-interface.cc.o
/usr/bin/ccache /usr/bin/c++ -DEIGEN_MPL2_ONLY -DHAVE_EIGEN3 -DHAVE_GSL -DHAVE_LIBXML2 -DHAVE_SQLITE3 -DHAVE_STDINT_H -DNS3_ASSERT_ENABLE -DNS3_BUILD_PROFILE_DEBUG -DNS3_LOG_ENABLE -DPROJECT_SOURCE_PATH="/home/ji/ns-allinone-3.38/ns-3.38" -D__LINUX__ -I/usr -I/home/ji/ns-allinone-3.38/ns-3.38/build/include -I/usr/include/eigen3 -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gtk-3.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/atk-1.0 -I/usr/include/libxml2 -I/usr/include/python3.10 -g -fPIC -fno-semantic-interposition -fdiagnostics-color=always -Wall -Werror -Wno-error=deprecated-declarations -std=gnu++17 -Winvalid-pch -include /home/ji/ns-allinone-3.38/ns-3.38/cmake-build-debug/CMakeFiles/stdlib_pch-debug.dir/cmake_pch.hxx -MD -MT contrib/ai/CMakeFiles/libai-obj.dir/model/gym-interface/cpp/ns3-ai-gym-interface.cc.o -MF contrib/ai/CMakeFiles/libai-obj.dir/model/gym-interface/cpp/ns3-ai-gym-interface.cc.o.d -o contrib/ai/CMakeFiles/libai-obj.dir/model/gym-interface/cpp/ns3-ai-gym-interface.cc.o -c /home/ji/ns-allinone-3.38/ns-3.38/contrib/ai/model/gym-interface/cpp/ns3-ai-gym-interface.cc
/home/ji/ns-allinone-3.38/ns-3.38/contrib/ai/model/gym-interface/cpp/ns3-ai-gym-interface.cc: In member function ‘void ns3::OpenGymInterface::Init()’:
/home/ji/ns-allinone-3.38/ns-3.38/contrib/ai/model/gym-interface/cpp/ns3-ai-gym-interface.cc:89:5: error: ‘ns3_ai_gym’ has not been declared
89 | ns3_ai_gym::SimInitMsg simInitMsg;
| ^~~~~~~~~~
/home/ji/ns-allinone-3.38/ns-3.38/contrib/ai/model/gym-interface/cpp/ns3-ai-gym-interface.cc:92:9: error: ‘ns3_ai_gym’ has not been declared
92 | ns3_ai_gym::SpaceDescription spaceDesc;
| ^~~~~~~~~~
/home/ji/ns-allinone-3.38/ns-3.38/contrib/ai/model/gym-interface/cpp/ns3-ai-gym-interface.cc:93:9: error: ‘spaceDesc’ was not declared in this scope
93 | spaceDesc = obsSpace->GetSpaceDescription();
| ^~~~~~~~~
/home/ji/ns-allinone-3.38/ns-3.38/contrib/ai/model/gym-interface/cpp/ns3-ai-gym-interface.cc:94:9: error: ‘simInitMsg’ was not declared in this scope
94 | simInitMsg.mutable_obsspace()->CopyFrom(spaceDesc);
| ^~~~~~~~~~
/home/ji/ns-allinone-3.38/ns-3.38/contrib/ai/model/gym-interface/cpp/ns3-ai-gym-interface.cc:98:9: error: ‘ns3_ai_gym’ has not been declared
98 | ns3_ai_gym::SpaceDescription spaceDesc;
| ^~~~~~~~~~
/home/ji/ns-allinone-3.38/ns-3.38/contrib/ai/model/gym-interface/cpp/ns3-ai-gym-interface.cc:99:9: error: ‘spaceDesc’ was not declared in this scope
99 | spaceDesc = actionSpace->GetSpaceDescription();
| ^~~~~~~~~
/home/ji/ns-allinone-3.38/ns-3.38/contrib/ai/model/gym-interface/cpp/ns3-ai-gym-interface.cc:100:9: error: ‘simInitMsg’ was not declared in this scope
100 | simInitMsg.mutable_actspace()->CopyFrom(spaceDesc);
| ^~~~~~~~~~
/home/ji/ns-allinone-3.38/ns-3.38/contrib/ai/model/gym-interface/cpp/ns3-ai-gym-interface.cc:109:45: error: ‘simInitMsg’ was not declared in this scope
109 | msgInterface->GetCpp2PyStruct()->size = simInitMsg.ByteSizeLong();
| ^~~~~~~~~~
/home/ji/ns-allinone-3.38/ns-3.38/contrib/ai/model/gym-interface/cpp/ns3-ai-gym-interface.cc:116:5: error: ‘ns3_ai_gym’ has not been declared
116 | ns3_ai_gym::SimInitAck simInitAck;
| ^~~~~~~~~~
/home/ji/ns-allinone-3.38/ns-3.38/contrib/ai/model/gym-interface/cpp/ns3-ai-gym-interface.cc:118:5: error: ‘simInitAck’ was not declared in this scope
118 | simInitAck.ParseFromArray(msgInterface->GetPy2CppStruct()->buffer,
| ^~~~~~~~~~
/home/ji/ns-allinone-3.38/ns-3.38/contrib/ai/model/gym-interface/cpp/ns3-ai-gym-interface.cc: In member function ‘void ns3::OpenGymInterface::NotifyCurrentState()’:
/home/ji/ns-allinone-3.38/ns-3.38/contrib/ai/model/gym-interface/cpp/ns3-ai-gym-interface.cc:151:5: error: ‘ns3_ai_gym’ has not been declared
151 | ns3_ai_gym::EnvStateMsg envStateMsg;
| ^~~~~~~~~~
/home/ji/ns-allinone-3.38/ns-3.38/contrib/ai/model/gym-interface/cpp/ns3-ai-gym-interface.cc:153:5: error: ‘ns3_ai_gym’ has not been declared
153 | ns3_ai_gym::DataContainer obsDataContainerPbMsg;
| ^~~~~~~~~~
/home/ji/ns-allinone-3.38/ns-3.38/contrib/ai/model/gym-interface/cpp/ns3-ai-gym-interface.cc:156:9: error: ‘obsDataContainerPbMsg’ was not declared in this scope; did you mean ‘obsDataContainer’?
156 | obsDataContainerPbMsg = obsDataContainer->GetDataContainerPbMsg();
| ^~~~~~~~~~~~~~~~~~~~~
| obsDataContainer
/home/ji/ns-allinone-3.38/ns-3.38/contrib/ai/model/gym-interface/cpp/ns3-ai-gym-interface.cc:157:9: error: ‘envStateMsg’ was not declared in this scope
157 | envStateMsg.mutable_obsdata()->CopyFrom(obsDataContainerPbMsg);
| ^~~~~~~~~~~
/home/ji/ns-allinone-3.38/ns-3.38/contrib/ai/model/gym-interface/cpp/ns3-ai-gym-interface.cc:160:5: error: ‘envStateMsg’ was not declared in this scope
160 | envStateMsg.set_reward(reward);
| ^~~~~~~~~~~
/home/ji/ns-allinone-3.38/ns-3.38/contrib/ai/model/gym-interface/cpp/ns3-ai-gym-interface.cc:168:36: error: ‘ns3_ai_gym’ has not been declared
168 | envStateMsg.set_reason(ns3_ai_gym::EnvStateMsg::SimulationEnd);
| ^~~~~~~~~~
/home/ji/ns-allinone-3.38/ns-3.38/contrib/ai/model/gym-interface/cpp/ns3-ai-gym-interface.cc:172:36: error: ‘ns3_ai_gym’ has not been declared
172 | envStateMsg.set_reason(ns3_ai_gym::EnvStateMsg::GameOver);
| ^~~~~~~~~~
/home/ji/ns-allinone-3.38/ns-3.38/contrib/ai/model/gym-interface/cpp/ns3-ai-gym-interface.cc:192:5: error: ‘ns3_ai_gym’ has not been declared
192 | ns3_ai_gym::EnvActMsg envActMsg;
| ^~~~~~~~~~
/home/ji/ns-allinone-3.38/ns-3.38/contrib/ai/model/gym-interface/cpp/ns3-ai-gym-interface.cc:195:5: error: ‘envActMsg’ was not declared in this scope
195 | envActMsg.ParseFromArray(msgInterface->GetPy2CppStruct()->buffer,
| ^~~~~~~~~
/home/ji/ns-allinone-3.38/ns-3.38/contrib/ai/model/gym-interface/cpp/ns3-ai-gym-interface.cc:216:5: error: ‘ns3_ai_gym’ has not been declared
216 | ns3_ai_gym::DataContainer actDataContainerPbMsg = envActMsg.actdata();
| ^~~~~~~~~~
/home/ji/ns-allinone-3.38/ns-3.38/contrib/ai/model/gym-interface/cpp/ns3-ai-gym-interface.cc:218:60: error: ‘actDataContainerPbMsg’ was not declared in this scope; did you mean ‘actDataContainer’?
218 | OpenGymDataContainer::CreateFromDataContainerPbMsg(actDataContainerPbMsg);
| ^~~~~~~~~~~~~~~~~~~~~
| actDataContainer
ninja: build stopped: subcommand failed.

I am using the following tools and versions:

Protobuf version: libprotoc 3.12.4
NS3 version: ns3.38
Operating System: ubuntu 22.04
Could you please help me identify what might be causing this issue and how to resolve it?

Thank you for your assistance.

@kaoutharouali
Copy link

Hi,
did you solve the problem ?

@kaoutharouali
Copy link

Hi,
for me I solved the problem.
I have installed ns3gym and na3-ai, that's why I have this error.
Uninstalling ns3gym solved the issue.
Regards,

@jixiaofeng1999
Copy link
Author

Hi, for me I solved the problem. I have installed ns3gym and na3-ai, that's why I have this error. Uninstalling ns3gym solved the issue. Regards,

Hello,

Thank you for your helpful response. Uninstalling ns3gym indeed resolved the problem.

Best regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants