Building a framework from source for tvOS

I have been trying to build a framework in such a way that it will work for tvOS, but am continually confronted with the error message when publishing to the actual device (the simulator produces a similar warning):


ld: in<path>/ios/framework/boost.framework/boost(thread_thread.o), building for tvOS, but linking in object file built for iOS, for architecture arm64

clang: error: linker command failed with exit code 1 (use -v to see invocation)


These are the various build settings I know need to happen:


  • bitcode enabled (adding ' -fembed-bitcode' to build commands)
  • correct architectures (arm64 for the new apple tv, x86_64 for the simulator)
  • using the correct xcrun command for tvos ('xcrun --sdk appletvos' and 'xcrun --sdk appletvsimulator')
  • pointing to the correct SDKs (/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer and /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer)


My question is, what are the various things that clang and ld are looking for before throwing the above error on a framework when building for tvOS?

Is there any way to troubleshoot why a framework wouldn't be working on tvOS? (like using 'dwarfdump'?)


An example of a working build process for any framework to tvOS would be a great help... thanks!

I am also experiencing this problem trying to integrate different analytics frameworks for tvOS. Any help would be greatly appreciated!

For anyone finding this via Google, there is a solution posted for the Boost framework specifically (the one I was trying to get working)... there is a build script in this repo that may be of use when compiling your framework:


https://github.com/danoli3/ofxtvOSBoost


I also found this working OpenSSL script that may have some clues:


https://gist.github.com/felix-schwarz/c61c0f7d9ab60f53ebb0


As to the original question asked, I still don't have a good sense of why some builds fail and why some don't, so if anyone can still shed light on that for others that would be great.

Building a framework from source for tvOS
 
 
Q