hadoop 2的如下文件hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/util/bulk_crc32.c存在如下代码:
inline uint64_t _mm_crc32_u64(uint64_t crc, uint64_t value) {
asm("crc32q %[value], %[crc]\n" : [crc] "+r" (crc) : [value] "rm" (value));
return crc;
}
# endif
inline uint32_t _mm_crc32_u32(uint32_t crc, uint32_t value) {
asm("crc32l %[value], %[crc]\n" : [crc] "+r" (crc) : [value] "rm" (value));
return crc;
}
inline uint32_t _mm_crc32_u16(uint32_t crc, uint16_t value) {
asm("crc32w %[value], %[crc]\n" : [crc] "+r" (crc) : [value] "rm" (value));
return crc;
}
inline uint32_t _mm_crc32_u8(uint32_t crc, uint8_t value) {
asm("crc32b %[value], %[crc]\n" : [crc] "+r" (crc) : [value] "rm" (value));
return crc;
}
在开发机器上可以正常编译,但是在运营机器上无法编译,貌似是cpu内核不支持,错误提示:
/tmp/ccCSuKMW.s: Assembler messages:
/tmp/ccCSuKMW.s:360: Error: no such instruction: `crc32q %rsi,%rdi'
/tmp/ccCSuKMW.s:378: Error: no such instruction: `crc32l %esi,%edi'
/tmp/ccCSuKMW.s:396: Error: no such instruction: `crc32w %si,%edi'
/tmp/ccCSuKMW.s:414: Error: no such instruction: `crc32b %sil,%edi'
/tmp/ccCSuKMW.s:712: Error: no such instruction: `crc32q (%rcx),%rax'
/tmp/ccCSuKMW.s:761: Error: no such instruction: `crc32b %al,%ecx'
/tmp/ccCSuKMW.s:772: Error: no such instruction: `crc32w %ax,%ecx'
/tmp/ccCSuKMW.s:804: Error: no such instruction: `crc32b %al,%ecx'
/tmp/ccCSuKMW.s:823: Error: no such instruction: `crc32w %ax,%ecx'
/tmp/ccCSuKMW.s:833: Error: no such instruction: `crc32l (%rsi),%ecx'
/tmp/ccCSuKMW.s:847: Error: no such instruction: `crc32l (%rsi),%ecx'
/tmp/ccCSuKMW.s:868: Error: no such instruction: `crc32b %al,%ecx'
cpu信息是:
processor : 3
vendor_id : GenuineIntel
cpu family : 6
model : 26
model name : Intel(R) Xeon(R) CPU E5506 @ 2.13GHz