Project-GrADyS / gradys-simulations

Simulations from Project GrADyS on OMNET++ and INET framework
GNU General Public License v3.0
14 stars 10 forks source link

Windows build with OMNET++ 6.0.2 throws error Class gradys_simulations::MobileNode not found #31

Closed klonikar closed 5 months ago

klonikar commented 5 months ago

I managed to build on windows using mingw64 (not WSL) on OMNET++ 6.0.2 and when running any of the showcases from within OMNET IDE, I get the following error: image

I checked the size of the executable out/gcc-release/src/gradys_simulations_build.exe. Its only 100KB. The MobileNode.cc has the following code:

Register_Class(MobileNode);
//Define_Module(MobileNode);

If this file was part of the .exe, it should have been executed. It appears that the .o files created for any of the .cc in src are not linked.

I have followed your instructions on https://project-gradys.github.io/gradys-simulations/ for running outside the docker. I also tried to run the executable from cmd line like below:

gradys-simulations/showcases$ ../out/gcc-release/src/gradys_simulations_build.exe sitl/simple_simulation/omnetpp.ini

But this gives the following error: image

Another thing I found was that 3 executables are created as follows:

out/gcc-release/gradys_simulations_build.exe
out/gcc-release/src/gradys_simulations_build.exe
out/gcc-release/src/pybind11_json/gradys_simulations.exe

I assume that the one in out/gcc-release/src/gradys_simulations_build.exe is the one to be executed for showcases. But that too does not work.

klonikar commented 5 months ago

I was able to build on virtualbox based ubuntu 22.04. It needs openscenegraph 3.4.1 and osgearth 2.9.0. Follow directions on https://docs.osgearth.org/en/latest/build.html for Linux build but use GL2 instead of GL3:

git clone https://github.com/openscenegraph/OpenSceneGraph.git
cd OpenSceneGraph
git checkout OpenSceneGraph-3.4.1 # ==> this is new
mkdir build && cd build
cmake .. -DOPENGL_PROFILE=GL2 -DOSG_GL_CONTEXT_VERSION=4.6 # GL2 instead of GL3
make -j8
sudo make install
cd ..
git clone https://github.com/google/draco.git
cd draco
mkdir build && cd build
cmake .. -DCMAKE_CXX_FLAGS=-fPIC
make -j8
sudo make install
cd ..
git clone https://github.com/gwaldron/osgearth.git
cd osgearth
git checkout osgearth-2.9 # ==> this is new
mkdir build && cd build
cmake .. -DOSGEARTH_ENABLE_FASTDXT=OFF
make -j8
sudo make install

Then in config.user of omnetpp, change WITH_OSGEARTH=no to WITH_OSGEARTH=yes and build omnetpp using ./configure LDFLAGS_ARCH=-L/usr/local/lib64 CFLAGS=-I/usr/local/include and make.

brunoolivieri commented 5 months ago

That sounds great!

What do you think about do a PR do create a new dockfile for Ubuntu 22.04?

@Thlamz : Could you test it to merge it later?

klonikar commented 5 months ago

That sounds great!

What do you think about do a PR do create a new dockfile for Ubuntu 22.04?

@Thlamz : Could you test it to merge it later?

Will create a dockerfile and raise a PR...

klonikar commented 5 months ago

By the way, the build is successful but when running any showcase, I get an error "simulations stopping with assert currentTimes.simTime <= simTime()". I have created a separate issue for this.

Thlamz commented 5 months ago

@klonikar hello! I am also having trouble setting up GrADyS-SIM with OMNeT++ 6 on Windows, OMNeT++ can be quite hard to set up on modern systems. While I haven't quite figured out the root cause yet, I have created a new .ova virtual machine image in case you want to use it: https://drive.google.com/file/d/12fdnAZPwr71j6yR2qScmUMv6U0uTFbf0/view?usp=drive_link.

I saw that you also got the same idea as me of setting the simulator up on a Linux virtual machine, that's great! If you have any trouble, try the .ova image above and see if that helps.

Also, replied to you on your other issue about the SITL integration.

klonikar commented 5 months ago

@klonikar hello! I am also having trouble setting up GrADyS-SIM with OMNeT++ 6 on Windows, OMNeT++ can be quite hard to set up on modern systems. While I haven't quite figured out the root cause yet, I have created a new .ova virtual machine image in case you want to use it: https://drive.google.com/file/d/12fdnAZPwr71j6yR2qScmUMv6U0uTFbf0/view?usp=drive_link.

I saw that you also got the same idea as me of setting the simulator up on a Linux virtual machine, that's great! If you have any trouble, try the .ova image above and see if that helps.

Also, replied to you on your other issue about the SITL integration.

Thanks. I will try out your .ova VM, though now I also have a virtualbox VM where gradys is built. I kind of gave up widows, and went ahead with VM. I think the first root cause is that the Makemake is not generating a proper Makefile to build the gradys related sources into obj files. When I hand modified the Makefile to build it, I am getting several "undefined symbol" errors for symbols in inet lib as well for winsock lib.

ld.lld: error: undefined symbol: inet::ClockUserModuleMixin<inet::ApplicationBase>::exponential(inet::ClockTime, int) const
ld.lld: error: undefined symbol: __declspec(dllimport) WSAStartup
ld.lld: error: undefined symbol: __declspec(dllimport) socket

We need to add more -l options to the linker cmd line. But not sure how to fix the issue for building gradys sources.

I also have a linux machine where the build works fine but I get the simTime error.