NS-3:构建时出现模块错误

NS-3: module errors while building

我在带有 nsc-0.5.3 和 gccxml-ns3 的最新 ns-3.26 中遇到问题 - 系统是最新的,所以情况并非如此。

Building nsc-0.5.3 - Problem

Problem: Optional dependency, module "nsc-0.5.3" failed

This may reduce the functionality of the final build. However, bake will continue since "nsc-0.5.3" is not an essential dependency. For more information call bake with -v or -vvv, for full verbose mode.

找到解决方案 - NSC 无法与 gcc/g++-6 一起正常工作,所以我不得不更改 gcc 和 g++ 的默认版本(例如来自6.3.0 至 5.4.1)

1) 查找已安装的编译器:

dpkg --list | grep compiler

2) 更改默认 gcc、g++、cc 和 c++(通过 https://askubuntu.com/questions/26498/choose-gcc-and-g-version):

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 10
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 20

sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-6 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 20

sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30
sudo update-alternatives --set cc /usr/bin/gcc

sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30
sudo update-alternatives --set c++ /usr/bin/g++

此外,检查更改是否已保存:

gcc -v

最后应该说:"gcc version 5.4.1"。

之后NSC安装成功

值得一提的是它没有解决 gccxml 的问题,但在我的情况下我需要 NSC 工作所以...