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

Problem Building HomeAssistant with Lottie on M1 Mac #1681

Closed
Wildchild9 opened this issue Jun 21, 2021 · 29 comments
Closed

Problem Building HomeAssistant with Lottie on M1 Mac #1681

Wildchild9 opened this issue Jun 21, 2021 · 29 comments

Comments

@Wildchild9
Copy link

Wildchild9 commented Jun 21, 2021

I have cloned this repo and am trying to get it up and running for a debug build on the simulator currently. I am using an M1 Mac mini and I am on macOS 11.4. Also, my Xcode version is 12.5. Here are the steps I took to build the open the project before I tried to build it.

git clone https://github.com/home-assistant/iOS.git
cd iOS

After this, I deleted the Gemfile.lock file as I was getting the error "google-api-client-0.38.0 requires ruby version ~> 2.4, which is incompatible with the current version, ruby 3.0.1p64" when running the next step of the setup process (bundle install). Then I proceeded with the following commands:

bundle install
bundle exec pod install --repo-update
open HomeAssistant.xcworkspace

Once Xcode opened, I selected the App-Debug scheme and chose the iPhone 12 simulator, then I tried to run the application. This build unfortunately fails with the Swift compiler error "Could not find module 'Lottie' for target 'x86_64-apple-ios-simulator'; found: arm64, arm64-apple-ios-simulator" and I have not been able to remedy this.

Any help to get this up and working would be appreciated. Thanks

@Wildchild9 Wildchild9 changed the title Problem with Lottie on M1 Mac Problem Building HomeAssistant with Lottie on M1 Mac Jun 21, 2021
@zacwest
Copy link
Member

zacwest commented Jun 21, 2021

You may be the first person to attempt to build on an Apple Silicon machine, so I'm guessing that's the issue here. It looks like Lottie's trying to build using x86_64 instead of arm64, but I'm not sure why that would be. Just to double check - you haven't launched Xcode in any kind of Rosetta mode, right?

Are there any underlying errors elsewhere in the build step? Can you copy/paste the full build command and output from the build progress in the Navigator > Report Navigator > Build.

@Wildchild9
Copy link
Author

That is correct @zacwest, I didn't launch it in any kind of Rosetta mode. And I just exported and attached the failed build report. Let me know if there is any other information that would be helpful.
Build App-Debug_2021-06-21T12-11-56.txt

@zacwest
Copy link
Member

zacwest commented Jun 22, 2021

Your log there definitely looks like it's trying to compile for x86_64, but almost certainly debug is building only the active arch. You can test this theory by commenting out ONLY_ACTIVE_ARCH = YES in HomeAssistant.debug.xcconfig. However, I'm not sure why it's doing the wrong architecture here.

One other thing you can try is build with entirely-source pods -- run XCODE_BETA=true bundle exec pod install -- the deps it changes aren't actually Xcode 13 specific, but all of them are not precompiled.

@Wildchild9
Copy link
Author

Wildchild9 commented Jul 23, 2021

I tried both of those things and unfortunately neither of them worked. Commenting out ONLY_ACTIVE_ARCH = YES in HomeAssistant.debug.xcconfig introduced a whole new suite of errors. Namely, "Could not find module 'PromiseKit' for target 'x86_64-apple-ios-simulator'; found: arm64, arm64-apple-ios-simulator".
Build App-Debug_2021-07-23T12-37-28.txt

Trying to run XCODE_BETA=true bundle exec pod install during the setup phase instead of bundle exec pod install --repo-update also did not work and just ended up emitting the same error about Lottie.

@zacwest
Copy link
Member

zacwest commented Jul 23, 2021

Probably the easiest way to get this working is to run the rosetta version of the simulator. I'm not sure why things aren't working as-is, but it may help to add ARCHS[sdk=iphonesimulator*] = x86_64 to the xcconfig and in the Podfile where it sets per-pod build config settings.

@orcema
Copy link

orcema commented Oct 15, 2021

I tried both of those things and unfortunately neither of them worked. Commenting out ONLY_ACTIVE_ARCH = YES in HomeAssistant.debug.xcconfig introduced a whole new suite of errors. Namely, "Could not find module 'PromiseKit' for target 'x86_64-apple-ios-simulator'; found: arm64, arm64-apple-ios-simulator". Build App-Debug_2021-07-23T12-37-28.txt

Trying to run XCODE_BETA=true bundle exec pod install during the setup phase instead of bundle exec pod install --repo-update also did not work and just ended up emitting the same error about Lottie.

Did you manage to get it working, because i try to run it on my M1 Mac using rosetta but when i run the command bundle exec pod install --repo-update i get the error "NotificationTestCases"

`
Checking for latest...
Latest available: 6.2.95; latest supported: 6.1.95
Out of date, but latest supported installed
Updating local specs repositories

CocoaPods 1.11.2 is available.
To update use: gem install cocoapods

For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.11.2

Analyzing dependencies
Pre-downloading: CPDAcknowledgements from https://github.com/CocoaPods/CPDAcknowledgements, commit 2f289a19c3ec41f835a9629fdbea4a89033f61a1
Pre-downloading: ColorPickerRow from https://github.com/EurekaCommunity/ColorPickerRow, commit dcf9545cbe75d0f78b1b96e880d6aa85f98b0795
Pre-downloading: Communicator from https://github.com/zacwest/Communicator.git, commit f5dd96048cbe1e7ebfee85688c23c17c6f71f9e4
Pre-downloading: EMTLoadingIndicator from https://github.com/hirokimu/EMTLoadingIndicator, commit ff5b4ccf9bb424cb454e76ee91e32165d2d9c12c
Fetching podspec for Firebase from Configuration/Podspecs/Firebase.podspec.json
Pre-downloading: HAKit from https://github.com/home-assistant/HAKit.git, commit 0e22e80ee8626e5611f00db08f80ef9150b85345
Pre-downloading: NotificationTestCases from https://github.com/home-assistant/mobile-apps-fcm-push.git, commit 03d66c0b348b1b005cba083d5b9007d29501ce43
[!] Unable to find a specification for 'NotificationTestCases'.`

@zacwest
Copy link
Member

zacwest commented Oct 15, 2021

Hmm, I've had some trouble with that one too. For the moment you can comment it out in the Podfile (it's used to grab .json files, not code, so it will still run), I need to switch that to a subrepo or a script which pulls in those shared test cases.

@orcema
Copy link

orcema commented Oct 15, 2021

After serveral trial and errors i made it up to install successfully on M1 MAC.
Executing the installation instructions on the git page

brew bundle
bundle install
bundle exec pod install --repo-update

i got the error:

Could not find rake-13.0.6 in any of the sources
Run `bundle install` to install missing gems.

then i tried

bundle install --path vendor/cache
pod deintegrate
bundle exec pod install --repo-update

and finally installation was successful

......
Generating Pods project
Integrating client project
Adding Acknowledgements
Pod installation complete! There are 34 dependencies from the Podfile and 33 total pods installed.

but now i have the error here below on target WachApp but cant't figure out what this means.

Provisioning profile "iOS Team Provisioning Profile: *" doesn't include the aps-environment entitlement.

@zacwest
Can you please give me a hint for resolving this error, what is this aps-environement entitlement ?

@zacwest
Copy link
Member

zacwest commented Oct 15, 2021

aps-environment is the APNS environment key. This should be set up by default in provisioning profiles from the automatic provisioning. If you're trying to build to a device, code signing is required; have you set up an account with developer.apple.com? Did you override the team information in the .xcconfig file as the README states?

@orcema
Copy link

orcema commented Oct 15, 2021

Yes i did the override for the "DEVELOPMENT_TEAM" and the "BUNDLE_ID_PREFIX" in the
Screenshot 2021-10-15 at 22 04 59
and for most of the targets the automatic signing worked except for targets App, Watchapp and Extension-PushProvider. I managed to fix it manually the automatic signing management except for the WatchApp target.
Screenshot 2021-10-15 at 22 06 51

@zacwest
Copy link
Member

zacwest commented Oct 15, 2021

Can you share the exact modifications you did to the xcconfig? The advised route is to add additional keys in a gitignored xcconfig, but if you replace the team ID in all the places the xcconfig references it, you're opting into manual code signing for those targets, which requires special entitlements from Apple that you must apply for.

@orcema
Copy link

orcema commented Oct 15, 2021

I changed the "team ID" only in the above illustrated HomeAssistant file and then ran the build.
I will start over and try to apply the adivsed route.
I initially followed the advised route but it failed to override the "DEVELOPMENT_TEAM" and the "BUNDLE_ID_PREFIX" .

@orcema
Copy link

orcema commented Oct 16, 2021

I followed the advised route and put "DEVELOPMENT_TEAM" and the "BUNDLE_ID_PREFIX" in a new config file "HomeAssistant.overrides.xcconfig"

Screenshot 2021-10-16 at 06 42 13

This time I didn't change anything in the "HomeAssistant.xcconfig"

Screenshot 2021-10-16 at 06 41 53

ran the installation with success, switched sheme to app-debug

Screenshot 2021-10-16 at 06 49 11

then i ran the build and ended up with the same result as previously editing directly the "HomeAssistant.xcconfig", e.g.

Screenshot 2021-10-16 at 06 32 29

Screenshot 2021-10-16 at 06 34 00

I have to switch the provisioning profile in the build settings from "Local Developer" to "automatic".

Screenshot 2021-10-16 at 06 35 23

This works for targets "App" and "Extension-PushProvider" but not for "Watchapp".

Screenshot 2021-10-16 at 06 57 12

@zacwest
Copy link
Member

zacwest commented Oct 16, 2021

Ah, I see; I thought setting the CODE_SIGNING_STYLE to Manual conditionally would cause it to ignore that specified provisioning profile, but it's still using it as the basis for automatic. That explains why App & the Extensions-PushProvider targets are not working.

I do not see any obvious reason why the WatchApp target is failing, though; it doesn't use any special entitlements there. Can you go to the Signing report in the issue navigator as it's suggesting and paste the contents? It'll look like:

image

@orcema
Copy link

orcema commented Oct 16, 2021

like this ?

Screenshot 2021-10-16 at 07 17 52

Update Signing_2021-10-16T07-14-55.txt

@orcema
Copy link

orcema commented Oct 16, 2021

I tried removing the target "Watchapp" but then i get another kind of error

Screenshot 2021-10-16 at 07 11 45

and here i the log:
Build App-Debug_2021-10-16T07-26-53.txt

@zacwest
Copy link
Member

zacwest commented Oct 16, 2021

Give that branch a try, it should resolve the automatic code signing issues.

@orcema
Copy link

orcema commented Oct 16, 2021

i switched over to branch automatic provisioning but ended up with the same error as above when i removed the target Watchapp

Screenshot 2021-10-16 at 07 54 46

and here the error logs:
Build App-Debug_2021-10-16T07-52-39.txt

@zacwest
Copy link
Member

zacwest commented Oct 16, 2021

Deleting that target will require you to re-integrate Cocoapods, probably; but you should not need to delete the WatchApp target with the branch above.

@orcema
Copy link

orcema commented Oct 16, 2021

i switched over to branch automatic provisioning but ended up with the same error as above when i removed the target Watchapp

Screenshot 2021-10-16 at 07 54 46

and here the error logs: Build App-Debug_2021-10-16T07-52-39.txt

This is the build result with the branch "automatic-provisioning" without deleting the target "WatchApp"

@zacwest
Copy link
Member

zacwest commented Oct 16, 2021

Can you try cleaning in Xcode in Product > Clean Build Folder? This seems like it may be a stale build profile in the new build system. You may need to kill the Pods directory entirely from the earlier target deletion if it's confused.

@orcema
Copy link

orcema commented Oct 16, 2021

I already did a "Clean Build Folder" and ran again the working installation procedure for the M1 Mac
#1681 (comment)
but nothing changes, always the same issue...
😢

@zacwest
Copy link
Member

zacwest commented Oct 16, 2021

It's erroring on the [CP] Embed Pods Frameworks script, saying its input file set (InputFileList-36460EB356C0C600F45AD622-Pods-iOS-App-frameworks-Debug-input-files-4f6d0d76000313cd5d01fc2a2198a9b7-resolved.xcfilelist) contains an element which chains back to it.

It looks like it's the Unembed Lokalise for Catalyst script in the build phase for the App target. If you remove this, does it work?

@orcema
Copy link

orcema commented Oct 16, 2021

it compiled with success by changing the build phase position for the [CP] Embed Pods Frameworks

Screenshot 2021-10-16 at 08 37 19

🥳 🎉 Thanks for your help @zacwest

@orcema
Copy link

orcema commented Oct 16, 2021

@zacwest I have a last issue concerning the push notifications.
Despite having configured the Notification with a certificate

Screenshot 2021-10-16 at 10 40 34

i still get the build warnings "push provider is disabled".

Screenshot 2021-10-16 at 10 36 52

related log warnings:
Build App-Debug_2021-10-16T10-32-47.txt

what do i have to do to enable push notifiations ?

@zacwest
Copy link
Member

zacwest commented Oct 16, 2021

That's the local push extension, which requires a special provisioning profile entitlement from Apple. You can ignore it if you're going to be sending notifications via APNS.

@zacwest
Copy link
Member

zacwest commented Oct 31, 2021

I've got an M1 now (hooray!) and everything seems peachy at this point.

@zacwest zacwest closed this as completed Oct 31, 2021
@orcema
Copy link

orcema commented Oct 31, 2021

I've got an M1 now (hooray!) and everything seems peachy at this point.

did you have to reorder the build phase position too ?

@zacwest
Copy link
Member

zacwest commented Oct 31, 2021

No

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

No branches or pull requests

3 participants