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

@Cedric I also have a similar issue.

Without any changes to in the base BabylonReactNativeSample repository, when I run npm run ios, the following error appears on the terminal:

--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:iOS Simulator, id:C56A23C8-DDAB-48A9-9C11-E7048628CE43, OS:18.3.1, name:iPhone 13 }
{ platform:iOS Simulator, id:C56A23C8-DDAB-48A9-9C11-E7048628CE43, OS:18.3.1, name:iPhone 13 }
** BUILD FAILED **


The following build commands failed:
        ScanDependencies /Users/caner/Library/Developer/Xcode/DerivedData/BabylonReactNativeSample-bqmhmivxmpwtchfhyjtoluxcmvzn/Build/Intermediates.noindex/BabylonReactNativeSample.build/Debug-iphonesimulator/BabylonReactNativeSample.build/Objects-normal/arm64/main.o /Users/caner/Caner/Muhendis/_Repos/BabylonReactNativeSample/ios/BabylonReactNativeSample/main.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'BabylonReactNativeSample' from project 'BabylonReactNativeSample')
        ScanDependencies /Users/caner/Library/Developer/Xcode/DerivedData/BabylonReactNativeSample-bqmhmivxmpwtchfhyjtoluxcmvzn/Build/Intermediates.noindex/BabylonReactNativeSample.build/Debug-iphonesimulator/BabylonReactNativeSample.build/Objects-normal/arm64/BabylonReactNativeSample_vers.o /Users/caner/Library/Developer/Xcode/DerivedData/BabylonReactNativeSample-bqmhmivxmpwtchfhyjtoluxcmvzn/Build/Intermediates.noindex/BabylonReactNativeSample.build/Debug-iphonesimulator/BabylonReactNativeSample.build/DerivedSources/BabylonReactNativeSample_vers.c normal arm64 c com.apple.compilers.llvm.clang.1_0.compiler (in target 'BabylonReactNativeSample' from project 'BabylonReactNativeSample')
        Building workspace BabylonReactNativeSample with scheme BabylonReactNativeSample and configuration Debug
(3 failures)

Device: MacBook Pro M3 Max macOS 15.3.2 (24D81)
Simulator: iPhone 13 iOS 18.3.1 (22D8075)

Any help is much appreciated! Thanks!

I building GitHub - BabylonJS/BabylonReactNativeSample to see if I get the same error…

1 Like

Could you build it? Does it work?

nope, I’ll do a PR to update dependencies and see if it fixes things

I didn’t forget your issue. I’m just late :slight_smile:

1 Like