ms-van3t-devs / ms-van3t

A multi-stack, ETSI compliant, V2X framework for ns-3.
GNU General Public License v2.0
102 stars 33 forks source link

Issue building ns-3 with ms-van3t-CARLA extension #17

Closed valerionori closed 4 months ago

valerionori commented 5 months ago

Good morning,

I have an issue building ns-3 after following your guide to set up the ms-van3t-CARLA extension.

I am using Ubuntu 20.04. I installed ms-van3t following the guide you provided and everything works fine.

However, I faced some issues when configuring the extension for CARLA.

I run the file switch_ms-van3t-CARLA.sh which successfully installed both CARLA 0.9.12 and OpenCDA.

In the file switch_ms-van3t-CARLA.sh I changed the following lines:

# Installing following packages one by one for reliability 
conda install cudatoolkit=11.1 -c pytorch -c nvidia
conda install pytorch==1.8.0 -c pytorch -c nvidia
conda install torchvision -c pytorch -c nvidia
conda install torchaudio -c pytorch -c cnvidia

since using conda-forge channel it got stuck solving the environment. I also changed line 37 in OpenCDA/setup.sh:

conda activate msvan3t_carla

since default was conda activate opencda and it got stuck because it could not find the environment.

Anyway, when everything successfully installed and the message Succesfully switched to ms-van3t-CARLA! displayed, I tried to build ns3 with ./ns3 build but faced the following error:

[  0%] Linking CXX executable ../../build/utils/ns3-dev-print-introspected-doxygen-optimized
[  0%] Linking CXX executable ../../../../build/src/automotive/examples/ns3-dev-v2i-areaSpeedAdvisor-lte-optimized
[  0%] Linking CXX executable ../../../../build/src/automotive/examples/ns3-dev-v2v-carla-80211p-optimized
[  0%] Linking CXX executable ../../../../build/src/automotive/examples/ns3-dev-v2i-areaSpeedAdvisor-80211p-optimized
[  0%] Linking CXX executable ../../../../build/src/automotive/examples/ns3-dev-v2i-emergencyVehicleWarning-80211p-optimized
[  0%] Linking CXX executable ../../../../build/src/automotive/examples/ns3-dev-v2i-trafficManager-80211p-optimized
[  0%] Linking CXX executable ../../../../build/src/automotive/examples/ns3-dev-v2i-trafficManager-LTE-optimized
[  0%] Linking CXX executable ../../../../build/src/automotive/examples/ns3-dev-v2v-emergencyVehicleAlert-cv2x-optimized
[  0%] Linking CXX executable ../../../../build/src/automotive/examples/ns3-dev-v2v-emergencyVehicleAlert-80211p-optimized
[  0%] Linking CXX executable ../../../../build/src/automotive/examples/ns3-dev-v2v-carla-nrv2x-optimized
[  1%] Linking CXX executable ../../../../build/src/automotive/examples/ns3-dev-v2v-emergencyVehicleAlert-nrv2x-optimized
/usr/bin/ld: ../../build/lib/libns3-dev-automotive-optimized.so: undefined reference to `SignalInfoUtils::SignalInfoUtils()'
/usr/bin/ld: ../../build/lib/libns3-dev-automotive-optimized.so: undefined reference to `SignalInfoUtils::GetSignalInfo()'
/usr/bin/ld: ../../build/lib/libns3-dev-automotive-optimized.so: undefined reference to `SignalInfoUtils::SetSignalInfo(double, double, double)'
collect2: error: ld returned 1 exit status
make[2]: *** [utils/CMakeFiles/print-introspected-doxygen.dir/build.make:282: ../build/utils/ns3-dev-print-introspected-doxygen-optimized] Error 1
make[1]: *** [CMakeFiles/Makefile2:18745: utils/CMakeFiles/print-introspected-doxygen.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
/usr/bin/ld: ../../../../build/lib/libns3-dev-automotive-optimized.so: undefined reference to `SignalInfoUtils::SignalInfoUtils()'
/usr/bin/ld: ../../../../build/lib/libns3-dev-automotive-optimized.so: undefined reference to `SignalInfoUtils::GetSignalInfo()'
/usr/bin/ld: ../../../../build/lib/libns3-dev-automotive-optimized.so: undefined reference to `SignalInfoUtils::SetSignalInfo(double, double, double)'
collect2: error: ld returned 1 exit status
make[2]: *** [src/automotive/examples/CMakeFiles/v2i-areaSpeedAdvisor-80211p.dir/build.make:285: ../build/src/automotive/examples/ns3-dev-v2i-areaSpeedAdvisor-80211p-optimized] Error 1
make[1]: *** [CMakeFiles/Makefile2:4227: src/automotive/examples/CMakeFiles/v2i-areaSpeedAdvisor-80211p.dir/all] Error 2
/usr/bin/ld: ../../../../build/lib/libns3-dev-automotive-optimized.so: undefined reference to `SignalInfoUtils::SignalInfoUtils()'
/usr/bin/ld: ../../../../build/lib/libns3-dev-automotive-optimized.so: undefined reference to `SignalInfoUtils::GetSignalInfo()'
/usr/bin/ld: ../../../../build/lib/libns3-dev-automotive-optimized.so: undefined reference to `SignalInfoUtils::SetSignalInfo(double, double, double)'
collect2: error: ld returned 1 exit status
make[2]: *** [src/automotive/examples/CMakeFiles/v2i-emergencyVehicleWarning-80211p.dir/build.make:285: ../build/src/automotive/examples/ns3-dev-v2i-emergencyVehicleWarning-80211p-optimized] Error 1
make[1]: *** [CMakeFiles/Makefile2:4333: src/automotive/examples/CMakeFiles/v2i-emergencyVehicleWarning-80211p.dir/all] Error 2
/usr/bin/ld: ../../../../build/lib/libns3-dev-automotive-optimized.so: undefined reference to `SignalInfoUtils::SignalInfoUtils()'
/usr/bin/ld: ../../../../build/lib/libns3-dev-automotive-optimized.so: undefined reference to `SignalInfoUtils::GetSignalInfo()'
/usr/bin/ld: ../../../../build/lib/libns3-dev-automotive-optimized.so: undefined reference to `SignalInfoUtils::SetSignalInfo(double, double, double)'
collect2: error: ld returned 1 exit status
make[2]: *** [src/automotive/examples/CMakeFiles/v2v-emergencyVehicleAlert-80211p.dir/build.make:285: ../build/src/automotive/examples/ns3-dev-v2v-emergencyVehicleAlert-80211p-optimized] Error 1
make[1]: *** [CMakeFiles/Makefile2:4544: src/automotive/examples/CMakeFiles/v2v-emergencyVehicleAlert-80211p.dir/all] Error 2
/usr/bin/ld: ../../../../build/lib/libns3-dev-automotive-optimized.so: undefined reference to `SignalInfoUtils::SignalInfoUtils()'
/usr/bin/ld: ../../../../build/lib/libns3-dev-automotive-optimized.so: undefined reference to `SignalInfoUtils::GetSignalInfo()'
/usr/bin/ld: ../../../../build/lib/libns3-dev-automotive-optimized.so: undefined reference to `SignalInfoUtils::SetSignalInfo(double, double, double)'
collect2: error: ld returned 1 exit status
make[2]: *** [src/automotive/examples/CMakeFiles/v2i-trafficManager-80211p.dir/build.make:285: ../build/src/automotive/examples/ns3-dev-v2i-trafficManager-80211p-optimized] Error 1
make[1]: *** [CMakeFiles/Makefile2:4439: src/automotive/examples/CMakeFiles/v2i-trafficManager-80211p.dir/all] Error 2
/usr/bin/ld: ../../../../build/lib/libns3-dev-automotive-optimized.so: undefined reference to `SignalInfoUtils::SignalInfoUtils()'
/usr/bin/ld: ../../../../build/lib/libns3-dev-automotive-optimized.so: undefined reference to `SignalInfoUtils::GetSignalInfo()'
/usr/bin/ld: ../../../../build/lib/libns3-dev-automotive-optimized.so: undefined reference to `SignalInfoUtils::SetSignalInfo(double, double, double)'
collect2: error: ld returned 1 exit status
/usr/bin/ld: ../../../../build/lib/libns3-dev-automotive-optimized.so: undefined reference to `SignalInfoUtils::SignalInfoUtils()'
/usr/bin/ld: ../../../../build/lib/libns3-dev-automotive-optimized.so: undefined reference to `SignalInfoUtils::GetSignalInfo()'
/usr/bin/ld: ../../../../build/lib/libns3-dev-automotive-optimized.so: undefined reference to `SignalInfoUtils::SetSignalInfo(double, double, double)'
collect2: error: ld returned 1 exit status
make[2]: *** [src/automotive/examples/CMakeFiles/v2i-areaSpeedAdvisor-lte.dir/build.make:285: ../build/src/automotive/examples/ns3-dev-v2i-areaSpeedAdvisor-lte-optimized] Error 1
make[1]: *** [CMakeFiles/Makefile2:4174: src/automotive/examples/CMakeFiles/v2i-areaSpeedAdvisor-lte.dir/all] Error 2
make[2]: *** [src/automotive/examples/CMakeFiles/v2i-trafficManager-LTE.dir/build.make:285: ../build/src/automotive/examples/ns3-dev-v2i-trafficManager-LTE-optimized] Error 1
make[1]: *** [CMakeFiles/Makefile2:4491: src/automotive/examples/CMakeFiles/v2i-trafficManager-LTE.dir/all] Error 2
/usr/bin/ld: ../../../../build/lib/libns3-dev-automotive-optimized.so: undefined reference to `SignalInfoUtils::SignalInfoUtils()'
/usr/bin/ld: ../../../../build/lib/libns3-dev-automotive-optimized.so: undefined reference to `SignalInfoUtils::GetSignalInfo()'
/usr/bin/ld: ../../../../build/lib/libns3-dev-automotive-optimized.so: undefined reference to `SignalInfoUtils::SetSignalInfo(double, double, double)'
collect2: error: ld returned 1 exit status
make[2]: *** [src/automotive/examples/CMakeFiles/v2v-emergencyVehicleAlert-cv2x.dir/build.make:285: ../build/src/automotive/examples/ns3-dev-v2v-emergencyVehicleAlert-cv2x-optimized] Error 1
make[1]: *** [CMakeFiles/Makefile2:4280: src/automotive/examples/CMakeFiles/v2v-emergencyVehicleAlert-cv2x.dir/all] Error 2
/usr/bin/ld: ../../../../build/lib/libns3-dev-automotive-optimized.so: undefined reference to `SignalInfoUtils::SignalInfoUtils()'
/usr/bin/ld: ../../../../build/lib/libns3-dev-automotive-optimized.so: undefined reference to `SignalInfoUtils::GetSignalInfo()'
/usr/bin/ld: ../../../../build/lib/libns3-dev-automotive-optimized.so: undefined reference to `SignalInfoUtils::SetSignalInfo(double, double, double)'
collect2: error: ld returned 1 exit status
make[2]: *** [src/automotive/examples/CMakeFiles/v2v-emergencyVehicleAlert-nrv2x.dir/build.make:285: ../build/src/automotive/examples/ns3-dev-v2v-emergencyVehicleAlert-nrv2x-optimized] Error 1
make[1]: *** [CMakeFiles/Makefile2:4596: src/automotive/examples/CMakeFiles/v2v-emergencyVehicleAlert-nrv2x.dir/all] Error 2
/usr/bin/ld: ../../../../build/lib/libns3-dev-automotive-optimized.so: undefined reference to `SignalInfoUtils::SignalInfoUtils()'
/usr/bin/ld: ../../../../build/lib/libns3-dev-automotive-optimized.so: undefined reference to `SignalInfoUtils::GetSignalInfo()'
/usr/bin/ld: ../../../../build/lib/libns3-dev-automotive-optimized.so: undefined reference to `SignalInfoUtils::SetSignalInfo(double, double, double)'
collect2: error: ld returned 1 exit status
make[2]: *** [src/automotive/examples/CMakeFiles/v2v-carla-80211p.dir/build.make:285: ../build/src/automotive/examples/ns3-dev-v2v-carla-80211p-optimized] Error 1
make[1]: *** [CMakeFiles/Makefile2:4386: src/automotive/examples/CMakeFiles/v2v-carla-80211p.dir/all] Error 2
/usr/bin/ld: ../../../../build/lib/libns3-dev-automotive-optimized.so: undefined reference to `SignalInfoUtils::SignalInfoUtils()'
/usr/bin/ld: ../../../../build/lib/libns3-dev-automotive-optimized.so: undefined reference to `SignalInfoUtils::GetSignalInfo()'
/usr/bin/ld: ../../../../build/lib/libns3-dev-automotive-optimized.so: undefined reference to `SignalInfoUtils::SetSignalInfo(double, double, double)'
collect2: error: ld returned 1 exit status
make[2]: *** [src/automotive/examples/CMakeFiles/v2v-carla-nrv2x.dir/build.make:285: ../build/src/automotive/examples/ns3-dev-v2v-carla-nrv2x-optimized] Error 1
make[1]: *** [CMakeFiles/Makefile2:4648: src/automotive/examples/CMakeFiles/v2v-carla-nrv2x.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
Finished executing the following commands:
cd cmake-cache; cmake --build . -j 13 ; cd ..

Actually, this is the second time I run ./ns3 build. The first time it built until 37% and then failed when Scanning dependencies of target test-runner with the same error.

Moreover, when switching back to the base environment, ns3 won't build anymore.

Did I set anything wrong during the configuration of the environment?

Thank you in advance for your help.

(I am sorry, i have just seen that issue #13 is about the same problem. )

carlosrisma commented 5 months ago

Hello Valerio,

thank you very much for the detailed bug report. We are actively refining the CARLA extension installation script to work with different systems so your feedback is very valuable :) The error you are getting is due to an incompatibility of the ms-van3t-CARLA CMakeLists.txt and the latest ms-van3t features. Now we have updated the CARLA extension auxiliary files and the error should disappear. You should pull from the last commit and run the _./switchms-van3t-CARLA.sh script twice.

Best regards, Carlos

valerionori commented 5 months ago

Thank you for the fast response.

I performed a clean install of ms-van3t (due to unrelated issues).

Another thing I forgot to mention is that I had to install grpc_tools, since I received this error in the last step of file switch_ms-van3t-CARLA.sh (line 216 ./buildProto.sh):

/home/ready-lab/anaconda3/envs/msvan3t_carla/bin/python3: Error while finding module specification for 'grpc_tools.protoc' (ModuleNotFoundError: No module named 'grpc_tools')

I "solved" it by executing:

python3 -m pip install grpcio
python3 -m pip install grpcio-tools

in both the base and virtual environments (I am still not sure if it is correct, but I do not receive the error anymore).

I run ./ns3 clean and again ./ns3 configure --build-profile=optimized --enable-examples --enable-tests --disable-python.

Executing ./ns3 build (from the msvan3t_carla virtual environment) I receive the following output:

...
In file included from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
                 from /usr/include/stdint.h:26,
                 from /usr/lib/gcc/x86_64-linux-gnu/9/include/stdint.h:9,
                 from ../build/include/ns3/event-impl.h:23,
                 from ../build/include/ns3/simulator-impl.h:24,
                 from ../build/include/ns3/realtime-simulator-impl.h:22,
                 from ../build/include/ns3/core-module.h:6,
                 from ../build/include/ns3/OpenCDAClient.h:24,
                 from ../build/include/ns3/PRRSupervisor.h:4,
                 from ../build/include/ns3/automotive-module.h:6,
                 from ../src/automotive/examples/v2v-emergencyVehicleAlert-nrv2x.cc:20:
/usr/include/features.h:197: note: this is the location of the previous definition
  197 | # define _ISOC99_SOURCE 1
      | 
[1890/3654] Building CXX object src/automoti...carla-nrv2x.dir/v2v-carlaMobility-nrv2x.cc.o
In file included from ../build/include/ns3/automotive-module.h:709,
                 from ../src/automotive/examples/v2v-carlaMobility-nrv2x.cc:20:
../build/include/ns3/REAL.h:11: warning: "_ISOC99_SOURCE" redefined
   11 | #define _ISOC99_SOURCE  /* For ilogb() and quiet NAN */
      | 
In file included from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
                 from /usr/include/stdint.h:26,
                 from /usr/lib/gcc/x86_64-linux-gnu/9/include/stdint.h:9,
                 from ../build/include/ns3/event-impl.h:23,
                 from ../build/include/ns3/simulator-impl.h:24,
                 from ../build/include/ns3/realtime-simulator-impl.h:22,
                 from ../build/include/ns3/core-module.h:6,
                 from ../build/include/ns3/OpenCDAClient.h:24,
                 from ../build/include/ns3/carla-module.h:6,
                 from ../src/automotive/examples/v2v-carlaMobility-nrv2x.cc:19:
/usr/include/features.h:197: note: this is the location of the previous definition
  197 | # define _ISOC99_SOURCE 1
      | 
[3654/3654] Linking CXX executable ../build/utils/ns3-dev-print-introspected-doxygen-optimized
Finished executing the following commands:
cd cmake-cache; cmake --build . -j 13 ; cd ..

so the build should be correctly done.

However, when running an example through ./ns3 run src/automotive/examples/v2v-carlaMobility-nrv2x.cc I receive the following error:

Traceback (most recent call last):
  File "./ns3", line 1336, in <module>
    main()
  File "./ns3", line 1275, in main
    raise Exception("Couldn't find the specified program: %s" % target_to_run)
Exception: Couldn't find the specified program: src/automotive/examples/v2v-carlaMobility-nrv2x.cc

Note that I previously launched ./CarlaUE4.sh from the base environment and then run the above example from the msvan3t_carla virtual environment.

Did I make any mistake with the installation of grpc or with the build?

Thank you in advance.

carlosrisma commented 5 months ago

Hi Valerio,

the error seems strange as the _sandboxbuilder.sh script should take care of the grpc installation. When starting the installation did you execute the _sandboxbuilder.sh with the install-dependencies flag? The grpc dependencies are only installed if using that flag, including: python3 -m pip install grpcio python3 -m pip install grpcio-tools In the case you didn't use the install-dependencies flag I would recommend to execute in a path of your liking:

git clone -b v1.60.0 https://github.com/grpc/grpc
cd grpc
git submodule update --init
mkdir -p cmake/build
cd cmake/build
cmake ../..
make
sudo make install
cd ../../..

and then run ./buildProto.sh in path/to/ns-3-dev/src/carla/proto/

With respect to the first ./ns3 build output, try adding the --disable-werror to ./ns3 configure.

Cheers, Carlos

valerionori commented 5 months ago

I did run ./sandbox_builder.sh install-dependencies actually. In fact, there is a grpc folder inside ms-van3t/.

I can confirm you that after executing python3 -m pip install grpcio-tools inside msvan3t_carla virtual environment and after including --disable-werror to ./ns3 configure, ns-3 builds correctly.

Moreover, I can execute examples (I just had to type ./ns3 run "v2v-carla-nrv2x" as the READMI suggests).

I would close the issue, but I have another one which is maybe related to the build: when executing ./ns3 run "v2v-carla-nrv2x", i receive the following output:

(base) ready-lab@readylab:~/ms-van3t/ns-3-dev$ ./ns3 run "v2v-carla-nrv2x"
[0/2] Re-checking globbed directories...
ninja: no work to do.
Number of vehicles: 26
Executing: cd /home/ready-lab/ms-van3t/ns-3-dev/CARLA_0.9.12 && ./CarlaUE4.sh -prefernvidia
CARLA server ready.
Executing: cd /home/ready-lab/ms-van3t/ns-3-dev/OpenCDA && /home/ready-lab/anaconda3/envs/msvan3t_carla/bin/python3 -u opencda.py -t ms_van3t_example -v 0.9.12
OpenCDAClient::startSimulation()
Waiting for OpenCDA Control Interface to be ready.
Waiting for OpenCDA Control Interface to be ready.
OpenCDA Control Interface ready.
I do have a GRPC_CHANNEL_CONNECTING in WHILE -> 1
I do have a GRPC_CHANNEL_READY in WHILE -> 2
Command 'build/src/automotive/examples/ns3-dev-v2v-carla-nrv2x-optimized' died with <Signals.SIGSEGV: 11>.

Just for completeness, I tried running the example from both base and msvan3t_carla environments with the same outcome. I also tried to launch ./CarlaUE4.sh from base environment first, and then running the example from msvan3t_carla environment.

May it be related to gprc again?

Thank you in advance.

melihyazgan commented 5 months ago

Hi all,

I am getting the same error for both examples given in Readme.

Thank you

melihyazgan commented 4 months ago

Hi all,

is there any update regarding this issue? By my side, I couldn't find a solution. I have two workstation and on both I am getting the same error

Cheers, Melih

carlosrisma commented 4 months ago

Hi all, from what I see in the output you built the project in 'optimized' mode which is not great for debugging runtime problems. If you could please try building in 'debug' mode perhaps I could provide further assistance. Nevertheless I would also highly recommend running the examples using an IDE such as QtCreator or Clion which offer debugging tools to better spot the cause of errors.

Best regards, Carlos

carlosrisma commented 4 months ago

Considering this is the same issue as the one reported in #13 It think this one can be closed.