Macos 在mac OS X上编译x264时出现问题

Macos 在mac OS X上编译x264时出现问题,macos,compilation,x264,Macos,Compilation,X264,使用XCode中的命令行工具在Mac上编译x264()时遇到问题。以下步骤不起作用: git clone git://git.videolan.org/x264.git cd x264 ./configure make 这将导致以下错误: gcc -Wshadow -O3 -ffast-math -m64 -Wall -I. -I. -falign-loops=16 -mdynamic-no-pic -arch x86_64 -std=gnu99 -mpreferred-stack-boun

使用XCode中的命令行工具在Mac上编译x264()时遇到问题。以下步骤不起作用:

git clone git://git.videolan.org/x264.git
cd x264
./configure
make
这将导致以下错误:

gcc -Wshadow -O3 -ffast-math -m64  -Wall -I. -I. -falign-loops=16 -mdynamic-no-pic -arch x86_64 -std=gnu99 -mpreferred-stack-boundary=5  -I/usr/local/include    -I/usr/local/include   -fomit-frame-pointer -fno-tree-vectorize   -c -o x264.o x264.c
In file included from ./extras/cl.h:27,
                 from common/opencl.h:31,
                 from common/common.h:209,
                 from x264.c:33:
./extras/cl_platform.h:64:10: warning: #warning This path should never happen outside of internal operating system development. AvailabilityMacros do not function correctly here!
In file included from common/opencl.h:31,
                 from common/common.h:209,
                 from x264.c:33:
./extras/cl.h:1165: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘cl_mem’
./extras/cl.h:1175: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘cl_mem’
./extras/cl.h:1187: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘cl_int’
./extras/cl.h:1191: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘cl_int’
./extras/cl.h:1196: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘cl_int’
./extras/cl.h:1199: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘cl_int’
./extras/cl.h:1202: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
make: *** [x264.o] Error 1

如何使用最新的XCode命令行工具为Mac OS X编译x264?

在做了一些修改之后,我编写了以下脚本来解决这个问题。在此处为其他人发布:

#!/bin/bash                                                                                                                                                                                        

set -e

platform="MacOSX"
SDK="MacOSX10.8"

checkExists() {

    if [ ! -e $1 ]
    then
        echo "Didn't find: $1 -- try to locate parts of this to see how to fix the path"
        exit 1
    else
        echo "using $1"
    fi

}

root="/Applications/Xcode.app/Contents/Developer/Platforms/${platform}.platform/Developer"
oldRoot="/Developer/Platforms/${platform}.platform/Developer"

if [ ! -d "${root}" ]
then
    newRoot="${root}"
    root="${oldRoot}"
fi

if [ ! -d "${root}" ]
then
    echo " "
    echo "Oopsie.  You don't have an SDK root in either of these locations: "
    echo "   ${newRoot} "
    echo "   ${oldRoot}"
    echo " "
    exit 1
fi

export CC="/usr/bin/gcc"
export CFLAGS="-isysroot ${root}/SDKs/${SDK}.sdk -I ${root}/usr/include"

checkExists ${CC}
checkExists ${root}/SDKs/${SDK}.sdk

./configure --enable-shared --enable-static

make clean
make

在做了一些修改之后,我写了下面的脚本来解决这个问题。在此处为其他人发布:

#!/bin/bash                                                                                                                                                                                        

set -e

platform="MacOSX"
SDK="MacOSX10.8"

checkExists() {

    if [ ! -e $1 ]
    then
        echo "Didn't find: $1 -- try to locate parts of this to see how to fix the path"
        exit 1
    else
        echo "using $1"
    fi

}

root="/Applications/Xcode.app/Contents/Developer/Platforms/${platform}.platform/Developer"
oldRoot="/Developer/Platforms/${platform}.platform/Developer"

if [ ! -d "${root}" ]
then
    newRoot="${root}"
    root="${oldRoot}"
fi

if [ ! -d "${root}" ]
then
    echo " "
    echo "Oopsie.  You don't have an SDK root in either of these locations: "
    echo "   ${newRoot} "
    echo "   ${oldRoot}"
    echo " "
    exit 1
fi

export CC="/usr/bin/gcc"
export CFLAGS="-isysroot ${root}/SDKs/${SDK}.sdk -I ${root}/usr/include"

checkExists ${CC}
checkExists ${root}/SDKs/${SDK}.sdk

./configure --enable-shared --enable-static

make clean
make

这是当前版本中OpenCL的已知问题。您需要禁用OpenCL(./configure--disable OpenCL)或从

获取补丁。这是当前版本中OpenCL的已知问题。您需要禁用OpenCL(./configure--disable OpenCL)或从中获取修补程序