You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Colin Patrick McCabe (JIRA)" <ji...@apache.org> on 2015/05/19 19:17:02 UTC

[jira] [Commented] (HADOOP-11975) Native code needs to be built to match the 32/64 bitness of the JVM

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

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

This should be handled by {{JNIFlags.cmake}}.

{code}
# If JVM_ARCH_DATA_MODEL is 32, compile all binaries as 32-bit.
# This variable is set by maven.
if (JVM_ARCH_DATA_MODEL EQUAL 32)
    # Force 32-bit code generation on amd64/x86_64, ppc64, sparc64
    if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_SYSTEM_PROCESSOR MATCHES ".*64")
        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
        set(CMAKE_LD_FLAGS "${CMAKE_LD_FLAGS} -m32")
    endif ()
    if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64")
        # Set CMAKE_SYSTEM_PROCESSOR to ensure that find_package(JNI) will use
        # the 32-bit version of libjvm.so.
        set(CMAKE_SYSTEM_PROCESSOR "i686")
    endif ()
endif (JVM_ARCH_DATA_MODEL EQUAL 32)
{code}

You should investigate why this is not working for you.  Perhaps your architecture is not x86?  Or perhaps your JVM is not setting {{JVM_ARCH_DATA_MODEL}}?

> Native code needs to be built to match the 32/64 bitness of the JVM
> -------------------------------------------------------------------
>
>                 Key: HADOOP-11975
>                 URL: https://issues.apache.org/jira/browse/HADOOP-11975
>             Project: Hadoop Common
>          Issue Type: Sub-task
>          Components: build
>    Affects Versions: 2.7.0
>         Environment: Solaris
>            Reporter: Alan Burlison
>            Assignee: Alan Burlison
>
> When building with a 64-bit JVM on Solaris the following error occurs at the link stage of building the native code:
>      [exec] ld: fatal: file /usr/jdk/instances/jdk1.8.0/jre/lib/amd64/server/libjvm.so: wrong ELF class: ELFCLASS64
>      [exec] collect2: error: ld returned 1 exit status
>      [exec] make[2]: *** [target/usr/local/lib/libhadoop.so.1.0.0] Error 1
>      [exec] make[1]: *** [CMakeFiles/hadoop.dir/all] Error 2
> The compilation flags in the makefiles need to explicitly state if 32 or 64 bit code is to be generated, to match the JVM.



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