polyzz / libyuv

Automatically exported from code.google.com/p/libyuv
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Cannot build Libyuv ARM64 for iOS #423

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1) Visited this link:
https://sites.google.com/a/chromium.org/dev/developers/how-tos/depottools

then visited this link:
Howto: install the depot tools 
(https://sites.google.com/a/chromium.org/dev/developers/how-tos/install-depot-to
ols).

Then fetch depot_tools: 
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
Add depot_tools to your PATH:
$ export PATH=`pwd`/depot_tools:"$PATH"

2) Went back to Getting Started Page 
(https://code.google.com/p/libyuv/wiki/GettingStarted)

Create a working directory, enter it, and run:
 gclient config http://libyuv.googlecode.com/svn/trunk 
 gclient sync

 This will take 1 hour to download the files. Then, I added:
 target_os=['ios']; 
 to .gclient (a hidden file)

 Then I run the following 2 times:
 gclient sync --nohooks 

 3) Then I follow the instruction at (http://www.chromium.org/developers/how-tos/build-instructions-ios)
 echo "{ 'GYP_DEFINES': 'OS=ios', 'GYP_GENERATORS': 'ninja,xcode-ninja', }" > chromium.gyp_env
 fetch ios
 (now it takes another 1.5 hour to download stuff)

 3) Now I move into the "trunk" directory:
 cd trunk

 Then enter:

 GYP_DEFINES="OS=ios target_arch=armv7 target_subarch=64" GYP_CROSSCOMPILE=1 GYP_GENERATOR_FLAGS="output_dir=out_ios" ./gyp_libyuv -f ninja --depth=. libyuv_test.gyp 
 ninja -j7 -C out_ios/Debug-iphoneos libyuv_unittest
 ninja -j7 -C out_ios/Release-iphoneos libyuv_unittest

 Then all errors came out
 ninja -j7 -C out_ios/Debug-iphoneos libyuv_unittest
ninja: Entering directory `out_ios/Debug-iphoneos'
[7/103] ACTION(host) Generating DVTiPhoneSimulatorRemoteClient.h
2015-04-09 21:45:50.407 class-dump[16565:4367335] Unknown load command: 
0x00000024
2015-04-09 21:45:50.408 class-dump[16565:4367335] Unknown load command: 
0x0000002a
2015-04-09 21:45:50.408 class-dump[16565:4367335] Unknown load command: 
0x00000026
2015-04-09 21:45:50.408 class-dump[16565:4367335] Unknown load command: 
0x00000029
2015-04-09 21:45:50.408 class-dump[16565:4367335] Unknown load command: 
0x0000002b
[8/103] ACTION(host) Generating CoreSimulator.h
2015-04-09 21:45:50.407 class-dump[16569:4367339] Unknown load command: 
0x00000024
2015-04-09 21:45:50.408 class-dump[16569:4367339] Unknown load command: 
0x0000002a
2015-04-09 21:45:50.408 class-dump[16569:4367339] Unknown load command: 
0x00000026
2015-04-09 21:45:50.408 class-dump[16569:4367339] Unknown load command: 
0x00000029
2015-04-09 21:45:50.408 class-dump[16569:4367339] Unknown load command: 
0x0000002b
[9/103] CXX obj/source/libyuv_neon.scale_neon.armv7.o
FAILED: ../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF 
obj/source/libyuv_neon.scale_neon.armv7.o.d -DV8_DEPRECATION_WARNINGS 
-DDISABLE_NACL -DCHROMIUM_BUILD -DCR_CLANG_REVISION=223108 
-DUSE_LIBJPEG_TURBO=1 -DENABLE_CONFIGURATION_POLICY 
-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY 
-DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE -DDONT_EMBED_BUILD_METADATA 
-DCLD_VERSION=2 -DDISABLE_FTP_SUPPORT=1 -DUSE_LIBPCI=1 
-DDYNAMIC_ANNOTATIONS_ENABLED=1 -DWTF_USE_DYNAMIC_ANNOTATIONS=1 -Igen 
-I../../include -I../.. -isysroot 
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer
/SDKs/iPhoneOS8.2.sdk -O0 -gdwarf-2 -fvisibility=hidden -Wnewline-eof 
-miphoneos-version-min=7.0 -arch armv7 -Wendif-labels -Wno-unused-parameter 
-Wno-missing-field-initializers -Wno-selector-type-mismatch -Wheader-hygiene 
-Wno-char-subscripts -Wno-unneeded-internal-declaration 
-Wno-covered-switch-default -Wstring-conversion -Wno-c++11-narrowing 
-Wno-deprecated-register -Wno-inconsistent-missing-override -std=c++11 
-stdlib=libc++ -fno-rtti -fno-exceptions -fvisibility-inlines-hidden 
-fno-threadsafe-statics -Xclang -load -Xclang 
/Users/documents/libyuvworkdir/trunk/third_party/llvm-build/Release+Asserts/lib/
libFindBadConstructs.dylib -Xclang -add-plugin -Xclang find-bad-constructs 
-Xclang -plugin-arg-find-bad-constructs -Xclang check-weak-ptr-factory-order 
-Xclang -plugin-arg-find-bad-constructs -Xclang strict-virtual-specifiers 
-fcolor-diagnostics -fstack-protector-all -Wno-undefined-bool-conversion 
-Wno-tautological-undefined-compare  -c ../../source/scale_neon.cc -o 
obj/source/libyuv_neon.scale_neon.armv7.o
../../source/scale_neon.cc:935:5: error: expected immediate or register in 
shift operand
    LOAD1_DATA32_LANE(d0, 0)
    ^
../../source/scale_neon.cc:923:6: note: expanded from macro 'LOAD1_DATA32_LANE'
    "add        %6, %1, %5, lsl 2              \n"             \
     ^
<inline asm>:4:29: note: instantiated into assembly here
add        lr, r1, r12, lsl 2              

4) Now I try compiling only "libyuv" and not the unit test:
$ GYP_DEFINES="OS=ios target_arch=armv7 target_subarch=64" GYP_CROSSCOMPILE=1 
GYP_GENERATOR_FLAGS="output_dir=out_ios" ./gyp_libyuv -f ninja --depth=. 
libyuv.gyp 
Updating projects from gyp files...
$  ninja -j7 -C out_ios/Debug-iphoneos libyuv
ninja: Entering directory `out_ios/Debug-iphoneos'
[97/97] LIBTOOL-STATIC libyuv.a, POSTBUILDS
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/u
sr/bin/libtool: for architecture: armv7 file: 
arch/libyuv.armv7.a(libyuv.compare_posix.armv7.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/u
sr/bin/libtool: for architecture: armv7 file: 
arch/libyuv.armv7.a(libyuv.compare_win.armv7.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/u
sr/bin/libtool: for architecture: armv7 file: 
arch/libyuv.armv7.a(libyuv.convert_jpeg.armv7.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/u
sr/bin/libtool: for architecture: armv7 file: 
arch/libyuv.armv7.a(libyuv.mjpeg_decoder.armv7.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/u
sr/bin/libtool: for architecture: armv7 file: 
arch/libyuv.armv7.a(libyuv.rotate_mips.armv7.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/u
sr/bin/libtool: for architecture: armv7 file: 
arch/libyuv.armv7.a(libyuv.row_mips.armv7.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/u
sr/bin/libtool: for architecture: armv7 file: 
arch/libyuv.armv7.a(libyuv.row_posix.armv7.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/u
sr/bin/libtool: for architecture: armv7 file: 
arch/libyuv.armv7.a(libyuv.row_win.armv7.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/u
sr/bin/libtool: for architecture: armv7 file: 
arch/libyuv.armv7.a(libyuv.scale_mips.armv7.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/u
sr/bin/libtool: for architecture: armv7 file: 
arch/libyuv.armv7.a(libyuv.scale_posix.armv7.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/u
sr/bin/libtool: for architecture: armv7 file: 
arch/libyuv.armv7.a(libyuv.scale_win.armv7.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/u
sr/bin/libtool: for architecture: armv7s file: 
arch/libyuv.armv7s.a(libyuv.compare_posix.armv7s.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/u
sr/bin/libtool: for architecture: armv7s file: 
arch/libyuv.armv7s.a(libyuv.compare_win.armv7s.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/u
sr/bin/libtool: for architecture: armv7s file: 
arch/libyuv.armv7s.a(libyuv.convert_jpeg.armv7s.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/u
sr/bin/libtool: for architecture: armv7s file: 
arch/libyuv.armv7s.a(libyuv.mjpeg_decoder.armv7s.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/u
sr/bin/libtool: for architecture: armv7s file: 
arch/libyuv.armv7s.a(libyuv.rotate_mips.armv7s.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/u
sr/bin/libtool: for architecture: armv7s file: 
arch/libyuv.armv7s.a(libyuv.row_mips.armv7s.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/u
sr/bin/libtool: for architecture: armv7s file: 
arch/libyuv.armv7s.a(libyuv.row_posix.armv7s.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/u
sr/bin/libtool: for architecture: armv7s file: 
arch/libyuv.armv7s.a(libyuv.row_win.armv7s.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/u
sr/bin/libtool: for architecture: armv7s file: 
arch/libyuv.armv7s.a(libyuv.scale_mips.armv7s.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/u
sr/bin/libtool: for architecture: armv7s file: 
arch/libyuv.armv7s.a(libyuv.scale_posix.armv7s.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/u
sr/bin/libtool: for architecture: armv7s file: 
arch/libyuv.armv7s.a(libyuv.scale_win.armv7s.o) has no symbols

What is the expected output? What do you see instead?
The unit test won't compile at all.  The one without unit test compiles but 
give errors with no symbols, and the final library is not usable.

What version of the product are you using? On what operating system?
xCode 6.2.  I am trying to build iOS

Please provide any additional information below.
I've tried the above procedure 3 times with no success... please help. Is it 
possible to just import a ready-made libyuv.a file that has all the necessary 
libraries for armv7,armv7s and arm64?  If so can you provide them so we don't 
have to do all the complex compilation?  arm64 is becoming compulsory for Apple 
app store submission so your urgent help will be greatly appreciated.

Original issue reported on code.google.com by z...@integrityanalysis.com on 9 Apr 2015 at 9:57

GoogleCodeExporter commented 9 years ago
This appears to be a duplicate of issue 420
https://code.google.com/p/libyuv/issues/detail?id=420
and should be fixed in r1356 and later.

The sync time is entirely chrome dependencies - the only actual code dependency 
is for jpeg - the rest is the build infrastructure and unittests.

You can very quickly get the source code:
svn checkout https://libyuv.googlecode.com/svn/trunk/ libyuv

if you dont need the build files or tests.  Then add it to your xcode project.
chrome infrastructure is switching to git, and libyuv will likely transition 
shortly. This will change a few things, no doubt.

The current site has binaries for the psnr tool.  Perhaps that can be expanded 
in the future.

Original comment by fbarch...@chromium.org on 13 Apr 2015 at 12:13

GoogleCodeExporter commented 9 years ago
Hi,
Thanks for the response. Please be patient with me as I am new to this. I 
decided to follow your instruction and download the source code and compile it 
in Xcode. Here is what I did:
1) Download by svn checkout https://libyuv.googlecode.com/svn/trunk/ libyuv
2) Copy out the"source" and "include" folders and paste into an Xcode project
3) When I compile, it failed with error as reported in r1356.  So I manually do 
the change.  My first question is : why isn't the change already in my current 
revision, which is 1366?
4) Then I compile again and it skipped that first error. But then another bunch 
came up on row_x86.asm:

CompileC 
/Users/zekechan/Library/Developer/Xcode/DerivedData/testCompileLibyuv-grteznkiuv
iruldloyrpccfctfcw/Build/Intermediates/testCompileLibyuv.build/Debug-iphoneos/te
stCompileLibyuv.build/Objects-normal/armv7/row_x86.o source/row_x86.asm normal 
armv7 assembler-with-cpp com.apple.compilers.llvm.clang.1_0.compiler
    cd /Users/zekechan/Documents/Xcode/testCompileLibyuv
    export LANG=en_US.US-ASCII
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x assembler-with-cpp -arch armv7 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -fmodules -fmodules-cache-path=/Users/zekechan/Library/Developer/Xcode/DerivedData/ModuleCache -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wunreachable-code -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wshorten-64-to-32 -Wno-newline-eof -DDEBUG=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.2.sdk -fstrict-aliasing -Wdeprecated-declarations -g -Wno-sign-conversion -miphoneos-version-min=8.2 -iquote /Users/zekechan/Library/Developer/Xcode/DerivedData/testCompileLibyuv-grteznkiuviruldloyrpccfctfcw/Build/Intermediates/testCompileLibyuv.build/Debug-iphoneos/testCompileLibyuv.build/testCompileLibyuv-generated-files.hmap -I/Users/zekechan/Library/Developer/Xcode/DerivedData/testCompileLibyuv-grteznkiuviruldloyrpccfctfcw/Build/Intermediates/testCompileLibyuv.build/Debug-iphoneos/testCompileLibyuv.build/testCompileLibyuv-own-target-headers.hmap -I/Users/zekechan/Library/Developer/Xcode/DerivedData/testCompileLibyuv-grteznkiuviruldloyrpccfctfcw/Build/Intermediates/testCompileLibyuv.build/Debug-iphoneos/testCompileLibyuv.build/testCompileLibyuv-all-target-headers.hmap -iquote /Users/zekechan/Library/Developer/Xcode/DerivedData/testCompileLibyuv-grteznkiuviruldloyrpccfctfcw/Build/Intermediates/testCompileLibyuv.build/Debug-iphoneos/testCompileLibyuv.build/testCompileLibyuv-project-headers.hmap -iquoteinclude -iquoteinclude/libyuv -I/Users/zekechan/Library/Developer/Xcode/DerivedData/testCompileLibyuv-grteznkiuviruldloyrpccfctfcw/Build/Products/Debug-iphoneos/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/zekechan/Library/Developer/Xcode/DerivedData/testCompileLibyuv-grteznkiuviruldloyrpccfctfcw/Build/Intermediates/testCompileLibyuv.build/Debug-iphoneos/testCompileLibyuv.build/DerivedSources/armv7 -I/Users/zekechan/Library/Developer/Xcode/DerivedData/testCompileLibyuv-grteznkiuviruldloyrpccfctfcw/Build/Intermediates/testCompileLibyuv.build/Debug-iphoneos/testCompileLibyuv.build/DerivedSources -F/Users/zekechan/Library/Developer/Xcode/DerivedData/testCompileLibyuv-grteznkiuviruldloyrpccfctfcw/Build/Products/Debug-iphoneos -MMD -MT dependencies -MF /Users/zekechan/Library/Developer/Xcode/DerivedData/testCompileLibyuv-grteznkiuviruldloyrpccfctfcw/Build/Intermediates/testCompileLibyuv.build/Debug-iphoneos/testCompileLibyuv.build/Objects-normal/armv7/row_x86.d --serialize-diagnostics /Users/zekechan/Library/Developer/Xcode/DerivedData/testCompileLibyuv-grteznkiuviruldloyrpccfctfcw/Build/Intermediates/testCompileLibyuv.build/Debug-iphoneos/testCompileLibyuv.build/Objects-normal/armv7/row_x86.dia -c /Users/zekechan/Documents/Xcode/testCompileLibyuv/source/row_x86.asm -o /Users/zekechan/Library/Developer/Xcode/DerivedData/testCompileLibyuv-grteznkiuviruldloyrpccfctfcw/Build/Intermediates/testCompileLibyuv.build/Debug-iphoneos/testCompileLibyuv.build/Objects-normal/armv7/row_x86.o

/Users/zekechan/Documents/Xcode/testCompileLibyuv/source/row_x86.asm:2:18: 
error: unexpected token in argument list
; Copyright 2012 The LibYuv Project Authors. All rights reserved.
....

Do you have a version that has been tested to compile on Xcode with ARM64?  Any 
help will be much appreciated.

Many thanks,

Zeke

Original comment by z...@integrityanalysis.com on 13 Apr 2015 at 10:18

GoogleCodeExporter commented 9 years ago
dont compile row_x86.asm.  Thats intel assembly for yasm, which is not 
supported... especially on Arm.

walking thru the normal procedure
create a .gclient for ios

solutions = [
  { "name"        : "trunk",
    "url"         : "https://libyuv.googlecode.com/svn/trunk",
    "deps_file"   : "DEPS",
    "managed"     : True,
    "custom_deps" : {
    },
    "safesync_url": "",
  },
];target_os=['ios'];

note the target_os.  then gclient sync
from src folder

a regular 32 bit build is

GYP_DEFINES="OS=ios target_arch=armv7" GYP_CROSSCOMPILE=1  
GYP_GENERATOR_FLAGS="output_dir=out_ios" ./build/gyp_chromium -f ninja 
--depth=. libyuv_test.gyp
ninja -j8 -C out_ios/Debug-iphoneos
ninja -j8 -C out_ios/Release-iphoneos

and a 64 bit build is

GYP_DEFINES="OS=ios target_arch=armv7 target_subarch=64" GYP_CROSSCOMPILE=1 
GYP_GENERATOR_FLAGS="output_dir=out_ios" ./gyp_libyuv -f ninja --depth=. 
libyuv_test.gyp 
 ninja -j7 -C out_ios/Debug-iphoneos libyuv_unittest
 ninja -j7 -C out_ios/Release-iphoneos libyuv_unittest

I do get warnings on 64 bit, but it builds okay.
I used r1366 thats current head version.

I noticed OSX for chrome has a build error, while it works okay for libyuv, so 
thats likely a newer xcode/clang.  Will file a bug and have a fix for that in 
about an hour

Original comment by phthor...@gmail.com on 13 Apr 2015 at 11:01

GoogleCodeExporter commented 9 years ago
r1368 fixes osx build error - unused variable.

Original comment by fbarch...@chromium.org on 14 Apr 2015 at 2:51

GoogleCodeExporter commented 9 years ago
Hi, Many thanks for the prompt response, which enabled me to finally compile 
iOS for ARM64 using Xcode 6.2 directly on the source code. Much much 
appreciated! Here are the steps in case anyone else might find beneficial:
1) Download by svn checkout https://libyuv.googlecode.com/svn/trunk/ libyuv
2) Copy the"source" and "include" folders and paste into an Xcode project
3) Delete the two .asm files in source - they will not compile
4) Apply the change as reported in r1356 - now it should compile:
===================================================================
--- source/scale_neon.cc    (revision 1355)
+++ source/scale_neon.cc    (working copy)
@@ -920,7 +920,7 @@
 // the x/dx stepping
 #define LOAD1_DATA32_LANE(dn, n)                               \
     "lsr        %5, %3, #16                    \n"             \
-    "add        %6, %1, %5, lsl 2              \n"             \
+    "add        %6, %1, %5, lsl #2             \n"             \
     "add        %3, %3, %4                     \n"             \
     MEMACCESS(6)                                               \
     "vld1.32    {"#dn"["#n"]}, [%6]            \n"

Thanks

Original comment by z...@integrityanalysis.com on 14 Apr 2015 at 3:19

GoogleCodeExporter commented 9 years ago
r1369 fixes the 2 issues you raised.

1. source/scale_neon64.cc does not have the fix applied. scale_neon.cc does.

// TODO(Yang Zhang): Investigate less load instructions for
// the x/dx stepping
#define LOAD1_DATA32_LANE(vn, n)                               \
    "lsr        %5, %3, #16                    \n"             \
    "add        %6, %1, %5, lsl 2              \n"             \
    "add        %3, %3, %4                     \n"             \
    MEMACCESS(6)                                               \
    "ld1        {"#vn".s}["#n"], [%6]          \n"

2. the .asm files are not buildable.
all other source files are ifdefed so they can be compiled unconditionally.

If you have time, sync up and confirm it builds without changes.

Original comment by fbarch...@google.com on 14 Apr 2015 at 8:11

GoogleCodeExporter commented 9 years ago
Fixed in r1369.  Thanks for the report! 

Original comment by fbarch...@chromium.org on 16 Apr 2015 at 7:52

GoogleCodeExporter commented 9 years ago
Hi, I've downloaded the latest build (revision 1372) and I can confirm it 
builds without changes.  Please keep up with the good work!  Thanks

Original comment by z...@integrityanalysis.com on 16 Apr 2015 at 10:06