我正在尝试安装palmtree并且我遵循每一步,但是当我运行make时,我获得了以下错误:
Building file: ../src/tools/palmtree/PalmTree.cpp
Invoking: GCC C++ Compiler
g++ -O3 -Wall -c -fmessage-length=0 -m32 -MMD -MP -MF"src/tools/palmtree/PalmTree.d" -MT"src/tools/palmtree/PalmTree.d" -o"src/tools/palmtree/PalmTree.o" "../src/tools/palmtree/PalmTree.cpp"
Finished building: ../src/tools/palmtree/PalmTree.cpp
Building file: ../src/tools/Tool.cpp
Invoking: GCC C++ Compiler
g++ -O3 -Wall -c -fmessage-length=0 -m32 -MMD -MP -MF"src/tools/Tool.d" -MT"src/tools/Tool.d" -o"src/tools/Tool.o" "../src/tools/Tool.cpp"
Finished building: ../src/tools/Tool.cpp
Building file: ../src/prober/udp/DirectUDPProber.cpp
Invoking: GCC C++ Compiler
g++ -O3 -Wall -c -fmessage-length=0 -m32 -MMD -MP -MF"src/prober/udp/DirectUDPProber.d" -MT"src/prober/udp/DirectUDPProber.d" -o"src/prober/udp/DirectUDPProber.o" "../src/prober/udp/DirectUDPProber.cpp"
../src/prober/udp/DirectUDPProber.cpp:201:8: error: no member named 'source' in 'udphdr'
udp->source=htons(srcPort_16);
~~~ ^
../src/prober/udp/DirectUDPProber.cpp:202:8: error: no member named 'dest' in 'udphdr'
udp->dest=htons(dstPort_16);
~~~ ^
../src/prober/udp/DirectUDPProber.cpp:203:8: error: no member named 'len' in 'udphdr'
udp->len=htons(DirectProber::MINIMUM_UDP_HEADER_LENGTH + DirectProber::DEFAULT_UDP_RANDOM_DATA_LENGTH + DirectProber::ATTENTION_MESSAGE.length());//the length must be udp_header length + data length.
~~~ ^
../src/prober/udp/DirectUDPProber.cpp:204:8: error: no member named 'check' in 'udphdr'
udp->check=0x0;
~~~ ^
../src/prober/udp/DirectUDPProber.cpp:225:25: error: no member named 'len' in 'udphdr'
memcpy(pseudo, &(udp->len), 2);
~~~ ^
../src/prober/udp/DirectUDPProber.cpp:233:8: error: no member named 'check' in 'udphdr'
udp->check=DirectProber::calculateInternetChecksum((uint16_t *)pseudoBuffer, pseudoBufferLength);
~~~ ^
../src/prober/udp/DirectUDPProber.cpp:406:20: error: member access into incomplete type 'struct icmphdr'
tmpChecksum=icmp->checksum;
^
../src/prober/udp/DirectUDPProber.cpp:402:11: note: forward declaration of 'icmphdr'
struct icmphdr * icmp=(struct icmphdr *)(buffer + (ip->ip_hl)*4);
^
../src/prober/udp/DirectUDPProber.cpp:407:8: error: member access into incomplete type 'struct icmphdr'
icmp->checksum=0x0;//before computing checksum, the sum field must be zero
^
../src/prober/udp/DirectUDPProber.cpp:402:11: note: forward declaration of 'icmphdr'
struct icmphdr * icmp=(struct icmphdr *)(buffer + (ip->ip_hl)*4);
^
../src/prober/udp/DirectUDPProber.cpp:415:8: error: member access into incomplete type 'struct icmphdr'
icmp->checksum=tmpChecksum;
^
../src/prober/udp/DirectUDPProber.cpp:402:11: note: forward declaration of 'icmphdr'
struct icmphdr * icmp=(struct icmphdr *)(buffer + (ip->ip_hl)*4);
^
../src/prober/udp/DirectUDPProber.cpp:420:11: error: member access into incomplete type 'struct icmphdr'
if(icmp->type==DirectProber::ICMP_TYPE_TIME_EXCEEDED || icmp->type == DirectProber::ICMP_TYPE_DESTINATION_UNREACHABLE){
^
../src/prober/udp/DirectUDPProber.cpp:402:11: note: forward declaration of 'icmphdr'
struct icmphdr * icmp=(struct icmphdr *)(buffer + (ip->ip_hl)*4);
^
../src/prober/udp/DirectUDPProber.cpp:439:25: error: no member named 'source' in 'udphdr'
ntohs(payloadudp->source)==srcPort_16 &&
~~~~~~~~~~ ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/sys/_endian.h:132:39: note: expanded from macro 'ntohs'
#define ntohs(x) __DARWIN_OSSwapInt16(x)
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libkern/_OSByteOrder.h:72:40: note: expanded from macro '__DARWIN_OSSwapInt16'
((__uint16_t)(__builtin_constant_p(x) ? __DARWIN_OSSwapConstInt16(x) : _OSSwapInt16(x)))
^
../src/prober/udp/DirectUDPProber.cpp:439:25: error: no member named 'source' in 'udphdr'
ntohs(payloadudp->source)==srcPort_16 &&
~~~~~~~~~~ ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/sys/_endian.h:132:39: note: expanded from macro 'ntohs'
#define ntohs(x) __DARWIN_OSSwapInt16(x)
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libkern/_OSByteOrder.h:72:71: note: expanded from macro '__DARWIN_OSSwapInt16'
((__uint16_t)(__builtin_constant_p(x) ? __DARWIN_OSSwapConstInt16(x) : _OSSwapInt16(x)))
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libkern/_OSByteOrder.h:44:34: note: expanded from macro '__DARWIN_OSSwapConstInt16'
((__uint16_t)((((__uint16_t)(x) & 0xff00) >> 8) | \
^
../src/prober/udp/DirectUDPProber.cpp:439:25: error: no member named 'source' in 'udphdr'
ntohs(payloadudp->source)==srcPort_16 &&
~~~~~~~~~~ ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/sys/_endian.h:132:39: note: expanded from macro 'ntohs'
#define ntohs(x) __DARWIN_OSSwapInt16(x)
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libkern/_OSByteOrder.h:72:71: note: expanded from macro '__DARWIN_OSSwapInt16'
((__uint16_t)(__builtin_constant_p(x) ? __DARWIN_OSSwapConstInt16(x) : _OSSwapInt16(x)))
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libkern/_OSByteOrder.h:45:32: note: expanded from macro '__DARWIN_OSSwapConstInt16'
(((__uint16_t)(x) & 0x00ff) << 8)))
^
../src/prober/udp/DirectUDPProber.cpp:439:25: error: no member named 'source' in 'udphdr'
ntohs(payloadudp->source)==srcPort_16 &&
~~~~~~~~~~ ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/sys/_endian.h:132:39: note: expanded from macro 'ntohs'
#define ntohs(x) __DARWIN_OSSwapInt16(x)
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libkern/_OSByteOrder.h:72:89: note: expanded from macro '__DARWIN_OSSwapInt16'
((__uint16_t)(__builtin_constant_p(x) ? __DARWIN_OSSwapConstInt16(x) : _OSSwapInt16(x)))
^
../src/prober/udp/DirectUDPProber.cpp:440:25: error: no member named 'dest' in 'udphdr'
ntohs(payloadudp->dest)==dstPort_16){
~~~~~~~~~~ ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/sys/_endian.h:132:39: note: expanded from macro 'ntohs'
#define ntohs(x) __DARWIN_OSSwapInt16(x)
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libkern/_OSByteOrder.h:72:40: note: expanded from macro '__DARWIN_OSSwapInt16'
((__uint16_t)(__builtin_constant_p(x) ? __DARWIN_OSSwapConstInt16(x) : _OSSwapInt16(x)))
^
../src/prober/udp/DirectUDPProber.cpp:440:25: error: no member named 'dest' in 'udphdr'
ntohs(payloadudp->dest)==dstPort_16){
~~~~~~~~~~ ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/sys/_endian.h:132:39: note: expanded from macro 'ntohs'
#define ntohs(x) __DARWIN_OSSwapInt16(x)
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libkern/_OSByteOrder.h:72:71: note: expanded from macro '__DARWIN_OSSwapInt16'
((__uint16_t)(__builtin_constant_p(x) ? __DARWIN_OSSwapConstInt16(x) : _OSSwapInt16(x)))
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libkern/_OSByteOrder.h:44:34: note: expanded from macro '__DARWIN_OSSwapConstInt16'
((__uint16_t)((((__uint16_t)(x) & 0xff00) >> 8) | \
^
../src/prober/udp/DirectUDPProber.cpp:440:25: error: no member named 'dest' in 'udphdr'
ntohs(payloadudp->dest)==dstPort_16){
~~~~~~~~~~ ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/sys/_endian.h:132:39: note: expanded from macro 'ntohs'
#define ntohs(x) __DARWIN_OSSwapInt16(x)
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libkern/_OSByteOrder.h:72:71: note: expanded from macro '__DARWIN_OSSwapInt16'
((__uint16_t)(__builtin_constant_p(x) ? __DARWIN_OSSwapConstInt16(x) : _OSSwapInt16(x)))
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libkern/_OSByteOrder.h:45:32: note: expanded from macro '__DARWIN_OSSwapConstInt16'
(((__uint16_t)(x) & 0x00ff) << 8)))
^
../src/prober/udp/DirectUDPProber.cpp:440:25: error: no member named 'dest' in 'udphdr'
ntohs(payloadudp->dest)==dstPort_16){
~~~~~~~~~~ ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/sys/_endian.h:132:39: note: expanded from macro 'ntohs'
#define ntohs(x) __DARWIN_OSSwapInt16(x)
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libkern/_OSByteOrder.h:72:89: note: expanded from macro '__DARWIN_OSSwapInt16'
((__uint16_t)(__builtin_constant_p(x) ? __DARWIN_OSSwapConstInt16(x) : _OSSwapInt16(x)))
^
../src/prober/udp/DirectUDPProber.cpp:456:81: error: member access into incomplete type 'struct icmphdr'
return buildProbeRecord(REQTime, dst, rplyAddress, TTL, ip->ip_ttl, icmp->type, icmp->code, ntohs(ip->ip_id), payloadip->ip_ttl, RRarray,RRarrayLength);
^
../src/prober/udp/DirectUDPProber.cpp:402:11: note: forward declaration of 'icmphdr'
struct icmphdr * icmp=(struct icmphdr *)(buffer + (ip->ip_hl)*4);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [src/prober/udp/DirectUDPProber.o] Error 1
我明白我需要在../src/prober/udp/DirectUDPProber.cpp中更改一些内容,我假设该类型是在以下内容中定义的:
#include <netinet/udp.h>
我使用了locate来查找它给出的netinet/udp.h
:
(1) /Applications/MATLAB_R2015a.app/polyspace/verifier/cxx/include/include-libc/netinet/ip_icmp.h
(2) /Applications/MATLAB_R2016a.app/polyspace/verifier/cxx/include/include-libc/netinet/ip_icmp.h
(3) /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/usr/include/netinet/ip_icmp.h
(4) /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/netinet/ip_icmp.h
(5) /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/netinet/ip_icmp.h
(6) /Applications/Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/usr/include/netinet/ip_icmp.h
(7) /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/netinet/ip_icmp.h
(8) /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdk/MacOSX.sdk/usr/include/netinet/ip_icmp.h
(9) /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdk/iPhoneSimulator.sdk/usr/include/netinet/ip_icmp.h
我看了第3个和第8个,实际上他们只有:
struct udphdr {
u_short uh_sport; /* source port */
u_short uh_dport; /* destination port */
u_short uh_ulen; /* udp length */
u_short uh_sum; /* udp checksum */
};
虽然matlab链接有:
/* UDP header as specified by RFC 768, August 1980. */
#ifdef __FAVOR_BSD
struct udphdr
{
u_int16_t uh_sport; /* source port */
u_int16_t uh_dport; /* destination port */
u_int16_t uh_ulen; /* udp length */
u_int16_t uh_sum; /* udp checksum */
};
#else
struct udphdr
{
u_int16_t source;
u_int16_t dest;
u_int16_t len;
u_int16_t check;
};
#endif
我该怎么办?他们提到我应该有pthread库,但我找不到太多信息。
感谢您的帮助。
安托