detect x86 on x64 machine

Issue #58 closed
Former user created an issue

compiling in ubuntu 13.04

clone a few minutes ago.

$ hg clone https://bitbucket.org/multicoreware/x265
$ cd x265/build/linux
$ ./make-Makefiles.bash
$ uname -a
  Linux 3.8.0-35-generic #50-Ubuntu SMP Dec 3 2013 x86_64
$ make
-- cmake version 2.8.10.1
-- Detected x86 system processor
-- Found Yasm 1.2.0 to build assembly primitives
-- x265 version unknown
-- Configuring done
-- Generating done
-- Build files have been written to: /opt/x265/build/linux
Linking CXX executable x265
[100%] Built target cli
Scanning dependencies of target x265-static
Linking CXX static library libx265.a
[100%] Built target x265-static

Comments (8)

  1. djcj

    You can fix this, but it's not like it makes much of a difference (it didn't build 32 bits binaries on 64 bits machines).

    --- a/source/CMakeLists.txt
    +++ b/source/CMakeLists.txt
    @@ -34,16 +34,16 @@
    
     # System architecture detection
     string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" SYSPROC)
    -set(X86_ALIASES x86 i386 i686 x86_64 amd64)
    +set(X86_ALIASES x86 i386 i686)
     list(FIND X86_ALIASES "${SYSPROC}" X86MATCH)
     if("${SYSPROC}" STREQUAL "" OR X86MATCH GREATER "-1")
         message(STATUS "Detected x86 system processor")
         set(X86 1)
         add_definitions(-DX265_ARCH_X86=1)
    -    if("${CMAKE_SIZEOF_VOID_P}" MATCHES 8)
    -        set(X64 1)
    -        add_definitions(-DX86_64=1)
    -    endif()
    +elseif(${SYSPROC} STREQUAL "x86_64" OR "amd64")
    +    message(STATUS "Detected x64 system processor")
    +    set(X64 1)
    +    add_definitions(-DX265_ARCH_X86=1 -DX86_64=1)
     elseif(${SYSPROC} STREQUAL "armv6l")
         message(STATUS "Detected ARM system processor")
         set(ARM 1)
    
  2. Steve Borho

    The determination of 64bit from 32bit x86 happens later in the cmake script, essentially by compiling a sample program and printing sizeof(void*). So it is your compiler which determines whether the binary will be 32bit or 64bit.

  3. Log in to comment