Opened 3 years ago

Closed 2 years ago

#64528 closed defect (fixed)

x265 fails to build for ppc on 10.6.8 (Rosetta): correct syntax for OVERRIDE_SYSTEM_PROCESSOR in Cmake?

Reported by: barracuda156 Owned by: barracuda156
Priority: Normal Milestone:
Component: ports Version: 2.7.1
Keywords: powerpc, snowleopard, rosetta Cc:
Port: x265

Description

cc1plus: error: unrecognized command line option "-march=i686"
cc1plus: error: unrecognized command line option "-march=i686"
cc1plus: error: unrecognized command line option "-march=i686"
make[2]: *** [common/CMakeFiles/common.dir/lowpassdct.cpp.o] Error 1
make[2]: *** [common/CMakeFiles/common.dir/pixel.cpp.o] Error 1
make[2]: *** [common/CMakeFiles/common.dir/dct.cpp.o] Error 1
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_multimedia_x265/x265/work/build'
make[1]: *** [common/CMakeFiles/common.dir/all] Error 2
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_multimedia_x265/x265/work/build'
make: *** [all] Error 2
make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_multimedia_x265/x265/work/build'
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_multimedia_x265/x265/work/build" && /usr/bin/make -j4 -w all VERBOSE=ON 
Exit code: 2
Error: Failed to build x265: command execution failed

Attachments (1)

main.log (31.8 KB) - added by barracuda156 3 years ago.

Download all attachments as: .zip

Change History (7)

Changed 3 years ago by barracuda156

Attachment: main.log added

comment:1 Changed 3 years ago by barracuda156

This is where those flags come from /_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_multimedia_x265/x265/work/x265-3.4/source/CMakeLists.txt:

if(GCC)
    add_definitions(-Wall -Wextra -Wshadow)
    add_definitions(-D__STDC_LIMIT_MACROS=1)
    add_definitions(-std=c++11)
    if(ENABLE_PIC)
         add_definitions(-fPIC)
    endif(ENABLE_PIC)
    if(NATIVE_BUILD)
        if(INTEL_CXX)
            add_definitions(-xhost)
        else()
            add_definitions(-march=native)
        endif()
    elseif(X86 AND NOT X64)
        string(FIND "${CMAKE_CXX_FLAGS}" "-march" marchPos)
        if(marchPos LESS "0")
            add_definitions(-march=i686)
            if(WIN32 AND NOT INTEL_CXX AND NOT CLANG AND
               CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)
                add_definitions(-mpreferred-stack-boundary=2)
            endif()
        endif()
    endif()

And then CMake generates this in /_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_multimedia_x265/x265/work/build/encoder/CMakeFiles/encoder.dir/flags.make:

CXX_FLAGSppc = -pipe -Os -DNDEBUG -I/opt/local/include -arch ppc -mmacosx-version-min=10.6   -Wall -Wextra -Wshadow -std=gnu++98 -march=i686 -ffast-math -fno-exceptions -Wno-uninitialized

CXX_FLAGS = -pipe -Os -DNDEBUG -I/opt/local/include -arch ppc -mmacosx-version-min=10.6   -Wall -Wextra -Wshadow -std=gnu++98 -march=i686 -ffast-math -fno-exceptions -Wno-uninitialized

Which obviously fails.

comment:2 Changed 3 years ago by barracuda156

This looks problematic: no ppc32 option at all.

# System architecture detection
string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" SYSPROC)
set(X86_ALIASES x86 i386 i686 x86_64 amd64)
set(ARM_ALIASES armv6l armv7l aarch64)
list(FIND X86_ALIASES "${SYSPROC}" X86MATCH)
list(FIND ARM_ALIASES "${SYSPROC}" ARMMATCH)
set(POWER_ALIASES ppc64 ppc64le)
list(FIND POWER_ALIASES "${SYSPROC}" POWERMATCH)
if("${SYSPROC}" STREQUAL "" OR X86MATCH GREATER "-1")
    set(X86 1)
    add_definitions(-DX265_ARCH_X86=1)
    if(CMAKE_CXX_FLAGS STREQUAL "-m32")
        message(STATUS "Detected x86 target processor")
    elseif("${CMAKE_SIZEOF_VOID_P}" MATCHES 8)
        set(X64 1)
        add_definitions(-DX86_64=1)
        message(STATUS "Detected x86_64 target processor")
    endif()
elseif(POWERMATCH GREATER "-1")
    message(STATUS "Detected POWER target processor")
    set(POWER 1)
    add_definitions(-DX265_ARCH_POWER=1)
    if("${CMAKE_SIZEOF_VOID_P}" MATCHES 8)
        set(PPC64 1)
        add_definitions(-DPPC64=1)
        message(STATUS "Detected POWER PPC64 target processor")
    endif()
elseif(ARMMATCH GREATER "-1")
    if(CROSS_COMPILE_ARM)
        message(STATUS "Cross compiling for ARM arch")
    else()
        set(CROSS_COMPILE_ARM 0)
    endif()
    set(ARM 1)
    if("${CMAKE_SIZEOF_VOID_P}" MATCHES 8)
        message(STATUS "Detected ARM64 target processor")
        set(ARM64 1)
        add_definitions(-DX265_ARCH_ARM=1 -DX265_ARCH_ARM64=1 -DHAVE_ARMV6=0)
    else()
        message(STATUS "Detected ARM target processor")
        add_definitions(-DX265_ARCH_ARM=1 -DX265_ARCH_ARM64=0 -DHAVE_ARMV6=1)
    endif()
else()
    message(STATUS "CMAKE_SYSTEM_PROCESSOR value `${CMAKE_SYSTEM_PROCESSOR}` is unknown")
    message(STATUS "Please add this value near ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE}")
endif()
Version 0, edited 3 years ago by barracuda156 (next)

comment:3 Changed 3 years ago by barracuda156

Does anyone know correct syntax for this?

if(DEFINED OVERRIDE_SYSTEM_PROCESSOR)
set(CMAKE_SYSTEM_PROCESSOR ${OVERRIDE_SYSTEM_PROCESSOR})
endif()

On 10.6 PPC x265 just builds with no changes to port file. So the only problem is that on 10.6.8 X86 gets forced by Cmake. Macports has this patch quoted above, however adding configure.env-append OVERRIDE_SYSTEM_PROCESSOR="POWER" does not help.

comment:4 Changed 3 years ago by barracuda156

Summary: x265 fails to build for ppc on 10.6.8 (Rosetta): error: unrecognized command line option "-march=i686"x265 fails to build for ppc on 10.6.8 (Rosetta): correct syntax for OVERRIDE_SYSTEM_PROCESSOR in Cmake?

comment:5 Changed 2 years ago by barracuda156

Ok, this works:

platform darwin 10 {
    # https://trac.macports.org/ticket/64528
    if {${build_arch} eq "ppc"} {
        configure.args-append -DOVERRIDE_SYSTEM_PROCESSOR="ppc"
    }
}

But the build fails due to: https://trac.macports.org/ticket/64781

UPD. Fixed. PR: https://github.com/macports/macports-ports/pull/15586

Last edited 2 years ago by barracuda156 (previous) (diff)

comment:6 Changed 2 years ago by barracuda156

Owner: set to barracuda156
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.