Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xcode iOS toolchains with CMake and enterprise account #720

Closed
ygyin-ivy opened this issue Aug 17, 2018 · 19 comments
Closed

xcode iOS toolchains with CMake and enterprise account #720

ygyin-ivy opened this issue Aug 17, 2018 · 19 comments

Comments

@ygyin-ivy
Copy link

ygyin-ivy commented Aug 17, 2018

I want to build ios app with cmake 3.11.4
I chose folder drishti and get a log
-- config.cmake --
MSVC:
APPLE: 1
ANDROID:
IOS:
is_linux: 0
XCODE: 1
its a log for build macOS.
which folder i should choose, or where to config ios build?
Thanks

@headupinclouds
Copy link
Collaborator

If you want to build for iOS, you will have to use an iOS toolchain. I recommend using polly for the builds, which is a python front end with built in toolchains that supports condensed one-line build + install command lines. Please take a look at the README for more examples and details and how to select a toolchain

In the same table, you can find iOS SDK version. E.g., if you have installed Xcode 9.4 with default iOS SDK 11.4, and you want to set the deployment SDK to version 9.3, you can use --toolchain ios-11-4-dep-9-3-arm64 to build the ARM64 architecture

You could run something like this:

TOOLCHAIN=ios-11-4-dep-9-4-arm64
CONFIG=Release
polly.py --toolchain ${TOOLCHAIN} --config-all ${CONFIG} --install --verbose --reconfig --fwd DRISHTI_BUILD_EXAMPLES=ON

You can find a list of toolchains in the top level of this project:

https://github.com/ruslo/polly

@ygyin-ivy
Copy link
Author

i know those, but i have more interested in Native IOS build of news 8/10

@headupinclouds
Copy link
Collaborator

i know those, but i have more interested in Native IOS build of news 8/10

I'm not sure I follow, but if you want to build the native iOS facefilter app from the 8/10 commit, it will be built from the top level CMake/polly build with option DRISHTI_BUILD_EXAMPLES. Since CMake has an Xcode generator, the FaceFilter target is just a normal add_executable call. This is in contrast to Android Studio, where gradle ends up managing the CMake build. You don't have to do anything special to build the iOS app.

@ygyin-ivy
Copy link
Author

Uploading cmake-drishti.png…

option DRISHTI_BUILD_EXAMPLES is enable.
cmake only generate macOS project

@headupinclouds
Copy link
Collaborator

headupinclouds commented Aug 21, 2018

What did you type? What version of Xcode do you have and which version of iOS do you have installed on your phone? It sounds like you aren't using an iOS toolchain.

If you build from polly.py and use a toolchain starting with ios-* it should create an iOS project.

TOOLCHAIN=ios-11-4-dep-9-4-arm64
CONFIG=Release
polly.py --toolchain ${TOOLCHAIN} --config-all ${CONFIG} --install --verbose --reconfig --fwd DRISHTI_BUILD_EXAMPLES=ON

@ygyin-ivy
Copy link
Author

ygyin-ivy commented Aug 21, 2018

xcode 9.4, ios 11.4
not type , not use polly.py
only chose top dir using cmake-gui

@headupinclouds
Copy link
Collaborator

only chose top dir using cmake-gui

This won't work. You have to cross compile for your iPhoneOS target from your macOS host, which requires a toolchain.

xcode 9.4, ios 11.4

In that case, the polly.py command I typed above should work fine for you.

You can find more details about polly iOS toolchains here.

@ygyin-ivy
Copy link
Author

ygyin-ivy commented Aug 21, 2018

thx
yestoday i tried this cross compile , stuck at POLLY_IOS_DEVELOPMENT_TEAM and bundle identifier.

@headupinclouds
Copy link
Collaborator

headupinclouds commented Aug 21, 2018

You will have to set the POLLY_IOS_DEVELOPMENT_TEAM and the POLLY_IOS_BUNDLE_IDENTIFIER. Please read this section for details related to the Bundle ID. The setup in the last link is a 1x process which I believe you need to do the first time you install Xcode. You will need to have a valid Apple Developer account to run on your phone. I'll add more details about the iOS setup on the README. Unfortunately the code signing steps make the "quick start" a little less quick for iOS devices 😄

@headupinclouds
Copy link
Collaborator

I've updated the README w/ the above notes and clarified the need for a toolchain to run the iOS builds.

@ygyin-ivy
Copy link
Author

Is there any way to pass -allowProvisioningUpdates to xcodebuild with polly.py?

Run Build Command:"/usr/bin/xcodebuild" "-project" "CMAKE_TRY_COMPILE.xcodeproj" "build" "-target" "cmTC_b3beb" "-configuration" "Debug"
=== BUILD TARGET cmTC_b3beb OF PROJECT CMAKE_TRY_COMPILE WITH CONFIGURATION Debug ===

Check dependencies
Code Signing Error: No profiles for 'com.ivy.example.TestDrishiti' were found:  Xcode couldn't find any iOS App Development provisioning profiles matching 'com.ivy.example.TestDrishiti'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild.
Code Signing Error: Code signing is required for product type 'Application' in SDK 'iOS 11.4'

@headupinclouds
Copy link
Collaborator

Is there any way to pass -allowProvisioningUpdates to xcodebuild with polly.py?

No.

The error you are hitting is the one that is described in this link. This can happen if you are using an enterprise account. The link provides a solution for the problem. I've posted the error + link to the README. Let me know if that helps.

@ygyin-ivy
Copy link
Author

i have tried to set POLLY_IOS_BUNDLE_IDENTIFIER that is described in that link , both enterprise account and my personal account. it's not work. maybe i still need to set something when using my personal account. when i fix this signing issue , i will post my solution in this post

@headupinclouds
Copy link
Collaborator

when i fix this signing issue , i will post my solution in this post

Okay, that would be helpful. Unfortunately, this issue is hard for me to reproduce and troubleshoot.

Here are two issues that provide background on the above polly links. I think it will be worthwhile reading through those:

ruslo/polly#102
ruslo/polly#170

@headupinclouds
Copy link
Collaborator

Can you step through the setup in the follow link and post the results here? This will help verify your development setup.

https://polly.readthedocs.io/en/latest/toolchains/ios/bundle-id.html#bundle-id

@ygyin-ivy
Copy link
Author

https://polly.readthedocs.io/en/latest/toolchains/ios/bundle-id.html#bundle-id

it's not work. i will read through those issues

@headupinclouds
Copy link
Collaborator

it's not work. i will read through those issues

Okay, that's good, actually. It means you have Apple environment + code signing issues that are unrelated to polly + toolchains. If you can get the last step working with a minimal project, i.e.:

"Run example on real device. By this you will verify that build and signing is working correctly"

The polly build should work.

@headupinclouds headupinclouds changed the title xcode with cmake: xcode iOS toolchains with CMake and enterprise account Aug 22, 2018
@ygyin-ivy
Copy link
Author

ygyin-ivy commented Aug 23, 2018

it should be a code signing issue,
ipodidentifier

Although i created a minimal project with my personal account and ran this on iPod touch,
the polly build is still not working.

i will try to find why.

@ygyin-ivy
Copy link
Author

ygyin-ivy commented Aug 23, 2018

finally i fix this issue.

iphonedeveloper

at the key-chain , there are two kinds of certification

  one is   iPhone distribution .
  set it to POLLY_IOS_DEVELOPMENT_TEAM , the polly build works.

  one is  iPhone developer.
  set it to POLLY_IOS_DEVELOPMENT_TEAM , the polly build fails with this issue .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants