[ 
https://issues.apache.org/jira/browse/HADOOP-11484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14288177#comment-14288177
 ] 

Colin Patrick McCabe commented on HADOOP-11484:
-----------------------------------------------

bq. this looks like it addresses the ARM compile issue (we'll have to trust you 
that it works), but there's some asm code in the bswap method that isn't 
ifdef'd out on non-x86 systems.  Is there an easy way to downgrade to non-ASM 
alternatives on other CPU families, so make sure this patch helps compilation 
on all platforms?

The tricky thing here is that x86 has gone by many names over the years: x86, 
i32, _x86, x86_64, amd64, etc. etc.  Since we support a bunch of platforms, 
such as Windows, Linux, and HP-UX, it's difficult to make sure that we aren't 
accidentally leaving out one of them with our ifdef.

I guess file a follow-on JIRA if you'd like to do this.  I'll review, if 
necessary.  In the meantime, users of "alternative" CPU architectures can 
compile without {{\-pnative}}.

> hadoop-mapreduce-client-nativetask fails to build on ARM AARCH64 due to x86 
> asm statements
> ------------------------------------------------------------------------------------------
>
>                 Key: HADOOP-11484
>                 URL: https://issues.apache.org/jira/browse/HADOOP-11484
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: native
>         Environment: ARM aarch64 development board
>            Reporter: Edward Nevill
>            Assignee: Edward Nevill
>            Priority: Minor
>             Fix For: 3.0.0
>
>         Attachments: HADOOP-11484.001.patch
>
>
> Hadoop fails to build on ARM aarch64 (or any non x86 platform) because of the 
> following in
> hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/lib/primitives.h
> {noformat}
> /**
>  * little-endian to big-endian or vice versa
>  */
> inline uint32_t bswap(uint32_t val) {
>   __asm__("bswap %0" : "=r" (val) : "0" (val));
>   return val;
> }
> inline uint64_t bswap64(uint64_t val) {
> #ifdef __X64
>   __asm__("bswapq %0" : "=r" (val) : "0" (val));
> #else
>   uint64_t lower = val & 0xffffffffU;
>   uint32_t higher = (val >> 32) & 0xffffffffU;
>   lower = bswap(lower);
>   higher = bswap(higher);
>   return (lower << 32) + higher;
> #endif
>   return val;
> }
> {noformat}
> The following also fails in
> hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/native/src/util/Checksum.cc
> {noformat}
> static uint32_t cpuid(uint32_t eax_in) {
>   uint32_t eax, ebx, ecx, edx;
> #  if defined(__PIC__) && !defined(__LP64__)
> // 32-bit PIC code uses the ebx register for the base offset --
> // have to save and restore it on the stack
>   asm("pushl %%ebx\n\t"
>       "cpuid\n\t"
>       "movl %%ebx, %[ebx]\n\t"
>       "popl %%ebx" : "=a" (eax), [ebx] "=r"(ebx), "=c"(ecx), "=d"(edx) : "a" 
> (eax_in) 
>       : "cc");
> #  else
>   asm("cpuid" : "=a" (eax), "=b"(ebx), "=c"(ecx), "=d"(edx) : "a"(eax_in)
>       : "cc");
> #  endif
>   return ecx;
> }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to