robingenz / capacitor-mlkit-plugin-demo

⚡️ Simple Ionic Angular app to demonstrate the use of certain Capacitor ML Kit plugins.
MIT License
37 stars 22 forks source link

bug: Compile error with SwiftEmitModule #21

Closed stnbndr closed 4 months ago

stnbndr commented 5 months ago

Describe the bug I have gone through the Getting Startet guide. But if I try to compile the app with

npx ionic cap run ios

I get an error

The following build commands failed:
[capacitor]         SwiftEmitModule normal x86_64 Emitting\ module\ for\ App (in target 'App' from project 'App')
[capacitor]         (1 failure)
[capacitor]         
[ERROR] An error occurred while running subprocess capacitor.

        capacitor run ios --target 7945FAD9-4A05-44EE-82ED-4A5989B835BF exited with exit code 1.

To Reproduce Go trough the steps of the Getting Started guide

git clone https://github.com/robingenz/capacitor-mlkit-plugin-demo.git
cd capacitor-mlkit-plugin-demo
npm i
npx ionic cap sync ios
npx ionic cap run ios

Expected behavior The App should start in the iOS Simulator

Screenshots Bildschirmfoto 2024-04-04 um 11 31 22

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context I am a bit confused about the message with "x86_64" because I'm on an ARM Mac. Maybe some problem with Rosetta?

If I remove the

"@capacitor-mlkit/barcode-scanning": "5.4.0",
"@capacitor-mlkit/face-detection": "5.4.0",
"@capacitor-mlkit/face-mesh-detection": "5.4.0",
"@capacitor-mlkit/selfie-segmentation": "5.4.0",

from the package.json and re run

npx ionic cap sync ios
npx ionic cap run ios

compiling and opening in simulator works fine. But of course I get an error then, because of the missing plugin. Bildschirmfoto 2024-04-04 um 11 45 23

annisaabuhamid commented 5 months ago

i also encounter the same issue too

robingenz commented 5 months ago

Thank you, I will take a look.

robingenz commented 5 months ago

Thank you, I will take a look.

sonvh0610 commented 4 months ago

same issue here, cannot build in ios version but android version works fine

Hardware: MacBook Pro with M3 Pro OS: macOS 14.4.1 Xcode 15.3 Device: iPhone 15 Pro Max Simulator OS: iOS 17.2

robingenz commented 4 months ago

The app was just updated to Capacitor 6. Please try it again. I tested it myself and everything worked without problems.

I'm therefore closing this issue.

JaapWeijland commented 4 months ago

I have both Capacitor and this plugin running on v6 and I still got the error.

Package.json deps:

"dependencies": {
    "@capacitor-mlkit/barcode-scanning": "^6.0.0",
    "@capacitor/app": "6.0.0",
    "@capacitor/core": "6.0.0",
    "@capacitor/haptics": "6.0.0",
    "@capacitor/ios": "^6.0.0",
    "@capacitor/keyboard": "6.0.0",
    "@capacitor/status-bar": "6.0.0",
    "@ionic/react": "^8.0.0",
    "@ionic/react-router": "^8.0.0",
    "@types/react-router": "^5.1.20",
    "@types/react-router-dom": "^5.3.3",
    "class-variance-authority": "^0.7.0",
    "ionicons": "^7.0.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-router": "^5.3.4",
    "react-router-dom": "^5.3.4",
    "tailwindcss-animate": "^1.0.7"
  },
  "devDependencies": {
    "@capacitor/cli": "6.0.0",
    "@testing-library/dom": ">=7.21.4",
    "@testing-library/jest-dom": "^5.16.5",
    "@testing-library/react": "^14.0.0",
    "@testing-library/user-event": "^14.4.3",
    "@types/react": "^18.0.27",
    "@types/react-dom": "^18.0.10",
    "@vitejs/plugin-legacy": "^5.0.0",
    "@vitejs/plugin-react": "^4.0.1",
    "autoprefixer": "^10.4.19",
    "cypress": "^13.5.0",
    "eslint": "^8.35.0",
    "eslint-plugin-react": "^7.32.2",
    "jsdom": "^22.1.0",
    "postcss": "^8.4.38",
    "tailwindcss": "^3.4.3",
    "terser": "^5.4.0",
    "typescript": "^5.1.6",
    "vite": "^5.0.0",
    "vitest": "^0.34.6"
  },

Error:

The following build commands failed: [capacitor] SwiftEmitModule normal x86_64 Emitting\ module\ for\ App (in target 'App' from project 'App')

JaapWeijland commented 4 months ago

When I build the app with Xcode, I get the following popup:

Build failed because Capacitor.swiftmodule is not built for arm64. Would you like to show all run destinations instead? Ensure all targets are configured to build for standard architectures. If your project uses external dependencies, contact those vendors to provide updated copies built to support all architectures. You can control the visibility of architecture-specific run destinations in the Product > Destination menu.

BeetrootToYourself commented 4 months ago

Getting the same issue as @JaapWeijland. All dependencies updated.

EDIT (updated): This looks to be an issue with the way that apple silicon is compiling. Using a Rosetta based emulator compiles without issue as well as builds to a physical iPhone.

EDIT (Solution): https://github.com/ionic-team/capacitor/issues/7425