BigMing001 / libyuv

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

iOS library is missing ARM NEON exports? #498

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Download latest sources.
2. Follow build instructions from getting started.
Exact command lines:
GYP_DEFINES="OS=ios target_arch=armv7 target_subarch=both" GYP_CROSSCOMPILE=1 
GYP_GENERATOR_FLAGS="output_dir=out_ios" ./gyp_libyuv -f ninja --depth=. 
libyuv.gyp 
 ninja -j7 -C out_ios/Debug-iphoneos libyuv
 ninja -j7 -C out_ios/Release-iphoneos libyuv

What is the expected output? What do you see instead?
library in out_ios/Release-iphoneos/libyuv.a should be successfully linked to 
the project that uses I422ToARGB() function.

What version of the product are you using? On what operating system?
iOS 9, XCode 7.x

Please provide any additional information below.
Linker's output:
Undefined symbols for architecture arm64:
  "_I422ToARGBRow_NEON", referenced from:
      _I420ToARGB in libyuv.a(libyuv.convert_from.arm64.o)
      _I422ToARGBRow_Any_NEON in libyuv.a(libyuv.row_any.arm64.o)
ld: symbol(s) not found for architecture arm64

Original issue reported on code.google.com by andr...@pictures2.com on 30 Sep 2015 at 11:42

GoogleCodeExporter commented 8 years ago
works for me?

GYP_DEFINES="OS=ios target_arch=armv7 target_subarch=both" 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

.gclient file is
solutions = [
  { "name"        : "libyuv",
    "url"         : "https://chromium.googlesource.com/libyuv/libyuv",
    "deps_file"   : "DEPS",
    "managed"     : True,
    "custom_deps" : {
    },
    "safesync_url": "",
  },
];target_os=['ios']; 
cache_dir = None

version 1497

bash-3.2$ more README.chromium 
Name: libyuv
URL: http://code.google.com/p/libyuv/
Version: 1497

xcode 6.4

64 bit only also worked
GYP_DEFINES="OS=ios target_arch=arm64 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

Original comment by fbarch...@google.com on 1 Oct 2015 at 2:35

GoogleCodeExporter commented 8 years ago
If this is still happening, I'll need more information on how to reproduce it.
The sequence above works for me using the current version in git, which is 
r1499 at the moment.

Original comment by fbarch...@chromium.org on 6 Oct 2015 at 6:12

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
It's still happening. Did clean rebuilds and followed instructions in "get 
started". There's nothing to add to reproduction steps besides creating a test 
app that calls I422ToARGB() function.
My app was based on 
https://github.com/askdavinci/opentok-test/blob/master/SharedWithOpentTok/TBExam
pleVideoRender.m

I'm probably missing a linker flag or something? I also have bunch of other 
libs that are linked just perfectly. And also libyuv for simulator (i.t. x64 
version) links and works just fine. 

Original comment by alex...@gmail.com on 7 Oct 2015 at 6:58

GoogleCodeExporter commented 8 years ago
I suspect whats happening is you built libyuv, the library, but not the 
libyuv_neon library.
I built libyuv_unittest which depends on both libraries.
The instructions need an update, and/or the build system.

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

The problem comes from GCC/Clang for Arm, where you can't build Neon assembly 
language without enabling Neon using -mfpu=neon
But if you do, the compiler may generate neon code from the C code.  This is 
unsafe if you want to produce code that runtime dispatches.
With older compilers, we got away with the unsafe code, because the compilers 
didnt take advantage of the Neon instructions.  But now they do.

I'm marking this as a duplicate of an older bug which is still open
https://code.google.com/p/libyuv/issues/detail?id=371
Issue 371:  ios build:merge libyuv_neon.a and libyuv.a?build armv7s?

It would be much simplier, as a user of libyuv, if it were a single library.

The straight forward solution is to require neon.  Or completely disable it.  
but not have runtime dispatching.
I'll likely move forward with that, as there are very few cpu's without neon.

Also the documentaion will need to be switched to markdown before any changes 
can be made.
https://code.google.com/p/libyuv/issues/detail?id=486

Original comment by fbarch...@chromium.org on 8 Oct 2015 at 3:51