在 WSL Ubuntu 中构建 INET 4.1.2 时出现“IPv6 功能禁用错误”的原因是什么

问题描述

在 WSL Ubuntu 中在 omnet++ 5.5.1 中构建 INET 4.1.2 时,发生构建错误,如下所示,#error "IPv6 功能已禁用"。但是,在 window 环境中构建相同的包不会出错。 在 Ubuntu 中构建错误的原因可能是什么?

 *** LINKING with:
g++ -shared -fPIC -o ../out/gcc-release/src/libINET.so -Wl,--no-as-needed -Wl,--whole-archive  -Wl,--no-whole-archive -loppenvir -loppsim -ldl -lstdc++  -losg -losgText -losgDB -losgGA -losgViewer -losgUtil -lOpenThreads  -losgEarth -losgEarthUtil  -Wl,-rpath,/home/castrov/omnet++/omnetpp-5.5.1/lib -Wl,/lib -Wl,.  -Wl,--export-dynamic -L/home/castrov/omnet++/omnetpp-5.5.1/lib
Building...
inet/networklayer/configurator/ipv6/Ipv6FlatNetworkConfigurator.cc
In file included from inet/networklayer/configurator/ipv6/Ipv6FlatNetworkConfigurator.cc:24:
./inet/networklayer/ipv6/Ipv6InterfaceData.h:27:2: error: #error "IPv6 feature disabled"
   27 | #error "IPv6 feature disabled"
      |  ^~~~~
make[1]: *** [Makefile:1606: ../out/gcc-release/src/inet/networklayer/configurator/ipv6/Ipv6FlatNetworkConfigurator.o] Error 1

解决方法

我在没有使用 WSL 的情况下重新安装了 Ubuntu。然后 INET 构建错误消失了。

,

在 RHEL 8.3、INET 4.2.2 上有同样的问题

原来下面的文件是空的。

src/inet/features.h

只需删除此文件并重新开始构建即可解决问题。