wmiller848 / libyuv

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

Build libyuv for iOS - armv7 #212

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

I have build the libyux with command line:

export GYP_DEFINES="target_arch=arm armv7=1" 
export 
DEVPATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/D
eveloper
export CC=${DEVPATH}/usr/bin/gcc
export CXX=${DEVPATH}/usr/bin/g++
export RANLIB=${DEVPATH}/usr/bin/ranlib 
export AR=${DEVPATH}/usr/bin/ar 
export AS=${DEVPATH}/usr/bin/as 
export LIBTOOL=${DEVPATH}/usr/bin/libtool 
gclient runhooks 

Then: 

xcodebuild -project libyuv.xcodeproj -configuration Release 

 and also with XCode (please see the attached screenshot)

What is the expected output? What do you see instead?

The libyuv.a is successfully created for amrv7

lipo -info libyuv.a 
input file libyuv.a is not a fat file
Non-fat file: libyuv.a is architecture: armv7

But when I try to use it in my project I'm getting the following errors:

Undefined symbols for architecture armv7:
  "_chromium_jpeg_CreateDecompress", referenced from:
      libyuv::MJpegDecoder::MJpegDecoder()in libyuv.a(mjpeg_decoder.o)
      libyuv::MJpegDecoder::MJpegDecoder()in libyuv.a(mjpeg_decoder.o)
  "_chromium_jpeg_abort_decompress", referenced from:
      libyuv::MJpegDecoder::UnloadFrame()      in libyuv.a(mjpeg_decoder.o)
      libyuv::MJpegDecoder::DecodeToBuffers(unsigned char**, int, int)in libyuv.a(mjpeg_decoder.o)
      libyuv::MJpegDecoder::FinishDecode()      in libyuv.a(mjpeg_decoder.o)
      libyuv::MJpegDecoder::DecodeToCallback(void (*)(void*, unsigned char const* const*, int const*, int), void*, int, int)in libyuv.a(mjpeg_decoder.o)
  "_chromium_jpeg_destroy_decompress", referenced from:
      libyuv::MJpegDecoder::~MJpegDecoder()in libyuv.a(mjpeg_decoder.o)
      libyuv::MJpegDecoder::~MJpegDecoder()in libyuv.a(mjpeg_decoder.o)
  "_chromium_jpeg_read_header", referenced from:
      libyuv::MJpegDecoder::LoadFrame(unsigned char const*, unsigned long)in libyuv.a(mjpeg_decoder.o)
  "_chromium_jpeg_read_raw_data", referenced from:
      libyuv::MJpegDecoder::DecodeToBuffers(unsigned char**, int, int)in libyuv.a(mjpeg_decoder.o)
      libyuv::MJpegDecoder::DecodeToCallback(void (*)(void*, unsigned char const* const*, int const*, int), void*, int, int)in libyuv.a(mjpeg_decoder.o)
  "_chromium_jpeg_resync_to_restart", referenced from:
      libyuv::MJpegDecoder::MJpegDecoder()in libyuv.a(mjpeg_decoder.o)
      libyuv::MJpegDecoder::MJpegDecoder()in libyuv.a(mjpeg_decoder.o)
  "_chromium_jpeg_start_decompress", referenced from:
      libyuv::MJpegDecoder::DecodeToBuffers(unsigned char**, int, int)in libyuv.a(mjpeg_decoder.o)
      libyuv::MJpegDecoder::StartDecode()      in libyuv.a(mjpeg_decoder.o)
      libyuv::MJpegDecoder::DecodeToCallback(void (*)(void*, unsigned char const* const*, int const*, int), void*, int, int)in libyuv.a(mjpeg_decoder.o)
  "_chromium_jpeg_std_error", referenced from:
      libyuv::MJpegDecoder::MJpegDecoder()in libyuv.a(mjpeg_decoder.o)
      libyuv::MJpegDecoder::MJpegDecoder()in libyuv.a(mjpeg_decoder.o)
ld: symbol(s) not found for architecture armv7
collect2: ld returned 1 exit status

What version of the product are you using? On what operating system?
I'm using the latest libyuv code on MAC OS X 10.7.5 building libyuv for iOS - 
armv7 

Please provide any additional information below.

Any help is appreciated! 

Thanks! :)

Original issue reported on code.google.com by danielve...@gmail.com on 29 Mar 2013 at 12:48

GoogleCodeExporter commented 9 years ago
Sorry I have missed the screenshot in my first post, so here it is now :)

Original comment by danielve...@gmail.com on 29 Mar 2013 at 12:50

Attachments:

GoogleCodeExporter commented 9 years ago
You'll need to link chromium's jpeg_turbo or build libyuv with HAVE_JPEG turned 
off.
I'm considering ways to make jpeg more flexible - a set of pointers to the code 
or use of system jpeg, so you can provide a hardware jpeg decoder, or none.

Original comment by fbarch...@chromium.org on 31 Mar 2013 at 6:08

GoogleCodeExporter commented 9 years ago
r638 should resolve this.
When you generate the xcode project from gyp, it'll disable jpeg for ios.
jpeg is not all that useful to the ios version of libyuv at the moment.

In future I think a gyp_define would be better.
And/or ability to runtime enable it or point to different implementations.

Would be good if you can get the new version a test and let me know it works 
for you.

Original comment by fbarch...@google.com on 3 Apr 2013 at 11:05

GoogleCodeExporter commented 9 years ago

Original comment by fbarch...@chromium.org on 4 Apr 2013 at 6:37

GoogleCodeExporter commented 9 years ago
Hello,

I come to test the latest version as suggested:

1. I'm unable to build the lib for iPhone (armv7) using command line, can you 
please let me know how that can be done? the created lib is for i386 
(Simulator), maybe I'm not exporting the right options?

I have used export GYP_DEFINES="target_arch=arm armv7=1"
as mentioned above

2. I have created the armv7 lib with Xcode but the problem is the same, maybe I 
need to specify somewhere the OS setting to iOS (add OS=ios in the GYP_DEFINES)?

By manually disabling the HAVE_JPEG build as you have previously suggested the 
problem is resolved

Thanks

Original comment by danielve...@gmail.com on 4 Apr 2013 at 7:29

GoogleCodeExporter commented 9 years ago
Hi again,

I have found how to build libyuv form armv7 using command line:

xcodebuild -project libyuv.xcodeproj -configuration Release -arch armv7 -sdk 
iphoneos6.1

the solution was to specify the -sdk and -arch options,

to see your available SDKs you can use :

xcodebuild -showsdks

that should give you something like:

OS X SDKs:
    Mac OS X 10.7                   -sdk macosx10.7
    OS X 10.8                       -sdk macosx10.8

iOS SDKs:
    iOS 6.1                         -sdk iphoneos6.1

iOS Simulator SDKs:
    Simulator - iOS 5.0             -sdk iphonesimulator5.0
    Simulator - iOS 6.1             -sdk iphonesimulator6.1

make sure to specify the right SDK in my case that was "iphoneos6.1"

Hope this can help to someone else!

The issue with the HAVE_JPEG lib is not resolved for armv7 with added OS=ios in 
GYP_DEFINES (but maybe this is not the right place for it? )

Thanks

Original comment by danielve...@gmail.com on 4 Apr 2013 at 8:08

GoogleCodeExporter commented 9 years ago
2 other projects I work on ran into a related problem.
They want to use libyuv, including a version that support jpeg, but for their 
particular part, they dont want to link jpeg.
I've got a simple change - break the jpeg dependent code into new source files, 
so you can use other functions without the dependency.
convert.cc becomes convert.cc convert_jpeg.cc and convert_to_i420.cc

Original comment by fbarch...@chromium.org on 9 Apr 2013 at 10:17

GoogleCodeExporter commented 9 years ago
fixed.  If you use selective functions - eg ARGBToI420() you shouldnt need to 
link jpeg.

Original comment by fbarch...@chromium.org on 10 Apr 2013 at 12:36

GoogleCodeExporter commented 9 years ago
Previous fix helped apps that use I420, but not ARGB.

Original comment by fbarch...@google.com on 11 Apr 2013 at 3:57

GoogleCodeExporter commented 9 years ago
r661 fixes convert_argb.cc

Original comment by fbarch...@chromium.org on 15 Apr 2013 at 12:49

GoogleCodeExporter commented 9 years ago
Where to set HAVE_JPEG turn off ?
Thanks

Original comment by onmyway...@gmail.com on 22 May 2013 at 3:04

GoogleCodeExporter commented 9 years ago
Getting Started documentation updated with IOS build instructions.
https://code.google.com/p/libyuv/wiki/GettingStarted

Original comment by fbarch...@google.com on 20 Nov 2013 at 12:17