[x265] How to build the Makefile with cmake for iOS compiling?
chen
chenm003 at 163.com
Tue Jun 28 19:37:06 CEST 2016
Sorry for delay, I am working on other high-priority patch.
I still can't reproduce your problem, but after read cmake source, I guess the problem on CMAKE_OSX_DEPLOYMENT_TARGET
Could you try this new patch?
At 2016-06-28 17:18:14,"steven.Hu" <huhai8274 at 163.com> wrote:
If I disable assembly in my cmake configure, I successfully compiled the 'libx265.a' library.But I found that the library without assembly optimization do encoding more slowly than expected.So I need the assembly version of 'libx265.a'!Then I installed Xcode4.6.3 which has llvm gcc 4.2 for iOS platform.
I changed the 'ios.cmake' under 'build/arm-ios' to:
set(CROSS_COMPILE_ARM 1)
set(CMAKE_SYSTEM_NAME Darwin)
set(CMAKE_SYSTEM_PROCESSOR armv7l)
set(CMAKE_C_COMPILER /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2)
set(CMAKE _CXX_COMPILER /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-llvm-g++-4.2)
set(CMAKE_FIND_ROOT_PATH /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk)
# Skip the platform compiler checks for cross compiling
set(CMAKE_C_COMPILER_WORKS TRUE)
set(CMAKE_CXX_COMPILER_WORKS TRUE)
and 'make-Makefiles.bash' under 'build/arm-ios' to:
IOS_PLATFORM_SDK=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk
IOS_FLAGS="-march=armv7 -mcpu=cortex-a8 -mfpu=neon -pthread -isysroot $IOS_PLATFORM_SDK -I$IOS_PLATFORM_SDK/usr/include -I$IOS_PLATFORM_SDK/usr/include/c++/4.2.1 -miphoneos-version-min=4.0 -Qunused-arguments -DHAVE_STRTOK_R"
cmake -DCMAKE_TOOLCHAIN_FILE=ios.cmake -DCMAKE_C_FLAGS="$IOS_FLAGS" -DCMAKE_CXX_FLAGS="$IOS_FLAGS" -DIOS_PLATFORM_SDK="$IOS_PLATFORM_SDK" -G "Unix Makefiles" ../../source && cmake ../../source
I can generate the 'Makefile' by run 'make-Makefiles.bash', but when I run 'make' to compile the codes, it reports many warnings like:
In file included from /Applications/Xcode.app/Contents/Developer/Playforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/include/semaphore.h:27,
from .../source/common/threading.h:36,
from .../source/common/frame.h:29,
from .../source/common/analysis.cpp:27,
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/include/sys/fcntl.h:493: warning: 'int flock(int, int)' hides constructor for 'struck flock'
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneSDK6.1.sdk/usr/include/sys/proc.h:78,
from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneSDK6.1.sdk/usr/include/sys/sysctl.h:84,
from .../source/common/threading.h:43,
from .../source/common/frame.h:29,
from .../source/encoder/analysis.cpp:27:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneSDK6.1.sdk/usr/include/sys/event.h:317: warning:'int kevent(int, const kevent*, int, kevent*, int, const timesspec*)' hides the constructor for 'struct kevent'
and finally stopped at the error:
.../source/encoder/analysis.cpp: In member function 'void x265::Analysis::checkBidir2Nx2N(x265::Mode&, x265::Mode&, const x265::CUGeom&)':
.../source/encoder/analysis.cpp:2190:error:invalid use of incomplete type 'class x265::MotionReference'
.../source/encoder/reference.h:38:error:forward declaration of 'class x265::MotionReference'
.../source/encoder/analysis.cpp:2190:error:invalid use of incomplete type 'class x265::MotionReference'
.../source/encoder/reference.h:38:error:forward declaration of 'class x265::MotionReference'
.../source/encoder/analysis.cpp:2190:error:invalid use of incomplete type 'class x265::MotionReference'
.../source/encoder/reference.h:38:error:forward declaration of 'class x265::MotionReference'
make[2]: *** [encoder/CMakeFiles/encoder.dir/analysis.cpp.o] Error 1
make[1]: *** [encoder/CMakeFiles/encoder.dir/all] Error 2
make: *** [all] Error 2
What's the problem?Did I configure settings right?
在 2016-06-24 22:44:51,"chen" <chenm003 at 163.com> 写道:
We use gcc assembly syntax, so you have to disable assembly in your cmake configure.
At 2016-06-24 13:55:15,"steven.Hu" <huhai8274 at 163.com> wrote:
I move '-arch armv7 -mfpu=neon -pthread -isysroot $IOS_PLATFORM_SDK -miphoneos-version-min=7.0 -Qunused-arguments' to CMakeLists.txt under 'source' diretory, and I can get through cmake command to Makefile.But when I run 'make', the compiling failed when the compiler(Clang or yasm?Since I installed yasm on my Mac and I saw it detected it) try to compile file '
source/common/arm/asm.S'.Error info is:
[ 55%] Generating dct-a.S.o
/Users/huhai/dev/sources/video_opensource/x265_new/x265_dev/source/common/arm/asm.S:38:1: error: unknown directive
.fpu neon
^
/Users/huhai/dev/sources/video_opensource/x265_new/x265_dev/source/common/arm/dct-a.S:26:17: error: unexpected token in '.section' directive
.section .rodata
^
make[2]: *** [dct-a.S.o] Error 1
make[1]: *** [CMakeFiles/x265-static.dir/all] Error 2
make: *** [all] Error 2
Seems like the asm compiler dosen't support such syntax!
在 2016-06-24 12:14:47,"steven.Hu" <huhai8274 at 163.com> 写道:
Thank you very much!
在 2016-06-24 11:58:41,"chen" <chenm003 at 163.com> 写道:
I see your cmake generate two of -isysroot, the second one for native, I will take a look tomorrow.
At 2016-06-24 11:55:26,"steven.Hu" <huhai8274 at 163.com> wrote:
I tried cmake 3.5.2 and 3.6.0 rc3(I used rc2 just now), the same problem occured!I used Xcode 7.3.1(Version 7.3.1 (7D1014)).
At 2016-06-24 11:43:51, "chen" <chenm003 at 163.com> wrote:
I take a look, my cmake is brew 3.5.2 version
In your message, there are AppleClang otherthan my Clang, I guess the problem in cmake
在 2016-06-24 11:31:15,"steven.Hu" <huhai8274 at 163.com> 写道:
I'm using cmake 3.6.0, that's the highest version I can find yet.Which version of cmake do you use?
在 2016-06-24 11:27:22,"chen" <chenm003 at 163.com> 写道:
No, it is native compiler, we need cross-compiler
try with upgrade your cmake
At 2016-06-24 11:26:01,"steven.Hu" <huhai8274 at 163.com> wrote:
'Your system' means Mac OS X?I'm using Max OS X 10.11.5.
If remove '-DCMAKE_C_FLAGS="$IOS_CFLAGS" -DCMAKE_CXX_FLAGS="$IOS_CFLAGS" -DIOS_PLATFORM_SDK="$IOS_PLATFORM_SDK"' in make-Makefiles.bash, the C comiler check will succeed!
I found that there is '-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk' in the compiling command, is it that cause the problem?
在 2016-06-24 11:10:38,"chen" <chenm003 at 163.com> 写道:
You clang version same as me, but your cmake is lower, and looks your system can't support armv7, are you use ARM64?
At 2016-06-24 11:07:05,"steven.Hu" <huhai8274 at 163.com> wrote:
I've tried your patch, but there is a new problem.When I run 'make-Makefiles.bash' under 'build/arm-ios/' the errors occured:
-- cmake version 3.6.0-rc2
-- The C compiler identification is AppleClang 7.3.0.7030031
-- The CXX compiler identification is AppleClang 7.3.0.7030031
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -- broken
CMake Error at /Applications/CMake.app/Contents/share/cmake-3.6/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /Users/huhai/dev/sources/video_opensource/x265_new/x265_dev/build/arm-ios/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_83901/fast"
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f
CMakeFiles/cmTC_83901.dir/build.make CMakeFiles/cmTC_83901.dir/build
Building C object CMakeFiles/cmTC_83901.dir/testCCompiler.c.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-arch armv7 -mfpu=neon -pthread -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk
-miphoneos-version-min=7.0 -Qunused-arguments -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk
-o CMakeFiles/cmTC_83901.dir/testCCompiler.c.o -c
/Users/huhai/dev/sources/video_opensource/x265_new/x265_dev/build/arm-ios/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_83901
/Applications/CMake.app/Contents/bin/cmake -E cmake_link_script
CMakeFiles/cmTC_83901.dir/link.txt --verbose=1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-arch armv7 -mfpu=neon -pthread -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk
-miphoneos-version-min=7.0 -Qunused-arguments -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk
-Wl,-headerpad_max_install_names
CMakeFiles/cmTC_83901.dir/testCCompiler.c.o -o cmTC_83901
ld: warning: ignoring file
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/lib/libSystem.tbd,
missing required architecture armv7 in file
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/lib/libSystem.tbd
ld: dynamic main executables must link with libSystem.dylib for
architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
make[1]: *** [cmTC_83901] Error 1
make: *** [cmTC_83901/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:19 (project)
-- Configuring incomplete, errors occurred!
See also "/Users/huhai/dev/sources/video_opensource/x265_new/x265_dev/build/arm-ios/CMakeFiles/CMakeOutput.log".
See also "/Users/huhai/dev/sources/video_opensource/x265_new/x265_dev/build/arm-ios/CMakeFiles/CMakeError.log".
The C compiler check failed!And I found that it's the '-DCMAKE_C_FLAGS="$IOS_CFLAGS" -DCMAKE_CXX_FLAGS="$IOS_CFLAGS" -DIOS_PLATFORM_SDK="$IOS_PLATFORM_SDK"' cause the problem!
How I can fix it, do you have some ideas?
在 2016-06-24 07:49:20,"huhai" <huhai8274 at 163.com> 写道:
Thank you!Sure,I'll have a try!
发自我的 iPhone
在 2016年6月24日,06:44,chen <chenm003 at 163.com> 写道:
Could you try my new patch?
At 2016-06-23 11:20:02,"steven.Hu" <huhai8274 at 163.com> wrote:
I found 'arm-linux' directory under 'build' directory, and I changed the 'crosscompile.cmake' to the following:
# CMake toolchain file for cross compiling x265 for ARM arch
# This feature is only supported as experimental. Use with caution.
# Please report bugs on bitbucket
# Run cmake with: cmake -DCMAKE_TOOLCHAIN_FILE=crosscompile.cmake -G "Unix Makefiles" ../../source && ccmake ../../source
set(CROSS_COMPILE_ARM 1)
set(CMAKE_SYSTEM_NAME Darwin)
set(CMAKE_SYSTEM_PROCESSOR armv7l)
# specify the cross compiler
set(CMAKE_C_COMPILER /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang)
set(CMAKE_CXX_COMPILER /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++)
# specify the target environment
SET(CMAKE_FIND_ROOT_PATH /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/)
Then I run 'cmake -DCMAKE_TOOLCHAIN_FILE=crosscompile.cmake -G "Unix Makefiles" ../../source && ccmake ../../source' from the arm-linux directory, and I got the'Makefile' without any error info.
But when run 'make', it reported many errors, which may be caused by incorrect headers including.I found the compiler uses the headers under '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk', instead, it should use the headers under '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/'.
How can I fix it? Any suggestion would be appreciated!
_______________________________________________
x265-devel mailing list
x265-devel at videolan.org
https://mailman.videolan.org/listinfo/x265-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20160629/275e9c44/attachment-0001.html>
More information about the x265-devel
mailing list