bitcode support for tvOS

iOS, iPad, iPhone, tvOS specific usage questions
wlgtsend
New Cone
New Cone
Posts: 1
Joined: 28 Sep 2015 21:48

bitcode support for tvOS

Postby wlgtsend » 28 Sep 2015 22:39

I've managed to follow the instructions to get a compiled library that successfully links to my tvOS project. I am having trouble compiling libvlc with bitcode support - I'm attempting this as it is a requirement for tvOS apps when submitting to the store. (https://developer.apple.com/library/pre ... nning.html)

I've attempted to enable compiling with -fembed-bitcode applied via a patch (this is the first time I've played with patch files so I could be doing it wrong) that I've attempted to create. (https://gist.github.com/wtsnz/a7db502a6c8e713e93cf)
My thinking was to create a patch that changes the /MobileVLCKit/ImportedSources/vlc/extras/package/ios/build.sh script in order to add the -fembed-bitcode flag to the "CFLAGS" argument.

The patch gets applied successfully, and building commences.
It's successful for the armv7 and armv7s, and checking with "otool -l libvlc.a | grep bitcode" I get binaries that contain bitcode! :)

but when compiling for arm64 (or aarch64 as it's displayed in the command line) (which is the Apple TV + newer iPhones) building fails "error: implicit declaration of function 'vlc_CPU_ARM_NEON' is invalid in C99" :cry:

Code: Select all

In file included from /Users/will/projects/VLCKit/MobileVLCKit/ImportedSources/vlc/modules/audio_filter/channel_mixer/simple.c:262: /Users/will/projects/VLCKit/MobileVLCKit/ImportedSources/vlc/modules/audio_filter/channel_mixer/simple_neon.h:50:1: error: implicit declaration of function 'vlc_CPU_ARM_NEON' is invalid in C99 [-Werror,-Wimplicit-function-declaration] NEON_WRAPPER(7_x,2_0) ^ /Users/will/projects/VLCKit/MobileVLCKit/ImportedSources/vlc/modules/audio_filter/channel_mixer/simple_neon.h:47:16: note: expanded from macro 'NEON_WRAPPER' return vlc_CPU_ARM_NEON() ? DoWork_##in##_to_##out##_neon : DoWork_##in##_to_##out; \ ^ 1 error generated. make[4]: *** [audio_filter/channel_mixer/libsimple_channel_mixer_plugin_la-simple.lo] Error 1 make[4]: *** Waiting for unfinished jobs.... make[3]: *** [all-recursive] Error 1 make[2]: *** [all] Error 2 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2
Now I'm not sure where to go from here as I'm not familiar with the code base, but I presume that there is a header file import missing somewhere when building for arm64. Does anyone have any ideas what I should try next?

fkuehne
Developer
Developer
Posts: 7264
Joined: 16 Mar 2004 19:37
VLC version: 0.4.6 - present
Operating System: Darwin
Location: Germany
Contact:

Re: bitcode support for tvOS

Postby fkuehne » 29 Sep 2015 12:22

We need to find a way to patch the build script not only deploy the bitcode CFLAG but also to disable custom assembly everywhere, which is intrinsically incompatible with bitcode. This is precisely where you are stuck in this case as you are attempting to compile a NEON script. To be honest, I'm surprised that it didn't fail earlier.

I will have a look later this week as time allows and amend VLCKit's build script a bit within the tv target.
VideoLAN
Felix Paul Kühne
Medic. VLC developer for appleOS since before you were born.
Blog: https://www.feepk.net

hackman42
New Cone
New Cone
Posts: 1
Joined: 10 Oct 2015 18:28

Re: bitcode support for tvOS

Postby hackman42 » 10 Oct 2015 18:54

With the latest changes the bitcode warnings are gone and I can run on device. However when I attempt to make an archive for distribution, There is still a bitcode error.

ld: bitcode bundle could not be generated because '.../libTVVLCKit.a(VLCMedia.o)' was built without full bitcode. All object files and libraries for bitcode must be generated from Xcode Archive or Install build for architecture arm64

Perhaps I'm building it wrong. This is what I did:
Delete ImportedSources.
./buildMobileVLCKit.sh -t
Open project in Xcode.
Run Build action for Generic tvOS Device
Retrieve Release-appletvos/libTVVLCKit.a from Derived Data
Run Build action for simulator.
Link my app to the libTVVLCKit.a.

The error implies that I should build libTVVLCKit.a with the Archive action. As far as I can tell, that doesn't produce a library.

fkuehne
Developer
Developer
Posts: 7264
Joined: 16 Mar 2004 19:37
VLC version: 0.4.6 - present
Operating System: Darwin
Location: Germany
Contact:

Re: bitcode support for tvOS

Postby fkuehne » 10 Oct 2015 19:56

As I said on IRC, I can't reproduce your problem. Archiving TVVLCKit for "Generic tvOS device" behaves absolutely correctly for and succeeds with Xcode 7.1b3.

However, your workflow looks fishy. You should not copy possibly intermediate representations from somewhere and link them to your app. Just create an xcode-workspace with the MobileVLCKit project and your app, setup the linking and be done with it :) (for illustrative purposes, see Examples_iOS/GLEssentials or Examples_iOS/DropIn-Player)
.. This way, you also don't need to change things or recompile when switching back and forth between Device and Simulator builds.
VideoLAN
Felix Paul Kühne
Medic. VLC developer for appleOS since before you were born.
Blog: https://www.feepk.net

matrog
Blank Cone
Blank Cone
Posts: 42
Joined: 27 Sep 2015 08:55

Re: bitcode support for tvOS

Postby matrog » 05 Nov 2015 22:20

it's working, thanks!


Return to “VLC for iOS, iPadOS and Apple TV”

Who is online

Users browsing this forum: No registered users and 10 guests