Kodi Community Forum
TvOS Kodi Build - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: iOS & tvOS (https://forum.kodi.tv/forumdisplay.php?fid=137)
+---- Thread: TvOS Kodi Build (/showthread.php?tid=312805)



RE: TvOS Kodi Build - sy6sy2 - 2019-04-01

Hum! Thank you for this info, I will try it tonight ;-)


RE: TvOS Kodi Build - kaaspad - 2019-04-01

actually found something a bit more promising on stack overflow concerning a similar problem with trycompile:

this goes at the top of the TVOS.cmake toolchain file
cpp:

# toolchain.cmake    
set(CMAKE_MACOSX_BUNDLE YES)
set(CMAKE_OSX_SYSROOT "iphoneos")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer")
set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.example")

and comment out the 2 lines that disable the try_compile:
cpp:

# Skip the platform compiler checks for cross compiling
set (CMAKE_CXX_COMPILER_WORKS TRUE)
set (CMAKE_C_COMPILER_WORKS TRUE)


here is original post on stackoverflow


RE: TvOS Kodi Build - sy6sy2 - 2019-04-01

Thank you for your help, Looks like we're in the right direction.

In https://github.com/ruslo/polly/issues/102 they say that we have to firstly create a fake project with Xcode in order to obtain all the necessary signing stuff correctly.

After that, in Cmake, we can use the ID and team used by the fake Xcode project. The tutorial is here: https://polly.readthedocs.io/en/latest/toolchains/ios/bundle-id.html

I will try it later!


RE: TvOS Kodi Build - kaaspad - 2019-04-01

(2019-04-01, 12:35)sy6sy2 Wrote: Thank you for your help, Looks like we're in the right direction.

In https://github.com/ruslo/polly/issues/102 they say that we have to firstly create a fake project with Xcode in order to obtain all the necessary signing stuff correctly.

After that, in Cmake, we can use the ID and team used by the fake Xcode project. The tutorial is here: https://polly.readthedocs.io/en/latest/toolchains/ios/bundle-id.html

I will try it later!

yup easy wait to do that is similar to install - just create an empty tvOS app, set it to run on a real appletv, then have Xcode auto fix the signing authority. After that you can click on the question mark next to the provisioning profile in the build settings and it will give you the info of the profile, pass that and the app identifier to cmake


TvOS Kodi Build - Memphiz - 2019-04-01

There must be a solution without all this because we do nothing like that for iOS.
The bundle identifier is in the info.plist ... you grab that from the yab branch and look what it looks like for iOS. The info.plist needs then be configured by cmake (meaning our info.plist files are all templates only that need to get data filled in by cmake).
As said - all this must be already there for iOS in kodi master ...

Keep in mind that we need to build this on Jenkins at the end - there are no signing identities setup there at all nor is there a way to attach any devices to the Jenkins build nodes.


RE: TvOS Kodi Build - sy6sy2 - 2019-04-02

Hi Memphiz,

Thank you for your message.
I completely forgot to think about Jenkins Undecided

I will have a look at the info.plist file.


RE: TvOS Kodi Build - sy6sy2 - 2019-04-02

I find it weird anyway ...

With this simple CMakeLists.txt:

Code:
cmake_minimum_required(VERSION 3.14)

project (hello LANGUAGES CXX)

# Just to trigger the try_compile feature of CMake
find_package(Threads REQUIRED)

add_executable(hello helloworld.cpp)

If I use this simple Toolchain to build the iOS Xcode project:
Code:
set(CMAKE_SYSTEM_NAME iOS)
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.test")
set(CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM "myamazingteam")

Everything is going well and the Xcode project is generated.

But if switch to tvOS with this Toolchain:

Code:
set(CMAKE_SYSTEM_NAME tvOS)
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.test")
set(CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM "myamazingteam")

I get this error:

Code:
Determining if the include file pthread.h exists failed with the following output:
Change Dir: /Users/sylvain/Local_files/Kodi/test_cmake/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/xcodebuild -project CMAKE_TRY_COMPILE.xcodeproj build -target cmTC_f7c7f -configuration Debug -hideShellScriptEnvironment 
User defaults from command line:
    HideShellScriptEnvironment = YES

Prepare build
note: Using legacy build system

=== BUILD TARGET cmTC_f7c7f OF PROJECT CMAKE_TRY_COMPILE WITH CONFIGURATION Debug ===

Check dependencies
Code Signing Error: No profiles for 'com.test' were found:  Xcode couldn't find any tvOS App Development provisioning profiles matching 'com.test'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild.

** BUILD FAILED **


The following build commands failed:
    Check dependencies
(1 failure)
 

Undecided


RE: TvOS Kodi Build - kaaspad - 2019-04-02

Quote:Keep in mind that we need to build this on Jenkins at the end - there are no signing identities setup there at all nor is there a way to attach any devices to the Jenkins build nodes.
@Memphiz not sure what you meaning there are no profiles in Jenkins? I utilize a custom script for Jenkins (on personal projects) that does include a profile in a custom config see below for this config I use in Jenkins (redacted)
xml:
#Intetnal
identifier=myAppIdentifier
appname="MyApp"
prodname="App"
default_server="server"
TARGET_FAMILY="1"
custom_app_type="App"
app_type=AP
fb_my_app_id=aaaaaaaaaaaaaaaaa
FacebookDislayName="My App"
PROVISIONING_PROFILE="aaa11111-222a-1a1a-a1aa-1111111a1111"
PROVISIONING_PROFILE_SPECIFIER="1111A11A11/myAppIdentifier"
PROVISIONING_PROFILE_NAME="myAppIdentifier"
facebookShare=true
#Configuration flags
partner_id=1111
app_id=MyApp_iOS
useLeftNavBackgroundImage=true
useLeftNavBackgroundColor=false
geo_Location_Distance=25
swipeLeftToRightEnabled=false
queueSizeLimit=1000
defaultLoopOn=false
nMinusOneCaching=true
wanDownload=true
settingsLogoutButton=false
flipFlop=false
showNoticesInLeftMenu=true
enableNotices=false
enableMailbox=true
twitter_consumer_key=AAAAAAAAAAAAAAA
twitter_consumer_secret=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

Quote:There must be a solution without all this because we do nothing like that for iOS.
I do fully agree with this, there should be zero difference, but that said as cmake has its own quirks and might be searching for a valid provisioning that includes a tvOS profile on the local machine this might be the reason for the failure.

@sy6sy2 
It seems like you are making progress and almost there at least regarding creating the project, sorry to be a pain but could you detail the exact steps you have taken from the start (from branching off master) so I can try to repeat the steps on my machine, I'm not getting anywhere near as far as you are, but might have to do with my setup:
macOS 10.14.4
tvOS 12.2
Xcode 10.2 (10E125)


RE: TvOS Kodi Build - kaaspad - 2019-04-02

@sy6sy2 
one more thing to check, can you look in ~/Library/MobileDevice/Provisioning Profiles/*
You should see your mobileprovision files there (that's where its checking for validity)
You can use provisionql (brew cask install provisionql, then qlmanage -r, then just right click file and do quicklook) to view the contents of them, or just use
Code:
security cms -D -i some.mobileprovision
 and make sure that you see that its a tvOS profile.

update: i just noticed that in iOS this set gets passed: CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO"
are you passing that as well ?

so something like this:
Code:

set(CMAKE_OSX_SYSROOT appletvos)
set(CMAKE_OSX_ARCHITECTURES "arm64")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES")



RE: TvOS Kodi Build - sy6sy2 - 2019-04-02

Hi kaaspad,

Any help is welcome Big Grin

My only two commits are here and here.

What I have done:

1. git clone master branch
2. Modify tools/depends/configure.ac file in order to (1) Enable tvOS in the $use_platform switch case, (2) set the $target_platform-version-min to 10.2 in order to have FFmpeg to compile, (3) Use two different $use_sdk switch cases (one for tvOS and a different one for iOS).
3. I also modify tools/depends/target/openssl/Makefile to disable async because it seems that it is not available for tvOS and openssl did not want to compile. There is also a patch for "FORK" as you can see in the first commit.
4. Now you are able to compile dependencies with:
bash:
cd kodi/tools/depends
./bootstrap
./configure --host=arm-apple-darwin --with-cpu=arm64 --with-platform=tvos
make
5. Concerning the binary add-ons, they compile out-of-the box with:
bash:
cd kodi
make -C tools/depends/target/binary-addons
6. Now I am stuck at correctly modifying the Toolchain in order to have Cmake generates the Xcode project Undecided:


RE: TvOS Kodi Build - sy6sy2 - 2019-04-02

(2019-04-02, 11:53)kaaspad Wrote: @sy6sy2 
one more thing to check, can you look in ~/Library/MobileDevice/Provisioning Profiles/*
You should see your mobileprovision files there (that's where its checking for validity)
You can use provisionql (brew cask install provisionql, then qlmanage -r, then just right click file and do quicklook) to view the contents of them, or just use
Code:
security cms -D -i some.mobileprovision
 and make sure that you see that its a tvOS profile.

Yes I can see my different mobileprovision files, with my developer team id etc ... and they are for tvOS platform.

But, do you think that I have to use the IDs found in those files directly in my Toolchain? This is not exactly what Memphiz said not to do because of Jenkins?


RE: TvOS Kodi Build - kaaspad - 2019-04-02

(2019-04-02, 12:05)sy6sy2 Wrote:
(2019-04-02, 11:53)kaaspad Wrote: @sy6sy2 
one more thing to check, can you look in ~/Library/MobileDevice/Provisioning Profiles/*
You should see your mobileprovision files there (that's where its checking for validity)
You can use provisionql (brew cask install provisionql, then qlmanage -r, then just right click file and do quicklook) to view the contents of them, or just use
Code:
security cms -D -i some.mobileprovision
 and make sure that you see that its a tvOS profile.

Yes I can see my different mobileprovision files, with my developer team id etc ... and they are for tvOS platform.

But, do you think that I have to use the IDs found in those files directly in my Toolchain? This is not exactly what Memphiz said not to do because of Jenkins?  
Memphiz is definitely correct in the long run as at the end you can't have your private info committed, but might be worth to put it in just to get over this hump for now (who know what requirements the cmake integration has as its very, very new), later on after all is said and fixed you can revisit it. Another option see my post above with latest edit and see if you can set the requirement setting to "NO"


RE: TvOS Kodi Build - sy6sy2 - 2019-04-02

Yes I already set CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED to NO as I said in this post https://forum.kodi.tv/showthread.php?tid=312805&pid=2841589#pid2841589
I will try tonight using my "real" IDs.


RE: TvOS Kodi Build - kaaspad - 2019-04-02

@sy6sy2 
its odd I'm getting an error on configure 
Code:
configure: error: unsupported platform (tvos)

I see you made a change where you added tvOS at line 421, but I think this is incorrect, as tvOS is already defined as usable platform way up on top in the iOS section, so why are you adding it as another case in the raspberry pi section? I'm guessing this could solve the unsupported issue, but it seems incorrect to me
any thoughts`?


in config.log are you seeing cross compiling as yes or no? for me it says no which is weird


RE: TvOS Kodi Build - sy6sy2 - 2019-04-02

Yes I had this error too, indeed, you have to add "tvos" in the $use_platform switch case in order to not have the "unsupported platform" error.

If you use iOS, the use_platform variable is set to "auto", but when you are with tvOS, the use_platform variable is set to "tvos". This is why you have to add it.


Yes in my config.log I have cross compiling set to "yes".