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

bug: Running xcodebuild - failed! After installing barcode plugin on mac m1 (macOS Sonoma 14.0) / ios 17. #85

Closed
4 of 10 tasks
AntonGrafton opened this issue Oct 12, 2023 · 11 comments

Comments

@AntonGrafton
Copy link

Plugin(s)

  • Barcode Scanning
  • Face Detection
  • Face Mesh Detection
  • Selfie Segmentation
  • Translation

Did you test the latest version?

  • I use the latest version

Platform(s)

  • Android
  • iOS
  • Web

Current behavior

error.txt

Expected behavior

After installing the barcode scanning plugin and trying to run the simulator i get a huge error. When i remove the plugin, everything can build properly.

Reproduction

Steps to reproduce

  1. install plugin in a capacitatorjs project using mac m1 (macOS Sonoma 14.0) / ios 17.
  2. See error

Other information

No response

Capacitor doctor

💊 Capacitor Doctor 💊

Latest Dependencies:

@capacitor/cli: 5.5.0
@capacitor/core: 5.5.0
@capacitor/android: 5.5.0
@capacitor/ios: 5.5.0

Installed Dependencies:

@capacitor/cli: 5.5.0
@capacitor/core: 5.5.0
@capacitor/android: 5.5.0
@capacitor/ios: 5.5.0

[success] iOS looking great! 👌
[success] Android looking great! 👌

Before submitting

  • I understand that incomplete issues (e.g. without reproduction) are closed.
@AntonGrafton AntonGrafton added bug/fix Something isn't working needs: triage labels Oct 12, 2023
@robingenz
Copy link
Member

Thank you for your request. I use a Mac M1 myself and have no problems. Please provide a Minimal, Reproducible Example using this template in a public GitHub repository so I can debug the issue.

@AntonGrafton
Copy link
Author

AntonGrafton commented Oct 12, 2023

Hello, i could do that. But i just made a brand new project and installed the plugin and got this:

could not find module 'Capacitor' for target 'x86_64-apple-ios-simulator'; found: arm64-apple-ios-simulator, at: /Users/antonsjolander/capacitor-grafton/ios/DerivedData/9DBB5611-90DD-4AF2-B954-427EB5BB5F75/Build/Products/Debug-iphonesimulator/Capacitor/Capacitor.framework/Modules/Capacitor.swiftmodule import Capacitor

I've never seen that error until I installed your plugin.

"dependencies": {
"@capacitor-mlkit/barcode-scanning": "^5.3.0",
"@capacitor/android": "5.5.0",
"@capacitor/app": "5.0.6",
"@capacitor/core": "5.5.0",
"@capacitor/haptics": "5.0.6",
"@capacitor/ios": "5.5.0",
"@capacitor/keyboard": "5.0.6",
"@capacitor/status-bar": "5.0.6",
"@ionic/vue": "^7.0.0",
"@ionic/vue-router": "^7.0.0",
"ionicons": "^7.0.0",
"vue": "^3.2.45",
"vue-router": "^4.1.6"
},
"devDependencies": {
"@capacitor/cli": "5.5.0",
"@vitejs/plugin-legacy": "^4.0.2",
"@vitejs/plugin-vue": "^4.0.0",
"@vue/eslint-config-typescript": "^11.0.2",
"@vue/test-utils": "^2.3.0",
"cypress": "^12.7.0",
"eslint": "^8.35.0",
"eslint-plugin-vue": "^9.9.0",
"jsdom": "^22.1.0",
"typescript": "^5.1.6",
"vite": "^4.3.9",
"vitest": "^0.32.2",
"vue-tsc": "^1.0.24"
},

@AntonGrafton
Copy link
Author

Thank you for your request. I use a Mac M1 myself and have no problems. Please provide a Minimal, Reproducible Example using this template in a public GitHub repository so I can debug the issue.

https://github.com/AntonGrafton/capacitor-grafton

@robingenz
Copy link
Member

Can you reproduce your issue with the Capacitor ML Kit Plugin Demo project?

@AntonGrafton
Copy link
Author

Can you reproduce your issue with the Capacitor ML Kit Plugin Demo project?

image

I get the same error after trying to run your project on a IOS simulator. I'm using Xcode 15 by the way.

@robingenz
Copy link
Member

The problem seems to affect only simulators. I have no problems on my physical iPhone 13.
The following fix worked for me: robingenz/capacitor-mlkit-plugin-demo@484b919

@AntonGrafton
Copy link
Author

The problem seems to affect only simulators. I have no problems on my physical iPhone 13. The following fix worked for me: robingenz/capacitor-mlkit-plugin-demo@484b919

Thank you Robin. I'll try! :)

@AntonGrafton
Copy link
Author

Yep. That solved it! By adding your code to my podfile solved it. Thank you!

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |configuration|
target.build_settings(configuration.name)['ONLY_ACTIVE_ARCH'] = 'NO'
end
end
end

@seriousjelly
Copy link

I am having this issue:

  • Latest XCode/MacOS version (fresh install)
  • Latest Ionic (fresh install)
  • Latest package version

Fails to build in simulator, although, I am able to open the generated XCode project and run in the simulator directly.

@Rdevc
Copy link

Rdevc commented Dec 21, 2023

Hello!

Thank you for the provided solution, and I apologize in advance for responding to a closed issue.

Are you certain that this isn't merely activating a different 'Rosetta' way, serving as a quick fix rather than a real solution? It appears to be enabling a 'use all' approach, when it should be utilizing the ARM64 architecture instead. There will come a time when Apple will mandate 'no more Rosetta; build for ARM64.'

I'm also curious as to why other plugins do not encounter this issue.

Hope to hear from you and thank you in advance for reading and answering!

Kind regards

@robingenz
Copy link
Member

I'm also curious as to why other plugins do not encounter this issue.

This has nothing to do with the plugin but with the pod. You should therefore post your question in https://github.com/googlesamples/mlkit.

This is currently the only solution/workaround I have found. If anyone has a better solution, I would appreciate any tips.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants