在 Ubuntu 上安装 Artery 时,构建 INET 会抛出异常错误

When installing Artery on Ubuntu, building INET throws an unusual Error

我目前正在使用 Omnet++、Veins 和 Artery 设置一台新 PC 来模拟 ITS-G5 协议。在 Artery 的根目录中调用 make inet 后,我收到以下错误消息:

$ make inet
cd extern/inet; python inet_featuretool disable packetdrill SCTP SCTP_examples
Disabling feature(s):  packetdrill, SCTP_examples, SCTP
opp_featuretool: .oppfeaturestate file updated.
opp_featuretool: .nedexclusions file updated.
make -C extern/inet makefiles
make[1]: Entering directory '/home/wiconlab/Car2x/artery-master/extern/inet'
Creating Makefile in /home/wiconlab/Car2x/artery-master/extern/inet/src...
make[1]: Leaving directory '/home/wiconlab/Car2x/artery-master/extern/inet'
make -C extern/inet/src
make[1]: Entering directory '/home/wiconlab/Car2x/artery-master/extern/inet/src'
*** COMPILING with:
g++ -c -std=c++11 -O3 -march=native -mtune=native -DNDEBUG=1 -MMD -MP -MF .d  -fPIC  -fno-stack-protector -DHAVE_SWAPCONTEXT -DWITH_MPI -DXMLPARSER=libxml -DPREFER_QTENV -DWITH_QTENV -DWITH_TKENV -DWITH_PARSIM -DWITH_NETBUILDER -DWITH_OSG -DWITH_OSGEARTH -Wno-overloaded-virtual -include inet/common/precompiled.h   -I. -I/home/wiconlab/Car2x/omnetpp-5.2/include
*** 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++  -lOpenThreads -losg -losgText -losgDB -losgEarth -losgEarthUtil -Wl,-rpath,/home/wiconlab/Car2x/omnetpp-5.2/lib -Wl,-rpath,/lib -Wl,-rpath,.  -L/home/wiconlab/Car2x/omnetpp-5.2/lib
Building...
Creating precompiled header for gcc...
MSGC: inet/applications/base/ApplicationPacket.msg

...  *ABBREVIATED FOR CLARITY*

inet/networklayer/ipv4/RoutingTableRecorder.cc
inet/networklayer/ipv4/RoutingTableRecorder.cc: In member function ‘virtual void inet::RoutingTableRecorder::recordInterfaceChange(omnetpp::cModule*, const inet::InterfaceEntry*, omnetpp::simsignal_t)’:
inet/networklayer/ipv4/RoutingTableRecorder.cc:207:15: error: expected ‘)’ before ‘INT64_PRINTF_FORMAT’
 #define LL    INT64_PRINTF_FORMAT  // for eventnumber_t
           ^
inet/networklayer/ipv4/RoutingTableRecorder.cc:296:37: note: in expansion of macro ‘LL’
 fprintf(routingLogFile, "%s  %" LL "d  %s  %d  %s %s\n",
                                 ^
inet/networklayer/ipv4/RoutingTableRecorder.cc:303:13: warning: spurious trailing ‘%’ in format [-Wformat=]
         );
         ^
inet/networklayer/ipv4/RoutingTableRecorder.cc:303:13: warning: too many arguments for format [-Wformat-extra-args]
inet/networklayer/ipv4/RoutingTableRecorder.cc: In member function ‘virtual void inet::RoutingTableRecorder::recordRouteChange(omnetpp::cModule*, const inet::IRoute*, omnetpp::simsignal_t)’:
inet/networklayer/ipv4/RoutingTableRecorder.cc:207:15: error: expected ‘)’ before ‘INT64_PRINTF_FORMAT’
 #define LL    INT64_PRINTF_FORMAT  // for eventnumber_t
           ^
inet/networklayer/ipv4/RoutingTableRecorder.cc:323:36: note: in expansion of macro ‘LL’
 fprintf(routingLogFile, "%s %" LL "d  %s  %d  %s  %s  %d  %s\n",
                                ^
inet/networklayer/ipv4/RoutingTableRecorder.cc:332:13: warning: spurious trailing ‘%’ in format [-Wformat=]
         );
         ^
inet/networklayer/ipv4/RoutingTableRecorder.cc:332:13: warning: too many arguments for format [-Wformat-extra-args]
Makefile:1134: recipe for target '../out/gcc-release/src/inet/networklayer/ipv4/RoutingTableRecorder.o' failed
make[1]: *** [../out/gcc-release/src/inet/networklayer/ipv4/RoutingTableRecorder.o] Error 1
make[1]: Leaving directory '/home/wiconlab/Car2x/artery-master/extern/inet/src'
Makefile:21: recipe for target 'inet' failed
make: *** [inet] Error 2

我正在使用最新的 Ubuntu 16.04 LTS,使用 cmake 3.9.6 编译,构建 Veins 和Vanetza 工作没有问题。 Omnet++ 版本为 5.2。错误所指的代码行是:

203 namespace inet {
204
205 Define_Module(RoutingTableRecorder);
206
207 #define LL    INT64_PRINTF_FORMAT  // for eventnumber_t

然而,在第 207 行之前期待一个“)”对我来说毫无意义。
此外,几周前在不同系统(相同 OS)上构建 Artery 时,也没有出现此错误。使用较早版本的源代码也没有任何效果。

您正在使用 OMNeT++ 5.2。 这似乎是问题所在,因为 API 略有变化。

INT64_PRINTF_FORMATOMNeT++ 5.2.

中不再可用

改回 OMNeT++ 版本 5.1 应该可以解决您的错误!

fprintf(routingLogFile, "%s %" LL "d %s %d %s %s %d %s\n", ^ inet/networklayer/ipv4/RoutingTableRecorder.cc:332:13:警告:格式为 [-Wformat=] 的虚假尾随“%” );

这只是一个简单的语法错误。通过路径 Inet/src/inet/networlayer/ipv4/ 打开 RoutingTableRecord.cc 文件并编辑 "fprintf(routingLogFile, "%s %" LL "d %s %d %s %s %d %s\n", " 行并删除 LL 包括周围的双引号LL。在此 C 代码中有两个。因此,请确保它们都像以下行一样得到更正:fprintf(routingLogFile, "%s %d %s %d %s %s %d %s\n", .

您可能还需要注释掉 #define LL INT64_PRINTF_FORMAT // for eventnumber_t at line number around 270.

然后只保存并清理 inet 项目。然后也只构建 inet 项目。