Babylonjs React Native iOS build failed

device
MacBook Air 2020 M1

target: iOS15.4, Simulator iPhone 13

package.json

{
  "name": "babylonjs_rn_0_69_3",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "@babylonjs/core": "^5.32.1",
    "@babylonjs/loaders": "^5.32.1",
    "@babylonjs/react-native": "^1.4.0",
    "@babylonjs/react-native-iosandroid-0-69": "^1.4.0",
    "babylonjs-gltf2interface": "^5.22.0",
    "react": "18.0.0",
    "react-native": "0.69.3",
    "react-native-permissions": "^3.0.0"
  },
  "devDependencies": {
    "@babel/preset-env": "^7.1.6",
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "@tsconfig/react-native": "^2.0.2",
    "@types/jest": "^29.2.2",
    "@types/react": "^18.0.25",
    "@types/react-native": "0.69.3",
    "@types/react-test-renderer": "^18.0.0",
    "@typescript-eslint/eslint-plugin": "^5.42.1",
    "@typescript-eslint/parser": "^5.42.1",
    "babel-jest": "^26.6.3",
    "eslint": "^7.32.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "^0.70.3",
    "react-test-renderer": "18.0.0",
    "typescript": "4.6.3"
  },
  "jest": {
    "preset": "react-native",
    "moduleFileExtensions": [
      "ts",
      "tsx",
      "js",
      "jsx",
      "json",
      "node"
    ]
  }
}

error log at last

ld: in /Users/laioyu/CodeProjects/babylonjs_rn_0_69_3/node_modules/@babylonjs/react-native-iosandroid-0-69/ios/libs/libBabylonNative.a(BabylonNative.o), building for iOS Simulator, but linking in object file built for iOS, file '/Users/laioyu/CodeProjects/babylonjs_rn_0_69_3/node_modules/@babylonjs/react-native-iosandroid-0-69/ios/libs/libBabylonNative.a' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Do you repro @srzerbetto ?

1 Like

Thank for your attention!

I think I’ve solved the problem by recreating a new project. But I don’t know why I got this error, maybe I used to run it on both the iOS device and the simulator, which caused the abnormal link. Now I followed this tutorial step by step to recreate the project and run it, and no errors were found.

npm package:@babylonjs/react-native - npm
repo: GitHub - Laioyu/babylonjs_rn

3 Likes